protected void validateActive() { if (!active) { throw newInvalidRequest("%s is no longer active", name); } }
private void addInternal(FullEntity<Key> entity) { Key key = entity.getKey(); if (toAdd.containsKey(key) || toUpdate.containsKey(key) || toPut.containsKey(key)) { throw newInvalidRequest( "Entity with the key %s was already added or updated in this %s", entity.getKey(), name); } if (toDelete.remove(key)) { toPut.put(key, entity); } else { toAdd.put(key, entity); } }
@SafeVarargs @Override public final void update(Entity... entities) { validateActive(); for (Entity entity : entities) { Key key = entity.getKey(); if (toDelete.contains(key)) { throw newInvalidRequest( "Entity with the key %s was already deleted in this %s", entity.getKey(), name); } if (toAdd.remove(key) != null || toPut.containsKey(key)) { toPut.put(key, entity); } else { toUpdate.put(key, entity); } } }
protected void validateActive() { if (!active) { throw newInvalidRequest("%s is no longer active", name); } }
private void addInternal(FullEntity<Key> entity) { Key key = entity.getKey(); if (toAdd.containsKey(key) || toUpdate.containsKey(key) || toPut.containsKey(key)) { throw newInvalidRequest( "Entity with the key %s was already added or updated in this %s", entity.getKey(), name); } if (toDelete.remove(key)) { toPut.put(key, entity); } else { toAdd.put(key, entity); } }
@SafeVarargs @Override public final void update(Entity... entities) { validateActive(); for (Entity entity : entities) { Key key = entity.getKey(); if (toDelete.contains(key)) { throw newInvalidRequest( "Entity with the key %s was already deleted in this %s", entity.getKey(), name); } if (toAdd.remove(key) != null || toPut.containsKey(key)) { toPut.put(key, entity); } else { toUpdate.put(key, entity); } } }