@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 <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, @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); }
@Override public void commit() { backgroundWorker.checkUIAccess(); if (!allowCommit) { return; } if (getCommitMode() == CommitMode.DATASTORE) { DataSupplier supplier = getDataSupplier(); CommitContext context = new CommitContext(); for (Entity entity : itemsToCreate) { context.addInstanceToCommit(entity, view); } for (Entity entity : itemsToUpdate) { context.addInstanceToCommit(entity, view); } for (Entity entity : itemsToDelete) { context.addInstanceToRemove(entity); } Set<Entity> committed = supplier.commit(context); committed(committed); } else { throw new UnsupportedOperationException(); } }
for (Entity entity : result) { if (toRepeat.contains(entity)) { cc.addInstanceToCommit(entity, context.getViews().get(entity));
/** * Set <code>finishedTs</code> to all sessions that were interrupted by server reboot */ protected void closeDeadSessionsOnStartup() { if (!globalConfig.getUserSessionLogEnabled()) { return; } if (clusterManager.isMaster()) { authentication.withSystemUser(() -> { LoadContext<SessionLogEntry> lc = LoadContext.create(SessionLogEntry.class).setView(SessionLogEntry.DEFAULT_VIEW) .setQuery(createQuery("select e from sec$SessionLogEntry e where e.finishedTs is null")); List<SessionLogEntry> sessionLogEntries = dataManager.loadList(lc); CommitContext cc = new CommitContext(); Set<UUID> activeSessionsIds = userSessionsAPI.getUserSessionsStream() .map(UserSession::getId) .collect(Collectors.toSet()); for (SessionLogEntry entry : sessionLogEntries) { if (activeSessionsIds.contains(entry.getSessionId())) { continue; // do not touch active session records } entry.setFinishedTs(timeSource.currentTimestamp()); entry.setLastAction(SessionAction.EXPIRATION); cc.addInstanceToCommit(entry); } dataManager.commit(cc); log.info("Dead session records have been closed"); return null; }); } }
commitContext.addInstanceToCommit(dstEntity, regularView);