Skip to content

Commit

Permalink
Switching the fix in getPersistentState() to do a getValue() in the l…
Browse files Browse the repository at this point in the history
…og query itself (similar to how it's done in the HistoricVariableInstanceQueryImpl). Otherwise all serializeable variables will be eagerly fetched by default
  • Loading branch information
jbarrez committed Jan 6, 2016
1 parent a8051ac commit 371fe19
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ public ProcessInstanceHistoryLog execute(CommandContext commandContext) {
List<HistoricVariableInstance> variables = commandContext.getHistoricVariableInstanceEntityManager()
.findHistoricVariableInstancesByQueryCriteria(
new HistoricVariableInstanceQueryImpl(commandExecutor).processInstanceId(processInstanceId), null);

// Make sure all variables values are fetched (similar to the HistoricVariableInstance query)
for (HistoricVariableInstance historicVariableInstance : variables) {
historicVariableInstance.getValue();
}

processInstanceHistoryLog.addHistoricData(variables);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ public Object getPersistentState() {
persistentState.put("textValue2", textValue2);
persistentState.put("doubleValue", doubleValue);
persistentState.put("longValue", longValue);
if(byteArrayRef.getId() != null){
persistentState.put("byteArrayRef", byteArrayRef.getId());
persistentState.put("cachedValue", this.getValue());
}
persistentState.put("byteArrayRef", byteArrayRef.getId());
persistentState.put("createTime", createTime);
persistentState.put("lastUpdatedTime", lastUpdatedTime);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ protected void tearDown() throws Exception {

public void testIncludeVariables() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) {

HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processInstanceId).variableName("var").singleResult();
assertEquals(historicVariableInstance.getValue(), LARGE_STRING_VALUE);

ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId)
.includeVariables()
.singleResult();
Expand Down

0 comments on commit 371fe19

Please sign in to comment.