From f7f55ee16aed752087f640e0866d806573b061e4 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Sat, 31 Aug 2024 22:34:07 +0200 Subject: [PATCH] changed interface type getVersions Issue #823 --- .../src/main/java/org/imixs/workflow/ModelManager.java | 9 +++++++++ .../org/imixs/workflow/bpmn/OpenBPMNModelManager.java | 9 +++++++-- .../java/org/imixs/workflow/engine/ModelService.java | 4 ++-- .../java/org/imixs/workflow/engine/SetupService.java | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/ModelManager.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/ModelManager.java index fe1736f89..00686543f 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/ModelManager.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/ModelManager.java @@ -28,6 +28,8 @@ package org.imixs.workflow; +import java.util.List; + import org.imixs.workflow.exceptions.ModelException; import org.openbpmn.bpmn.BPMNModel; @@ -66,6 +68,13 @@ public interface ModelManager { */ public BPMNModel getModel(String version) throws ModelException; + /** + * Returns a sorted String list of all stored model versions + * + * @return sorted string list of versions + */ + public List getVersions(); + /** * Returns a BPMNModel by a workItem. The workitem must at least provide the * item '$modelversion' or '$workflowgroup' to resolve the model. diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/OpenBPMNModelManager.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/OpenBPMNModelManager.java index 8b477b45e..19daf1442 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/OpenBPMNModelManager.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/OpenBPMNModelManager.java @@ -297,8 +297,13 @@ public ItemCollection nextModelElement(ItemCollection event, ItemCollection work * * @return */ - public Set getVersions() { - return modelStore.keySet(); + public List getVersions() { + Set versions = modelStore.keySet(); + // convert to List + List result = new ArrayList<>(); + result.addAll(versions); + Collections.sort(result); + return result; } /** diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ModelService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ModelService.java index 86708ced2..bf8abe049 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ModelService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ModelService.java @@ -250,9 +250,9 @@ public BPMNModel getModelByWorkitem(ItemCollection workitem) throws ModelExcepti * * @return */ - @SuppressWarnings("unchecked") + @Override public List getVersions() { - return (List) openBPMNModelManager.getVersions(); + return openBPMNModelManager.getVersions(); } /** diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SetupService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SetupService.java index 5ca9696ac..54c40559c 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SetupService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SetupService.java @@ -151,10 +151,10 @@ public void startup() { logger.info(" ____ _"); logger.info(" / _/_ _ (_)_ __ ___ Workflow"); logger.info(" _/ // ' \\/ /\\ \\ /(_-< Engine"); - logger.info("/___/_/_/_/_//_\\_\\/___/ V6.0"); + logger.info("/___/_/_/_/_//_\\_\\/___/ V6.1"); logger.info(""); - logger.info("...initalizing models..."); + logger.info("...initializing models..."); // first we scan for default models List models = modelService.getVersions();