@Override protected void doInTransactionWithoutResult(TransactionStatus status) { sessionFactory.getCurrentSession().saveOrUpdate(versionInfo); } });
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { clearEnabledUserCountFromCache(); } }); sessionFactory.getCurrentSession().saveOrUpdate(copyLoginToDisplayNameIfNotPresent(user)); } });
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { sessionFactory.getCurrentSession().saveOrUpdate(plugin); goCache.remove(cacheKey); } });
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { synchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { String cacheKey = cacheKeyForUsageStatisticsReporting(); synchronized (cacheKey) { goCache.remove(cacheKey); } } }); sessionFactory.getCurrentSession().saveOrUpdate(usageStatisticsReporting); } });
public void saveOrUpdate(DataSharingSettings dataSharingSettings) throws DuplicateDataSharingSettingsException { DataSharingSettings existing = load(); if (dataSharingSettings.hasId() && dataSharingSettings.getId() != existing.getId()) { throw new DuplicateDataSharingSettingsException(); } if (existing != null) { existing.copyFrom(dataSharingSettings); } else { existing = dataSharingSettings; } sessionFactory.getCurrentSession().saveOrUpdate(existing); }
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { clearLockedPipelineStateCache(pipelineName); } }); transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCompletion(int status) { for (AfterCompletionCallback callback : afterCompletionCallbacks) { callback.execute(status); } } }); final String cacheKey = pipelineLockStateCacheKey(pipelineName); PipelineState fromCache = pipelineStateFor(pipelineName); PipelineState toBeSaved = null; if (fromCache == null) { toBeSaved = new PipelineState(pipelineName); } else { toBeSaved = (PipelineState) sessionFactory.getCurrentSession().load(PipelineState.class, fromCache.getId()); } toBeSaved.unlock(); sessionFactory.getCurrentSession().saveOrUpdate(toBeSaved); } });
sessionFactory.getCurrentSession().saveOrUpdate(toBeSaved);
@Override public void saveOrUpdate(EmptyScan emptyScan) { sessionFactory.getCurrentSession().saveOrUpdate(emptyScan); } }
public Stratum updateStratum(Stratum stratum) { Session session = sessionFactory.getCurrentSession(); session.saveOrUpdate(stratum); return stratum; }
@Override public void saveOrUpdate(VulnerabilityFilter vulnerabilityFilter) { if (vulnerabilityFilter != null && vulnerabilityFilter.getId() != null) { sessionFactory.getCurrentSession().merge(vulnerabilityFilter); } else { sessionFactory.getCurrentSession().saveOrUpdate(vulnerabilityFilter); } }
@Override public void saveOrUpdate(AccessControlApplicationMap map) { if (map != null && map.getId() != null) { sessionFactory.getCurrentSession().merge(map); } else { sessionFactory.getCurrentSession().saveOrUpdate(map); } }
@Override public void saveOrUpdate(AccessControlTeamMap map) { if (map != null && map.getId() != null) { sessionFactory.getCurrentSession().merge(map); } else { sessionFactory.getCurrentSession().saveOrUpdate(map); } }
@Override public void saveOrUpdate(Application application) { if (application != null && application.getId() != null) { sessionFactory.getCurrentSession().merge(application); } else { sessionFactory.getCurrentSession().saveOrUpdate(application); } }
@Override public void saveOrUpdate(ChannelSeverity channelSeverity) { if (channelSeverity.getSeverityMap() != null) { sessionFactory.getCurrentSession().saveOrUpdate(channelSeverity.getSeverityMap()); } sessionFactory.getCurrentSession().saveOrUpdate(channelSeverity); sessionFactory.getCurrentSession().flush(); sessionFactory.getCurrentSession().refresh(channelSeverity); }
@Override public void saveOrUpdate(Role role) { if (role != null && role.getId() != null) { sessionFactory.getCurrentSession().merge(role); } else { sessionFactory.getCurrentSession().saveOrUpdate(role); } }
@Override public AuthenticationSession createSession(User user, int lifetimeInDays) { if (lifetimeInDays < 1) { throw new IllegalArgumentException("Lifetime attribute must be a positive integer"); } AuthenticationSession session = new AuthenticationSession(generateToken(), user, getCurrentDatePlusDays(lifetimeInDays)); sessionFactory.getCurrentSession().saveOrUpdate(session); return session; }
public void saveOrUpdateLayerModel(LayerModel lm) throws GeomajasSecurityException { if (((DeskmanagerSecurityContext) securityContext).saveAllowed(lm)) { factory.getCurrentSession().saveOrUpdate(lm); } else { throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Save layermodel", securityContext.getUserName()); } }
public void deleteBlueprint(Blueprint bp) throws GeomajasSecurityException { if (((DeskmanagerSecurityContext) securityContext).deleteAllowed(bp)) { bp.setDeleted(true); factory.getCurrentSession().saveOrUpdate(bp); } else { throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Delete blueprint", securityContext.getUserName()); } }
public void deleteBlueprint(Blueprint bp) throws GeomajasSecurityException { if (((DeskmanagerSecurityContext) securityContext).deleteAllowed(bp)) { bp.setDeleted(true); factory.getCurrentSession().saveOrUpdate(bp); } else { throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Delete blueprint", securityContext.getUserName()); } }
@Override public void updateUser(User user) throws GeomajasSecurityException { // need to get the user from db before updating: password is also in this object. User userDb = findById(user.getId()); /*userDb.setEmail(user.getEmail());*/ //can't update email userDb.setName(user.getName()); userDb.setSurname(user.getSurname()); userDb.setActive(user.isActive()); factory.getCurrentSession().saveOrUpdate(userDb); }