/** * Checks if the given level is the same as, or higher in order than the level this method is executed on. */ public boolean isAtLeast(HistoryLevel level) { // Comparing enums actually compares the location of values declared in // the enum return this.compareTo(level) >= 0; } }
@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); }
public void initHistoryLevel() { if (historyLevel == null) { historyLevel = HistoryLevel.getHistoryLevelForKey(getHistory()); } }
protected void copyHistoryConfig(ProcessEngineConfigurationImpl flowable6Configuration, org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl flowable5Configuration) { flowable5Configuration.setHistoryLevel(HistoryLevel.getHistoryLevelForKey(flowable6Configuration.getHistoryLevel().getKey())); }
@Override public boolean isHistoryEnabled(String processDefinitionId) { if (enableProcessDefinitionHistoryLevel && processDefinitionId != null) { HistoryLevel processDefinitionLevel = getProcessDefinitionHistoryLevel(processDefinitionId); if (processDefinitionLevel != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Current history level: {}", processDefinitionLevel); } return !processDefinitionLevel.equals(HistoryLevel.NONE); } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Current history level: {}", historyLevel); } return !historyLevel.equals(HistoryLevel.NONE); } } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Current history level: {}", historyLevel); } return !historyLevel.equals(HistoryLevel.NONE); } }
/** * @param key * string representation of level * @return {@link HistoryLevel} for the given key * @throws FlowableException * when passed in key doesn't correspond to existing level */ public static HistoryLevel getHistoryLevelForKey(String key) { for (HistoryLevel level : values()) { if (level.key.equals(key)) { return level; } } throw new FlowableIllegalArgumentException("Illegal value for history-level: " + key); }
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); }
public void initHistoryLevel() { if (historyLevel == null) { historyLevel = HistoryLevel.getHistoryLevelForKey(getHistory()); } }
@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 recordTaskEnd(TaskEntity task, String deleteReason) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { CommandContextUtil.getHistoricTaskService().recordTaskEnd(task, deleteReason); } }
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; }
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); } }
@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); } }
@Override public void recordVariableRemoved(VariableInstanceEntity variable) { if (cmmnEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { Map<String, String> data = new HashMap<>(); addCommonVariableFields(variable, data); getAsyncHistorySession().addHistoricData(getJobServiceConfiguration(), CmmnAsyncHistoryConstants.TYPE_VARIABLE_REMOVED, data); } }
@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); } } }