flowable / flowable/flowable-engine

"Full" history level for variable changes doesn't implemented in CMMN

Open
#4,201 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
7h 8m
Merged PRs (30d)
2

Description

**Describe the bug**
The [document of CMMN History Level](https://documentation.flowable.com/latest/develop/be/history-level#cmmn) describes when History Level = Full, the changes of variables will be stored.

Image

But it is not implemented yet.

**Expected behavior**
If I changed variables in the runtime, the change history should be stored and can be retrieved from `act_hi_varinst` and `act_hi_detail` tables

**Code**

The BPMN engine (org.flowable.engine.impl.history.DefaultHistoryManager.java) has a method recordHistoricDetailVariableCreate that checks isHistoryLevelAtLeast(HistoryLevel.FULL) and creates a HistoricDetailVariableInstanceUpdateEntity — a separate row for every variable change. This is what powers the history/historic-detail REST endpoint with detailType: "variableUpdate" and revision numbers. So the how history stored.

```
@Override
public void recordHistoricDetailVariableCreate(VariableInstanceEntity variable, ExecutionEntity sourceActivityExecution, boolean useActivityId,
String activityInstanceId, Date createTime) {
String processDefinitionId = getProcessDefinitionId(variable, sourceActivityExecution);

if (getHistoryConfigurationSettings().isHistoryEnabledForVariableInstance(processDefinitionId, variable)
&& isHistoryLevelAtLeast(HistoryLevel.FULL, processDefinitionId)) {

HistoricDetailVariableInstanceUpdateEntity historicVariableUpdate = getHistoricDetailEntityManager().copyAndInsertHistoricDetailVariableInstanceUpdateEntity(variable, createTime);

if (StringUtils.isNotEmpty(activityInstanceId)) {
historicVariableUpdate.setActivityInstanceId(activityInstanceId);
} else {
if (useActivityId && sourceActivityExecution != null) {
HistoricActivityInstanceEntity historicActivityInstance = findHistoricActivityInstance(sourceActivityExecution, false);
if (historicActivityInstance != null) {
historicVariableUpdate.setActivityInstanceId(historicActivityInstance.getId());
}
}
}
}
}
```

The CMMN engine (DefaultCmmnHistoryManager.java) has none of this:

- Zero references to HistoryLevel.FULL anywhere in the file
- Zero references to "detail" or HistoricDetail entities
- No recordHistoricDetailVariableCreate method
- The CmmnHistoryManager interface doesn't even define such a method

**Additional context**
flowable-engine 8.0.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.