flowable / flowable/flowable-engine

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

Offen
#4,201 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
9.5k
Forks
2.9k
Ø Merge
7 Std. 8 Min.
Gemergte PRs (30 T.)
2

Beschreibung

**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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit DefaultCmmnHistoryManager.java und dem CmmnHistoryManager-Interface und vergleiche anschließend deren Handhabung der Variablenhistorie mit DefaultHistoryManager.java in der BPMN-Engine. Verfolge die vorhandenen CMMN-Entitäten für die Variablenhistorie und die Persistenz-Mappings und überprüfe, dass der FULL-Verlauf Variablenänderungen in act_hi_varinst und act_hi_detail aufzeichnet und sie über den relevanten History-Endpunkt abrufbar macht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
backend, databases
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.