/** * Returns the entity if it exists in the set. * * @param prototype a prototype instance whose class and id are used to look up an entity in the set. * @throws IllegalArgumentException if the entity not found */ @SuppressWarnings("unchecked") public <T extends Entity> T get(T prototype) { Preconditions.checkNotNullArgument(prototype, "prototype entity is null"); return (T) get(prototype.getClass(), prototype.getId()); }
@Override public <E extends Entity> E commit(E entity, @Nullable View view) { return commit(new CommitContext().addInstanceToCommit(entity, view)).get(entity); }
@Override public <E extends Entity> E save(E entity) { CommitContext cc = new CommitContext(entity); cc.setJoinTransaction(true); return dataManager.commit(cc).get(entity); }
@Override public <E extends Entity> E save(E entity, @Nullable String viewName) { CommitContext cc = new CommitContext(); cc.addInstanceToCommit(entity, viewName); cc.setJoinTransaction(true); return dataManager.commit(cc).get(entity); }
@Override public <E extends Entity> E save(E entity, @Nullable View view) { CommitContext cc = new CommitContext(); cc.addInstanceToCommit(entity, view); cc.setJoinTransaction(true); return dataManager.commit(cc).get(entity); }