diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/MigrateImixsModelToBPMN.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/MigrateImixsModelToBPMN.java
deleted file mode 100644
index 206416304..000000000
--- a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/MigrateImixsModelToBPMN.java
+++ /dev/null
@@ -1,595 +0,0 @@
-package org.imixs.workflow.bpmn;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import jakarta.xml.bind.JAXBException;
-import java.util.logging.Level;
-
-import org.imixs.workflow.ItemCollection;
-import org.imixs.workflow.xml.XMLDataCollectionAdapter;
-
-/**
- * This utility class can be used to convert a old .ixm model into a new imixs
- * bpmn file. The migration tool separates each workflow group into a single
- * bpmn file.
- *
- * Arguments:
- *
- *
- * # Note: leading slash
- * /modelfile.ixm
- *
- *
- * @author rsoika
- *
- */
-public class MigrateImixsModelToBPMN {
-
- private static String sourceModelFile = null;
- private static List modelItemCollection = null;
- private static List sequenceFlows = null;
- private static ItemCollection startTask = null;
- private final static Logger logger = Logger
- .getLogger(MigrateImixsModelToBPMN.class.getName());
-
- public static void main(String[] args) {
- logger.info("Start migration of Imixs Model to BPMN....");
- sourceModelFile = args[0];
-
- readModel();
-
- buildBPMN();
- }
-
- private static void readModel() {
- logger.log(Level.INFO, "read Model file {0}...", sourceModelFile);
-
- try {
-
- modelItemCollection = XMLDataCollectionAdapter
- .readCollectionFromInputStream(MigrateImixsModelToBPMN.class
- .getClass().getResourceAsStream(sourceModelFile));
- logger.log(Level.INFO, "Model contains {0} elements", modelItemCollection.size());
- } catch (JAXBException e) {
- logger.log(Level.SEVERE, "Error reding model file {0}", e.getMessage());
- } catch (IOException e) {
- logger.log(Level.SEVERE, "Error reding model file {0}", e.getMessage());
- }
-
- }
-
- /**
- * This method builds a bpmn model form a model item collection
- */
- private static void buildBPMN() {
- ItemCollection profile = findProfile();
- if (profile != null) {
-
- List groups = findGroups();
- for (String group : groups) {
- logger.log(Level.INFO, "Profile migrate workflow group: {0}", group);
-
- // find model version
- List tasks = findProcessEntitiesByGroup(group);
- startTask = tasks.get(0);
- String sModelVersion = startTask
- .getItemValueString("$modelversion");
-
- sModelVersion = group.toLowerCase() + "-" + sModelVersion;
- logger.log(Level.INFO, " - $modelversion={0}", sModelVersion);
-
- // now create a new bpmn file...
- PrintWriter writer;
- try {
- String sFileName = "target/" + sModelVersion + ".bpmn";
- writer = new PrintWriter(sFileName, "UTF-8");
-
- writer.println("");
- writer.println("");
-
- // write profile
- writer.println("");
- writer.println(" ");
- writer.println(" ");
- writer.println(" ");
-
- writeItem(writer, profile, "txtfieldmapping");
- writeItem(writer, profile, "txttimefieldmapping");
- writeItem(writer, profile, "txtplugins");
-
- writer.println("");
-
- // write process
- writer.println(" ");
-
- // create start event
- writer.println("");
- writer.println("SequenceFlow_0");
- writer.println("");
- writer.println("");
-
- // first we analyze all existing sequence flows
- // and build a map of sequence flows. Each activity has two
- // flow elements
- sequenceFlows = new ArrayList();
- List followUpIds = new ArrayList();
- List activities = findActivityEntitiesByGroup(group);
- int flowCount = 1;
- for (ItemCollection activity : activities) {
- boolean isFollowUp = "1".equals(activity
- .getItemValueString("keyfollowup"));
-
- int processID = activity
- .getItemValueInteger("numprocessid");
- int activityID = activity
- .getItemValueInteger("numactivityid");
- int nextprocessID = activity
- .getItemValueInteger("numnextprocessid");
-
- // test if follow up.....
-
- logger.log(Level.FINE, "TEST Followup {0}_{1}", new Object[]{processID, activityID});
- if (!followUpIds.contains(processID + "_" + activityID)) {
- // outgoing...
- String from = "Task_" + processID;
- String to = "IntermediateCatchEvent_" + processID
- + "-" + activityID;
- String id = "SequenceFlow_" + flowCount;
- sequenceFlows.add(new SequenceFlow(from, to, id));
- // print
- writer.println(" ");
- flowCount++;
- }
- // incomming only if not the same process and not
- // followup!
-
- if (processID != nextprocessID || isFollowUp) {
-
- if (isFollowUp) {
- int nextID = activity
- .getItemValueInteger("numnextid");
- // followup sequence flow
- // normal sequence flow
- String from = "IntermediateCatchEvent_"
- + processID + "-" + activityID;
- String to = "IntermediateCatchEvent_"
- + processID + "-" + nextID;
- String id = "SequenceFlow_" + flowCount;
- sequenceFlows
- .add(new SequenceFlow(from, to, id));
- // print
- writer.println(" ");
-
- followUpIds.add(processID + "_" + nextID);
- logger.log(Level.FINE, "ADD follow up {0}_{1}", new Object[]{processID, nextID});
- flowCount++;
-
- } else {
- // normal sequence flow
- String from = "IntermediateCatchEvent_"
- + processID + "-" + activityID;
- String to = "Task_" + nextprocessID;
- String id = "SequenceFlow_" + flowCount;
- sequenceFlows
- .add(new SequenceFlow(from, to, id));
- // print
- writer.println(" ");
- flowCount++;
- }
- }
-
- }
-
- // write tasks.....
- tasks = findProcessEntitiesByGroup(group);
- for (ItemCollection task : tasks) {
- writeTask(writer, task);
- }
-
- // write events.....
- List events = findActivityEntitiesByGroup(group);
- for (ItemCollection event : events) {
- writeEvent(writer, event);
- }
-
- writer.println("");
- writer.println("");
- writer.close();
- } catch (FileNotFoundException | UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
-
- } else {
- logger.info("No Profile found");
- }
-
- }
-
- /**
- * Writes a singel item into the file
- *
- *
- *
-
-
- *
- */
- private static void writeItem(PrintWriter writer, ItemCollection entity,
- String fieldName) {
- List> item = entity.getItemValue(fieldName);
- if (item.size() > 0) {
- // test type
- Object otest = item.get(0);
- String type = "";
- if (otest instanceof Integer)
- type = "xs:int";
- else if (otest instanceof Boolean)
- type = "xs:boolean";
- else
- type = "xs:string";
-
- if (!"txtname".equals( fieldName.toLowerCase())) {
- writer.println(" ");
- for (Object o : item) {
- writer.println(" ");
- }
- writer.println(" ");
- }
-
-
- }
- }
-
- /**
- * Writes a task element...a singel item into the file
- *
- *
- *
- SequenceFlow_2
- SequenceFlow_3
-
-
-
-
-
-
-
- *
- */
- private static void writeTask(PrintWriter writer, ItemCollection task) {
- int processID = task.getItemValueInteger("numprocessid");
- String taskID = "Task_" + processID;
-
- writer.println(" ");
-
- // now write all elements .....
-
- writer.println(" ");
- Set keys = task.getAllItems().keySet();
- for (String key : keys) {
- // skip some fields
- if ("numprocessid".equals(key))
- continue;
- if ("$modelversion".equals(key))
- continue;
- if ("$uniqueid".equals(key))
- continue;
- if ("txtworkflowgroup".equals(key))
- continue;
- if ("type".equals(key))
- continue;
- if ("rtfdescription".equals(key))
- continue;
-
- writeItem(writer, task, key);
-
- }
-
- writer.println(" ");
-
- // write rtfdescription
- if (task.hasItem("rtfdescription")) {
- writer.println(" "
- + encodeString(task.getItemValueString("rtfdescription"))
- + "");
- }
- // finally we need to construct all incomming and outgoing
- // sequenceflows....
- for (SequenceFlow flow : sequenceFlows) {
- // incomming flow?
- String sid = "Task_" + processID;
- if (sid.equals(flow.to)) {
- writer.println(" " + flow.id
- + "");
- }
- if (sid.equals(flow.from)) {
- writer.println(" " + flow.id
- + "");
- }
- }
-
- // if start Task connect start event....
- if (startTask.getItemValueInteger("numProcessid")== task.getItemValueInteger("numProcessID")) {
- writer.println("SequenceFlow_0");
- }
-
- writer.println(" ");
-
- }
-
- /**
- * Writes a task element...a singel item into the file
- *
- *
- *
-
-
- true
-
-
-
-
-
-
- <b>Submitt</b> new ticket
- SequenceFlow_11
- SequenceFlow_3
-
- *
- */
- private static void writeEvent(PrintWriter writer, ItemCollection activity) {
- int processID = activity.getItemValueInteger("numprocessid");
- int activityID = activity.getItemValueInteger("numactivityid");
- String eventID = "IntermediateCatchEvent_" + processID + "-"
- + activityID;
-
- writer.println(" ");
-
- // now write all elements .....
-
- writer.println(" ");
- Set keys = activity.getAllItems().keySet();
- for (String key : keys) {
- // skip some fields
- if ("numprocessid".equals(key))
- continue;
- if ("numactivityid".equals(key))
- continue;
- if ("numnextprocessid".equals(key))
- continue;
- if ("$modelversion".equals(key))
- continue;
- if ("$uniqueid".equals(key))
- continue;
- if ("txtworkflowgroup".equals(key))
- continue;
- if ("type".equals(key))
- continue;
- if ("rtfdescription".equals(key))
- continue;
-
- writeItem(writer, activity, key);
-
- }
-
-
- // migrate update mode
- if (isACLUpdateMode(activity)) {
- writer.println(" ");
- writer.println(" true");
- writer.println("");
- }
-
- writer.println(" ");
-
- // write rtfdescription
- if (activity.hasItem("rtfdescription")) {
- writer.println(" "
- + encodeString(activity
- .getItemValueString("rtfdescription"))
- + "");
- }
-
- // finally we need to construct all incomming and outgoing
- // sequenceflows....
- for (SequenceFlow flow : sequenceFlows) {
- // incomming flow?
- String sid = "IntermediateCatchEvent_" + processID + "-"
- + activityID;
- if (sid.equals(flow.to)) {
- writer.println(" " + flow.id
- + "");
- }
- if (sid.equals(flow.from)) {
- writer.println(" " + flow.id
- + "");
- }
- }
-
- writer.println(" ");
-
- }
-
- private static ItemCollection findProfile() {
- for (ItemCollection entity : modelItemCollection) {
-
- if ("WorkflowEnvironmentEntity".equals(entity
- .getItemValueString("type"))
-
- && ("environment.profile").equals(entity
- .getItemValueString("txtName"))) {
- return entity;
- }
-
- }
- return null;
- }
-
- /**
- * returns a list with all group names
- *
- * @return
- */
- private static List findGroups() {
- List groups = new ArrayList();
- for (ItemCollection entity : modelItemCollection) {
-
- if ("ProcessEntity".equals(entity.getItemValueString("type"))) {
-
- String group = entity.getItemValueString("txtWorkflowGroup");
- if (!groups.contains(group)) {
- // logger.info(group);
- groups.add(group);
- }
-
- }
-
- }
- return groups;
- }
-
- /**
- * returns a list with all tasks
- *
- * @return
- */
- private static List findProcessEntitiesByGroup(String group) {
- List result = new ArrayList();
- for (ItemCollection entity : modelItemCollection) {
-
- if ("ProcessEntity".equals(entity.getItemValueString("type"))) {
-
- if (group.equals(entity.getItemValueString("txtWorkflowGroup"))) {
- result.add(entity);
- }
- }
-
- }
- return result;
- }
-
- /**
- * returns a specifiy process entity
- *
- * @param processid
- * @param group
- * @return
- */
- private static ItemCollection findProcessEntityById(int processid) {
- for (ItemCollection entity : modelItemCollection) {
-
- if ("ProcessEntity".equals(entity.getItemValueString("type"))) {
-
- if (processid == entity.getItemValueInteger("numprocessid")) {
- return entity;
- }
- }
-
- }
- return null;
- }
-
- /**
- * returns a list with all events
- *
- * @return
- */
- private static List findActivityEntitiesByGroup(String group) {
- List result = new ArrayList();
- for (ItemCollection entity : modelItemCollection) {
-
- if ("ActivityEntity".equals(entity.getItemValueString("type"))) {
-
- int processid = entity.getItemValueInteger("numprocessid");
-
- ItemCollection processEntity = findProcessEntityById(processid);
-
- if (group.equals(processEntity
- .getItemValueString("txtWorkflowGroup"))) {
- result.add(entity);
- }
- }
-
- }
-
- return result;
- }
-
- /**
- * replaces < with <
- *
- * @param text
- */
- private static String encodeString(String text) {
- text = text.replace("<", "<");
-
- text = text.replace(" & ", " & ");
-
- return text;
-
- }
-
-
- /**
- * Returns true if a old workflow model need to be evaluated
- *
- * @return
- */
- private static boolean isACLUpdateMode(ItemCollection entity) {
- if (entity.hasItem("keyownershipmode") && "0".equals(entity.getItemValueString("keyownershipmode"))) {
- return true;
- }
-
-
- if (entity.hasItem("keyaccessmode") && "0".equals(entity.getItemValueString("keyaccessmode"))) {
- return true;
- }
-
-
-
- return false;
-
- }
-}
-
-class SequenceFlow {
- protected String from;
- protected String to;
- protected String id;
-
- public SequenceFlow(String from, String to, String id) {
- this.from = from;
- this.to = to;
- this.id = id;
- }
-}