@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()); } }
/** * 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; } }
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); }
protected HistoryLevel getProcessDefinitionHistoryLevel(String processDefinitionId) { HistoryLevel processDefinitionHistoryLevel = null; try { ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId); BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId); Process process = bpmnModel.getProcessById(processDefinition.getKey()); if (process.getExtensionElements().containsKey("historyLevel")) { ExtensionElement historyLevelElement = process.getExtensionElements().get("historyLevel").iterator().next(); String historyLevelValue = historyLevelElement.getElementText(); if (StringUtils.isNotEmpty(historyLevelValue)) { try { processDefinitionHistoryLevel = HistoryLevel.getHistoryLevelForKey(historyLevelValue); } catch (Exception e) {} } } if (processDefinitionHistoryLevel == null) { processDefinitionHistoryLevel = this.historyLevel; } } catch (Exception e) {} return processDefinitionHistoryLevel; }
@Override public boolean isHistoryLevelAtLeast(HistoryLevel level, String processDefinitionId) { if (enableProcessDefinitionHistoryLevel && processDefinitionId != null) { HistoryLevel processDefinitionLevel = getProcessDefinitionHistoryLevel(processDefinitionId); if (processDefinitionLevel != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Current history level: {}, level required: {}", processDefinitionLevel, level); } return processDefinitionLevel.isAtLeast(level); } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Current history level: {}, level required: {}", historyLevel, level); } return historyLevel.isAtLeast(level); } } else { 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); } }
if (StringUtils.isNotEmpty(historyLevelValue)) { try { historyLevel = HistoryLevel.getHistoryLevelForKey(historyLevelValue);
@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); } }
@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); } }