/** * Logs the change processor activity for audit purposes. * @param processor */ protected void logUserActivity(final ICDOCommitChangeSet cdoCommitChangeSet, IndexCommitChangeSet indexCommitChangeSet) { LogUtils.logUserEvent(LOGGER, cdoCommitChangeSet.getUserId(), branchPath, indexCommitChangeSet.getDescription()); }
@Override protected void onDeactivated(final ILifecycle lifecycle) { LOGGER.info("Received deactivation event: " + lifecycle); EventUtil.removeListener(lifecycle, this); final RpcSession sessionToLogout = knownSessions.remove(lifecycle); if (null == sessionToLogout) { LOGGER.info("No RPC session found to log out."); return; } if (sessionToLogout.containsKey(KEY_USER_ID) && sessionToLogout.containsKey(KEY_SESSION_ID)) { final String userId = String.valueOf(sessionToLogout.get(KEY_USER_ID)); if (!SpecialUserStore.SYSTEM_USER_NAME.equals(userId)) { final String sessionId = String.valueOf(sessionToLogout.get(KEY_SESSION_ID)); //Log as a user activity LogUtils.logUserEvent(AUDIT_LOGGER, userId, "Session closed: " + sessionId); //Log is as user access event LogUtils.logUserAccess(AUDIT_LOGGER, userId, "Logged out."); } } sessionToLogout.put(KEY_IS_AUTHENTICATED, false); fireLogoutEvent(sessionToLogout); } }
@Override protected void postRun() throws Exception { LOGGER.info("Committing changes..."); try { new CDOServerCommitBuilder(getUserId(), commitComment, transactions) .parentContextDescription(getLockDescription()) .commit(); LogUtils.logUserEvent(LOGGER, getUserId(), "Promoting changes finished successfully."); } catch (final CommitException e) { final RepositoryLockException lockException = Exceptions.extractCause(e, getClass().getClassLoader(), RepositoryLockException.class); if (null != lockException) { throw e; } else { throw new SnowowlServiceException("Error while promoting changes.", e); } } catch (final EmptyTransactionAggregatorException e) { throw new EmptyTransactionAggregatorException("Nothing to promote."); } }
@Override protected void postRun() throws CommitException { if (CompareUtils.isEmpty(transactions)) { return; } // Implicit branch change notification via committing new CDOServerCommitBuilder(getUserId(), commitComment, transactions) .parentContextDescription(getLockDescription()) .commit(); LogUtils.logUserEvent(LOGGER, getUserId(), "Synchronizing changes finished successfully."); }
LogUtils.logUserEvent(AUDIT_LOGGER, userId, "Session created: "+ sessionId);
@Override protected void apply(final String repositoryId, final IBranchPath taskBranchPath) throws Throwable { final ICDOConnection connection = getConnection(repositoryId); final IBranchPath parentBranchPath = taskBranchPath.getParent(); final CDOBranch taskBranch = connection.getBranch(taskBranchPath); if (taskBranch == null) { final String message = MessageFormat.format("Creating branch {0} in ''{1}''...", taskBranchPath, connection.getRepositoryName()); LOGGER.info(message); LogUtils.logUserEvent(LOGGER, getUserId(), parentBranchPath, message); final IEventBus eventBus = ApplicationContext.getServiceForClass(IEventBus.class); RepositoryRequests.branching() .prepareCreate() .setParent(parentBranchPath.getPath()) .setName(taskBranchPath.lastSegment()) .build(repositoryId) .execute(eventBus) .getSync(); } } }