public Folder saveFolder(Folder folder) { CommitContext commitContext = new CommitContext(Collections.singleton(folder)); Set<Entity> res = dataService.commit(commitContext); for (Entity entity : res) { if (entity.equals(folder)) return (Folder) entity; } return null; }
protected void saveFileDescriptor(FileDescriptor fd) { CommitContext commitContext = new CommitContext(Collections.singleton(fd)); dataService.commit(commitContext); }
@Override public void remove(Entity entity) { CommitContext context = new CommitContext( Collections.<Entity>emptyList(), Collections.singleton(entity)); commit(context); }
@Override public void remove(Entity entity) { CommitContext context = new CommitContext( Collections.<Entity>emptyList(), Collections.singleton(entity)); commit(context); }
@Override public EntitySet commit(Entity... entities) { return commit(new CommitContext(entities)); }
public void removeFolder(Folder folder) { CommitContext commitContext = new CommitContext(Collections.emptySet(), Collections.singleton(folder)); dataService.commit(commitContext); }
@Override public EntitySet commit(Entity... entities) { return commit(new CommitContext(entities)); }
protected void saveFileDescriptor(FileDescriptor fd) { CommitContext commitContext = new CommitContext(Collections.singleton(fd)); dataService.commit(commitContext); }
@Override public <E extends Entity> E commit(E entity, @Nullable View view) { Set<Entity> res = commit(new CommitContext().addInstanceToCommit(entity, view)); for (Entity e : res) { if (e.equals(entity)) { //noinspection unchecked return (E) e; } } return null; }
@Override public EntitySet save(Entity... entities) { CommitContext cc = new CommitContext(entities); cc.setJoinTransaction(true); return dataManager.commit(cc); }
protected void removeFilterEntity() { CommitContext ctx = new CommitContext(Collections.emptyList(), Collections.singletonList(filterEntity)); dataService.commit(ctx); filterEntities.remove(filterEntity); setFilterEntity(adHocFilter); initFilterSelectComponents(); updateWindowCaption(); }
@Override public <E extends Entity> E commit(E entity, @Nullable View view) { return commit(new CommitContext().addInstanceToCommit(entity, view)).get(entity); }
@Override public void commit() { if (!needToUpdate.isEmpty() || !needToRemove.isEmpty()) { DataService ds = AppBeans.get(DataService.NAME); CommitContext ctx = new CommitContext( Collections.unmodifiableSet(needToUpdate), Collections.unmodifiableSet(needToRemove) ); Set<Entity> commitResult = ds.commit(ctx); commited(commitResult); clearCommitList(); firePresentationsSetChanged(); } }
@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); }
@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 void remove(Entity entity) { CommitContext cc = new CommitContext(); cc.addInstanceToRemove(entity); cc.setJoinTransaction(true); dataManager.commit(cc); }
protected Set<Entity> commitToDataManager() { CommitContext commitContext = new CommitContext( filterCommittedInstances(modifiedInstances), filterCommittedInstances(removedInstances)); if (commitDelegate == null) { return getDataManager().commit(commitContext); } else { return commitDelegate.apply(commitContext); } }
protected CommitContext createCommitContext(CommitContext context) { CommitContext newCtx = new CommitContext(); newCtx.setSoftDeletion(context.isSoftDeletion()); newCtx.setDiscardCommitted(context.isDiscardCommitted()); newCtx.setAuthorizationRequired(context.isAuthorizationRequired()); newCtx.setJoinTransaction(context.isJoinTransaction()); return newCtx; }
protected void initIsDefaultCheckbox() { isDefault.setValue(BooleanUtils.isTrue(category.getIsDefault())); isDefault.addValueChangeListener(e -> { if (Boolean.TRUE.equals(e.getValue())) { LoadContext<Category> lc = new LoadContext<>(Category.class) .setView("category.defaultEdit"); lc.setQueryString("select c from sys$Category c where c.entityType = :entityType and not c.id = :id") .setParameter("entityType", category.getEntityType()) .setParameter("id", category.getId()); List<Category> result = dataManager.loadList(lc); for (Category cat : result) { cat.setIsDefault(false); } CommitContext commitCtx = new CommitContext(result); dataManager.commit(commitCtx); category.setIsDefault(true); } else if (Boolean.FALSE.equals(e.getValue())) { category.setIsDefault(false); } }); }