From 5a72e7951196ce255d5c631438a033719eeeb515 Mon Sep 17 00:00:00 2001 From: psavidis <69160690+psavidis@users.noreply.github.com> Date: Wed, 19 Jun 2024 18:23:11 +0300 Subject: [PATCH] Apply suggestions from code review Co-authored-by: yanavasileva --- .../persistence/entity/VariableInstanceEntity.java | 14 +++++++++----- .../test/api/runtime/VariableInstanceTest.java | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/VariableInstanceEntity.java b/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/VariableInstanceEntity.java index bec0bf6dae4..2188e75e1f2 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/VariableInstanceEntity.java +++ b/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/VariableInstanceEntity.java @@ -17,7 +17,11 @@ package org.camunda.bpm.engine.impl.persistence.entity; import java.io.Serializable; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.concurrent.Callable; import org.camunda.bpm.application.InvocationContext; @@ -154,7 +158,7 @@ public void delete() { } // clear value - clearValueFieldsBasedOnType(true); + clearValueFields(true); if (!isTransient) { // delete variable @@ -283,13 +287,13 @@ public void setValue(TypedValue newValue) { public void clearValueFieldsBasedOnType(TypedValue newValue) { if (variableWillChangeType(newValue)) { - clearValueFieldsBasedOnType(true); + clearValueFields(true); } else { - clearValueFieldsBasedOnType(false); + clearValueFields(false); } } - public void clearValueFieldsBasedOnType(boolean deleteVariable) { + public void clearValueFields(boolean deleteVariable) { this.longValue = null; this.doubleValue = null; this.textValue = null; diff --git a/engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/VariableInstanceTest.java b/engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/VariableInstanceTest.java index a93db326b11..ba5d128d086 100644 --- a/engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/VariableInstanceTest.java +++ b/engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/VariableInstanceTest.java @@ -153,8 +153,7 @@ private ProcessInstance startProcessInstanceWithVariable(String processDefinitio VariableMap variables = Variables.createVariables() .putValue(variableName, variableValue); - String businessKey = processDefinitionKey; // for simplicity’s sake, same businessKey with processDefinitionKey - return runtimeService.startProcessInstanceByKey(processDefinitionKey, businessKey, variables); + return runtimeService.startProcessInstanceByKey(processDefinitionKey, variables); } private ProcessInstance startProcessInstanceWithObjectVariable(String processDefinitionKey, String variableName, Object variableValue) {