From 771ee0f82565c91df51007842c7053f023242bcd Mon Sep 17 00:00:00 2001 From: "joram.barrez" Date: Fri, 14 Jul 2023 11:10:03 +0200 Subject: [PATCH] Store a list of plan item definitions in the stage, consistent with how in a process the flow elements are stored --- .../main/java/org/flowable/cmmn/model/Stage.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/flowable-cmmn-model/src/main/java/org/flowable/cmmn/model/Stage.java b/modules/flowable-cmmn-model/src/main/java/org/flowable/cmmn/model/Stage.java index 1fc6bf0b1cf..a2095c7d653 100644 --- a/modules/flowable-cmmn-model/src/main/java/org/flowable/cmmn/model/Stage.java +++ b/modules/flowable-cmmn-model/src/main/java/org/flowable/cmmn/model/Stage.java @@ -17,6 +17,8 @@ import java.util.List; import java.util.Map; +import org.apache.commons.lang3.StringUtils; + /** * @author Joram Barrez */ @@ -31,10 +33,18 @@ public class Stage extends PlanFragment implements HasExitCriteria { protected String validateFormFields; protected Integer displayOrder; protected String includeInStageOverview; + protected List planItemDefinitionList = new ArrayList<>(); protected Map planItemDefinitionMap = new LinkedHashMap<>(); public void addPlanItemDefinition(PlanItemDefinition planItemDefinition) { - planItemDefinitionMap.put(planItemDefinition.getId(), planItemDefinition); + planItemDefinitionList.add(planItemDefinition); + addPlanItemDefinitionToMap(planItemDefinition); + } + + protected void addPlanItemDefinitionToMap(PlanItemDefinition planItemDefinition) { + if (planItemDefinition != null && StringUtils.isNotEmpty(planItemDefinition.getId())) { + planItemDefinitionMap.put(planItemDefinition.getId(), planItemDefinition); + } } public PlanItemDefinition findPlanItemDefinitionInStageOrUpwards(String planItemDefinitionId) { @@ -95,7 +105,7 @@ private void internalFindPlanItemDefinitionsOfTyp } public List getPlanItemDefinitions() { - return new ArrayList<>(planItemDefinitionMap.values()); + return planItemDefinitionList; } public Map getPlanItemDefinitionMap() {