public static void clearUserOperationLog(ProcessEngineConfigurationImpl processEngineConfiguration) { if (processEngineConfiguration.getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_FULL)) { HistoryService historyService = processEngineConfiguration.getHistoryService(); List<UserOperationLogEntry> logs = historyService.createUserOperationLogQuery().list(); for (UserOperationLogEntry log : logs) { historyService.deleteUserOperationLogEntry(log.getId()); } } }
public static void clearUserOperationLog(ProcessEngineConfigurationImpl processEngineConfiguration) { if (processEngineConfiguration.getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_FULL)) { HistoryService historyService = processEngineConfiguration.getHistoryService(); List<UserOperationLogEntry> logs = historyService.createUserOperationLogQuery().list(); for (UserOperationLogEntry log : logs) { historyService.deleteUserOperationLogEntry(log.getId()); } } }
protected HistoricProcessInstance getHistoricProcessInstance(CommandContext commandContext, String processInstanceId) { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); return historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInstanceId) .singleResult(); }
protected HistoricProcessInstance getHistoricProcessInstance(CommandContext commandContext, String processInstanceId) { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); return historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInstanceId) .singleResult(); }
protected void createHistoryCleanupJob(CommandContext commandContext) { if (Context.getProcessEngineConfiguration().getManagementService().getTableMetaData("ACT_RU_JOB") != null) { // CAM-9671: avoid transaction rollback due to the OLE being caught in CommandContext#close commandContext.getDbEntityManager().registerOptimisticLockingListener(new OptimisticLockingListener() { @Override public Class<? extends DbEntity> getEntityType() { return EverLivingJobEntity.class; } @Override public void failedOperation(DbOperation operation) { // nothing do to, reconfiguration will be handled later on } }); Context.getProcessEngineConfiguration().getHistoryService().cleanUpHistoryAsync(); } }
protected void createHistoryCleanupJob(CommandContext commandContext) { if (Context.getProcessEngineConfiguration().getManagementService().getTableMetaData("ACT_RU_JOB") != null) { // CAM-9671: avoid transaction rollback due to the OLE being caught in CommandContext#close commandContext.getDbEntityManager().registerOptimisticLockingListener(new OptimisticLockingListener() { @Override public Class<? extends DbEntity> getEntityType() { return EverLivingJobEntity.class; } @Override public void failedOperation(DbOperation operation) { // nothing do to, reconfiguration will be handled later on } }); Context.getProcessEngineConfiguration().getHistoryService().cleanUpHistoryAsync(); } }
protected HistoricActivityInstance resolveStartActivityInstance(HistoricProcessInstance processInstance) { HistoryService historyService = Context.getProcessEngineConfiguration().getHistoryService(); String processInstanceId = processInstance.getId(); String startActivityId = processInstance.getStartActivityId(); ensureNotNull("startActivityId", startActivityId); List<HistoricActivityInstance> historicActivityInstances = historyService .createHistoricActivityInstanceQuery() .processInstanceId(processInstanceId) .activityId(startActivityId) .orderPartiallyByOccurrence() .asc() .list(); ensureNotEmpty("historicActivityInstances", historicActivityInstances); HistoricActivityInstance startActivityInstance = historicActivityInstances.get(0); return startActivityInstance; }
protected VariableMap collectLastVariables(CommandContext commandContext, HistoricProcessInstance processInstance) { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); List<HistoricVariableInstance> historicVariables = historyService.createHistoricVariableInstanceQuery() .executionIdIn(processInstance.getId()) .list(); VariableMap variables = new VariableMapImpl(); for (HistoricVariableInstance variable : historicVariables) { variables.putValueTyped(variable.getName(), variable.getTypedValue()); } return variables; }
protected HistoricActivityInstance resolveStartActivityInstance(HistoricProcessInstance processInstance) { HistoryService historyService = Context.getProcessEngineConfiguration().getHistoryService(); String processInstanceId = processInstance.getId(); String startActivityId = processInstance.getStartActivityId(); ensureNotNull("startActivityId", startActivityId); List<HistoricActivityInstance> historicActivityInstances = historyService .createHistoricActivityInstanceQuery() .processInstanceId(processInstanceId) .activityId(startActivityId) .orderPartiallyByOccurrence() .asc() .list(); ensureNotEmpty("historicActivityInstances", historicActivityInstances); HistoricActivityInstance startActivityInstance = historicActivityInstances.get(0); return startActivityInstance; }
protected VariableMap collectLastVariables(CommandContext commandContext, HistoricProcessInstance processInstance) { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); List<HistoricVariableInstance> historicVariables = historyService.createHistoricVariableInstanceQuery() .executionIdIn(processInstance.getId()) .list(); VariableMap variables = new VariableMapImpl(); for (HistoricVariableInstance variable : historicVariables) { variables.putValueTyped(variable.getName(), variable.getTypedValue()); } return variables; }
public Void execute(CommandContext commandContext) { List<HistoricJobLog> historicJobLogs = processEngineConfiguration .getHistoryService() .createHistoricJobLogQuery() .list(); for (HistoricJobLog historicJobLog : historicJobLogs) { commandContext .getHistoricJobLogManager() .deleteHistoricJobLogById(historicJobLog.getId()); } return null; } });
public Void execute(CommandContext commandContext) { List<HistoricJobLog> historicJobLogs = processEngineConfiguration .getHistoryService() .createHistoricJobLogQuery() .list(); for (HistoricJobLog historicJobLog : historicJobLogs) { commandContext .getHistoricJobLogManager() .deleteHistoricJobLogById(historicJobLog.getId()); } return null; } });
public Object execute(CommandContext commandContext) { HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel(); if (historyLevel.equals(HistoryLevel.HISTORY_LEVEL_FULL)) { commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE); List<HistoricIncident> incidents = Context.getProcessEngineConfiguration().getHistoryService().createHistoricIncidentQuery().list(); for (HistoricIncident incident : incidents) { commandContext.getHistoricIncidentManager().delete((HistoricIncidentEntity) incident); } } return null; } });
public Object execute(CommandContext commandContext) { commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE); List<HistoricIncident> incidents = Context.getProcessEngineConfiguration().getHistoryService().createHistoricIncidentQuery().list(); for (HistoricIncident incident : incidents) { commandContext.getHistoricIncidentManager().delete((HistoricIncidentEntity) incident); } return null; } });
public Object execute(CommandContext commandContext) { commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE); List<HistoricIncident> incidents = Context.getProcessEngineConfiguration().getHistoryService().createHistoricIncidentQuery().list(); for (HistoricIncident incident : incidents) { commandContext.getHistoricIncidentManager().delete((HistoricIncidentEntity) incident); } return null; } });
protected VariableMap collectInitialVariables(CommandContext commandContext, HistoricProcessInstance processInstance) { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); HistoricActivityInstance startActivityInstance = resolveStartActivityInstance(processInstance); HistoricDetailQueryImpl query = (HistoricDetailQueryImpl) historyService.createHistoricDetailQuery() .variableUpdates() .executionId(processInstance.getId()) .activityInstanceId(startActivityInstance.getId()); List<HistoricDetail> historicDetails = query .sequenceCounter(1) .list(); VariableMap variables = new VariableMapImpl(); for (HistoricDetail detail : historicDetails) { HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate) detail; variables.putValueTyped(variableUpdate.getVariableName(), variableUpdate.getTypedValue()); } return variables; }
protected VariableMap collectInitialVariables(CommandContext commandContext, HistoricProcessInstance processInstance) { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); HistoricActivityInstance startActivityInstance = resolveStartActivityInstance(processInstance); HistoricDetailQueryImpl query = (HistoricDetailQueryImpl) historyService.createHistoricDetailQuery() .variableUpdates() .executionId(processInstance.getId()) .activityInstanceId(startActivityInstance.getId()); List<HistoricDetail> historicDetails = query .sequenceCounter(1) .list(); VariableMap variables = new VariableMapImpl(); for (HistoricDetail detail : historicDetails) { HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate) detail; variables.putValueTyped(variableUpdate.getVariableName(), variableUpdate.getTypedValue()); } return variables; }
@Override public Void execute(CommandContext commandContext) { monitor.sync(); List<Job> historyCleanupJobs = commandContext.getProcessEngineConfiguration().getHistoryService().findHistoryCleanupJobs(); for (Job job : historyCleanupJobs) { commandContext.getProcessEngineConfiguration().getManagementService().executeJob(job.getId()); } monitor.sync(); return null; } }
@Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); BatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers(); commandContext.disableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true); try { commandContext.getProcessEngineConfiguration() .getHistoryService() .deleteHistoricDecisionInstancesBulk(batchConfiguration.getIds()); } finally { commandContext.enableUserOperationLog(); commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions); } commandContext.getByteArrayManager().delete(configurationEntity); }
public Void execute(CommandContext commandContext) { timerEntity.delete(); commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(timerEntity.getId()); List<HistoricIncident> historicIncidents = Context .getProcessEngineConfiguration() .getHistoryService() .createHistoricIncidentQuery() .list(); for (HistoricIncident historicIncident : historicIncidents) { commandContext .getDbEntityManager() .delete((DbEntity) historicIncident); } return null; } });