public boolean isHistoryLevelAtLeast(HistoryLevel level) { if (logger.isDebugEnabled()) { logger.debug("Current history level: {}, level required: {}", historyLevel, level); } // Comparing enums actually compares the location of values declared in the enum return historyLevel.isAtLeast(level); }
@Override public boolean isHistoryLevelAtLeast(HistoryLevel level) { if (logger.isDebugEnabled()) { logger.debug("Current history level: {}, level required: {}", historyLevel, level); } // Comparing enums actually compares the location of values declared in the enum return historyLevel.isAtLeast(level); }
@Override public boolean isHistoryLevelAtLeast(HistoryLevel level) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Current history level: {}, level required: {}", historyLevel, level); } // Comparing enums actually compares the location of values declared in the enum return historyLevel.isAtLeast(level); }
@Override public void recordVariableUpdate(VariableInstanceEntity variableInstanceEntity) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { CommandContextUtil.getHistoricVariableService().recordVariableUpdate(variableInstanceEntity); } }
@Override public void recordVariableRemoved(VariableInstanceEntity variableInstanceEntity) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { CommandContextUtil.getHistoricVariableService().recordVariableRemoved(variableInstanceEntity); } }
@Override public void recordTaskInfoChange(TaskEntity taskEntity) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { CommandContextUtil.getHistoricTaskService().recordTaskInfoChange(taskEntity); } }
@Override public void recordVariableCreate(VariableInstanceEntity variable) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { CommandContextUtil.getHistoricVariableService().createAndInsert(variable); } }
@Override public void recordTaskCreated(TaskEntity task) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { CommandContextUtil.getHistoricTaskService().recordTaskCreated(task); } }
@Override public void recordVariableUpdate(VariableInstanceEntity variable) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { Map<String, String> data = new HashMap<>(); addCommonVariableFields(variable, data); getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), CmmnAsyncHistoryConstants.TYPE_VARIABLE_UPDATED, data); } }
protected void changeProcessDefinitionReferenceOfHistory(ProcessInstance processInstance, ProcessDefinition processDefinition, CommandContext commandContext) { HistoryLevel currentHistoryLevel = CommandContextUtil.getProcessEngineConfiguration(commandContext).getHistoryLevel(); if (currentHistoryLevel.isAtLeast(HistoryLevel.ACTIVITY)) { HistoryManager historyManager = CommandContextUtil.getHistoryManager(commandContext); historyManager.updateProcessDefinitionIdInHistory((ProcessDefinitionEntity) processDefinition, (ExecutionEntity) processInstance); } }
public static boolean isHistoryLevelAtLeast(HistoryLevel historyLevel, ProcessEngineConfigurationImpl processEngineConfiguration, long time) { if (processEngineConfiguration.getHistoryLevel().isAtLeast(historyLevel)) { // When using async history, we need to process all the historic jobs first before the history can be checked if (processEngineConfiguration.isAsyncHistoryEnabled()) { waitForJobExecutorToProcessAllHistoryJobs(processEngineConfiguration, processEngineConfiguration.getManagementService(), time, 200); } return true; } return false; }
@Override public void recordCaseInstanceStart(CaseInstanceEntity caseInstanceEntity) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) { Map<String, String> data = new HashMap<>(); addCommonCaseInstanceFields(caseInstanceEntity, data); getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), CmmnAsyncHistoryConstants.TYPE_CASE_INSTANCE_START, data, caseInstanceEntity.getTenantId()); } }
@Override public void recordTaskInfoChange(TaskEntity task) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { Map<String, String> data = new HashMap<>(); addCommonTaskFields(task, data); getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), CmmnAsyncHistoryConstants.TYPE_TASK_UPDATED, data, task.getTenantId()); } }
@Override public void recordPlanItemInstanceCreated(PlanItemInstanceEntity planItemInstanceEntity) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) { Map<String, String> data = new HashMap<>(); addCommonPlanItemInstanceFields(planItemInstanceEntity, data); getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), CmmnAsyncHistoryConstants.TYPE_PLAN_ITEM_INSTANCE_CREATED, data, planItemInstanceEntity.getTenantId()); } }
@Override public void recordUpdateCaseInstanceName(CaseInstanceEntity caseInstanceEntity, String name) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) { HistoricCaseInstanceEntityManager historicCaseInstanceEntityManager = cmmnEngineConfiguration.getHistoricCaseInstanceEntityManager(); HistoricCaseInstanceEntity historicCaseInstanceEntity = historicCaseInstanceEntityManager.findById(caseInstanceEntity.getId()); if (historicCaseInstanceEntity != null) { historicCaseInstanceEntity.setName(name); } } }
@Override public void recordVariableCreate(VariableInstanceEntity variable) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { Map<String, String> data = new HashMap<>(); putIfNotNull(data, CmmnAsyncHistoryConstants.FIELD_CREATE_TIME, cmmnEngineConfiguration.getClock().getCurrentTime()); addCommonVariableFields(variable, data); getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), CmmnAsyncHistoryConstants.TYPE_VARIABLE_CREATED, data); } }
protected void updatePlanItemInstanceTimeStamp(PlanItemInstanceEntity planItemInstanceEntity, Date time, String type, String...fields) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) { Map<String, String> data = new HashMap<>(); addCommonPlanItemInstanceFields(planItemInstanceEntity, data); putIfNotNull(data, CmmnAsyncHistoryConstants.FIELD_LAST_UPDATE_TIME, time); for (String field : fields) { putIfNotNull(data, field, time); } getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), type, data, planItemInstanceEntity.getTenantId()); } }
@Override public void recordTaskEnd(TaskEntity task, String deleteReason) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { Map<String, String> data = new HashMap<>(); addCommonTaskFields(task, data); putIfNotNull(data, CmmnAsyncHistoryConstants.FIELD_DELETE_REASON, deleteReason); putIfNotNull(data, CmmnAsyncHistoryConstants.FIELD_END_TIME, cmmnEngineConfiguration.getClock().getCurrentTime()); getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), CmmnAsyncHistoryConstants.TYPE_TASK_REMOVED, data, task.getTenantId()); } }
@Override public void recordUpdateCaseInstanceName(CaseInstanceEntity caseInstanceEntity, String name) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) { Map<String, String> data = new HashMap<>(); putIfNotNull(data, CmmnAsyncHistoryConstants.FIELD_ID, caseInstanceEntity.getId()); putIfNotNull(data, CmmnAsyncHistoryConstants.FIELD_NAME, caseInstanceEntity.getName()); putIfNotNull(data, CmmnAsyncHistoryConstants.FIELD_REVISION, caseInstanceEntity.getRevision()); getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), CmmnAsyncHistoryConstants.TYPE_UPDATE_CASE_INSTANCE_NAME, data, caseInstanceEntity.getTenantId()); } }
@Override public void recordCaseInstanceEnd(CaseInstanceEntity caseInstanceEntity, String state) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) { HistoricCaseInstanceEntityManager historicCaseInstanceEntityManager = cmmnEngineConfiguration.getHistoricCaseInstanceEntityManager(); HistoricCaseInstanceEntity historicCaseInstanceEntity = historicCaseInstanceEntityManager.findById(caseInstanceEntity.getId()); if (historicCaseInstanceEntity != null) { historicCaseInstanceEntity.setEndTime(cmmnEngineConfiguration.getClock().getCurrentTime()); historicCaseInstanceEntity.setState(state); } } }