diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java index 3ca2ce751..67719224b 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java @@ -106,20 +106,7 @@ public void startElement(String uri, String localName, String qName, Attributes } - // bpmn2:collaboration - // ignore collaboration - - if (qName.equalsIgnoreCase("bpmn2:collaboration") && 1 == 2) { - if (bDefinitions && currentEntity != null) { - definition = currentEntity; - currentWorkflowGroup = attributes.getValue("name"); - if (currentWorkflowGroup == null || currentWorkflowGroup.isEmpty()) { - logger.warning("No process name defined!"); - currentWorkflowGroup = "Default"; - } - bDefinitions = false; - } - } + // bpmn2:process - parse workflowGroup if (qName.equalsIgnoreCase("bpmn2:process")) { @@ -210,12 +197,14 @@ public void startElement(String uri, String localName, String qName, Attributes } // bpmn2:messageFlow - cache all messageFlow... + /* if (qName.equalsIgnoreCase("bpmn2:messageFlow")) { bpmnID = attributes.getValue("id"); String source = attributes.getValue("sourceRef"); String target = attributes.getValue("targetRef"); sequenceCache.put(bpmnID, new SequenceFlow(source, target)); } + */ /* * parse a imixs:item diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserCollaboration.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserCollaboration.java index 9c9ce828a..6d071b2d1 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserCollaboration.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserCollaboration.java @@ -89,10 +89,10 @@ public void testSimple() throws ParseException, ParserConfigurationException, SA ItemCollection activity = model.getEvent(1000, 10); Assert.assertNotNull(activity); Assert.assertEquals("submit", activity.getItemValueString("txtname")); - Assert.assertEquals(1100, activity.getItemValueInteger("numNextProcessID")); + Assert.assertEquals(2000, activity.getItemValueInteger("numNextProcessID")); // test task 1100 - task = model.getTask(1100); + task = model.getTask(2000); Assert.assertNotNull(task); Assert.assertEquals("1.0.0", task.getItemValueString("$ModelVersion")); Assert.assertEquals("WorkflowGroup2", task.getItemValueString("txtworkflowgroup")); diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserCollaborationMessageFlow.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserCollaborationMessageFlow.java new file mode 100644 index 000000000..54cc625ca --- /dev/null +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserCollaborationMessageFlow.java @@ -0,0 +1,133 @@ +package org.imixs.workflow.bpmn; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.text.ParseException; +import java.util.Collection; + +import javax.xml.parsers.ParserConfigurationException; + +import org.imixs.workflow.ItemCollection; +import org.imixs.workflow.Model; +import org.imixs.workflow.exceptions.ModelException; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.xml.sax.SAXException; + +import junit.framework.Assert; + +/** + * Test class test the Imixs BPMNParser + * + * Special cases with collaboration diagrams + * + * @author rsoika + */ +public class TestBPMNParserCollaborationMessageFlow { + + @Before + public void setup() { + + } + + @After + public void teardown() { + + } + + // @Ignore + @Test + public void testSimple() + throws ParseException, ParserConfigurationException, SAXException, IOException, ModelException { + + String VERSION = "1.0.0"; + + InputStream inputStream = getClass().getResourceAsStream("/bpmn/collaboration_messageflow.bpmn"); + + Model model = null; + try { + model = BPMNParser.parseModel(inputStream, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + Assert.fail(); + } catch (ModelException e) { + e.printStackTrace(); + Assert.fail(); + } + Assert.assertNotNull(model); + + // test count of elements + Assert.assertEquals(2, model.findAllTasks().size()); + + // test task 1000 + ItemCollection task = model.getTask(1000); + Assert.assertNotNull(task); + Assert.assertEquals(VERSION, task.getItemValueString("$ModelVersion")); + Assert.assertEquals("WorkflowGroup1", task.getItemValueString("txtworkflowgroup")); + + // test event for task 1000 + Collection activities = model.findAllEventsByTask(1000); + Assert.assertNotNull(activities); + Assert.assertEquals(1, activities.size()); + + // test activity 1000.10 submit + ItemCollection activity = model.getEvent(1000, 10); + Assert.assertNotNull(activity); + Assert.assertEquals("submit", activity.getItemValueString("txtname")); + Assert.assertEquals(1000, activity.getItemValueInteger("numNextProcessID")); + + } + + @Test + public void testComplex() + throws ParseException, ParserConfigurationException, SAXException, IOException, ModelException { + + String VERSION = "1.0.0"; + + InputStream inputStream = getClass().getResourceAsStream("/bpmn/collaboration_messageflow_complex.bpmn"); + + Model model = null; + try { + model = BPMNParser.parseModel(inputStream, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + Assert.fail(); + } catch (ModelException e) { + e.printStackTrace(); + Assert.fail(); + } + Assert.assertNotNull(model); + + // test task 1000 + ItemCollection task = model.getTask(1000); + Assert.assertNotNull(task); + Assert.assertEquals(VERSION, task.getItemValueString("$ModelVersion")); + Assert.assertEquals("Sales", task.getItemValueString("txtworkflowgroup")); + + // test event for task 1000 + Collection activities = model.findAllEventsByTask(1000); + Assert.assertNotNull(activities); + Assert.assertEquals(2, activities.size()); + + // test activity 1000.10 submit + ItemCollection activity = model.getEvent(1000, 20); + Assert.assertNotNull(activity); + Assert.assertEquals("submit", activity.getItemValueString("txtname")); + Assert.assertEquals(1010, activity.getItemValueInteger("numNextProcessID")); + + // test task 2000 + task = model.getTask(2000); + Assert.assertNotNull(task); + Assert.assertEquals(VERSION, task.getItemValueString("$ModelVersion")); + Assert.assertEquals("Order", task.getItemValueString("txtworkflowgroup")); + + // test event for task 2000 + activities = model.findAllEventsByTask(2000); + Assert.assertNotNull(activities); + Assert.assertEquals(3, activities.size()); + + } + +} diff --git a/imixs-workflow-core/src/test/resources/bpmn/collaboration.bpmn b/imixs-workflow-core/src/test/resources/bpmn/collaboration.bpmn index 17c8be9b2..4ce3c8afd 100644 --- a/imixs-workflow-core/src/test/resources/bpmn/collaboration.bpmn +++ b/imixs-workflow-core/src/test/resources/bpmn/collaboration.bpmn @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + @@ -26,9 +26,15 @@ - SequenceFlow_6 + SequenceFlow_2 - + + + SequenceFlow_6 + SequenceFlow_2 + + + @@ -37,12 +43,18 @@ SequenceFlow_4 - + SequenceFlow_3 + SequenceFlow_7 SequenceFlow_4 + + SequenceFlow_7 + + + @@ -53,9 +65,9 @@ - + - + @@ -67,13 +79,13 @@ - + - + @@ -89,9 +101,9 @@ - + - + @@ -100,6 +112,18 @@ + + + + + + + + + + + + @@ -120,22 +144,33 @@ - - + + - - - - - - + + + + + - - - + + + - + + + + + + + + + + + + + diff --git a/imixs-workflow-core/src/test/resources/bpmn/collaboration_messageflow.bpmn b/imixs-workflow-core/src/test/resources/bpmn/collaboration_messageflow.bpmn new file mode 100644 index 000000000..b2bec6c31 --- /dev/null +++ b/imixs-workflow-core/src/test/resources/bpmn/collaboration_messageflow.bpmn @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + Submit Event should not connext task 2 but should still remain in task 1 + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + + + + SequenceFlow_2 + + + + + + + SequenceFlow_3 + + + SequenceFlow_4 + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/imixs-workflow-core/src/test/resources/bpmn/collaboration_messageflow_complex.bpmn b/imixs-workflow-core/src/test/resources/bpmn/collaboration_messageflow_complex.bpmn new file mode 100644 index 000000000..f7798b8ba --- /dev/null +++ b/imixs-workflow-core/src/test/resources/bpmn/collaboration_messageflow_complex.bpmn @@ -0,0 +1,791 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_34 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + namcurrenteditor.]]> + + + false + + + + SequenceFlow_15 + + + + + + + + _description]]> + + + + + + + + + numsequenceNumber]]> + + + true + + + + + + + + + + + + Faktura +
    +
  1. Kundendaten lt. Auftrag kontrollieren
  2. +
  3. Neue Rechnung anlegen (Handel)
  4. +
  5. Fahrzeugdaten anhand Einkaufsrechnung eintragen
  6. +
  7. Preis lt. Kaufvertrag (Achtung: 19%, EU oder Differenzbesteuert)
  8. +
  9. Ausdrucke: 1x Akte, 1x Buchhaltung und 1x Kunde
  10. +
+]]>
+ SequenceFlow_15 + SequenceFlow_16 + SequenceFlow_37 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + home + + verkaufsabwicklung-1.0.0 + 2000 + 5 + txtprocessref +]]> + + + + + + + + + namcurrenteditor ]]> + + + false + + + + + + + SequenceFlow_17 + SequenceFlow_16 + + + + + + + + _description]]> + + + + + + + + + numsequenceNumber]]> + + + true + + + + + + + + + + + + + + + Verkaufsabwicklung +

Der Workflow 'Verkauf' wird nach Abschluss des Kaufvertrages gestartet.

+ +

    + +
  • Fügen Sie den Kaufvertrag über den Abschnitt 'Dokumente' an den Vorgang an.
  • + +
  • Leiten Sie den Vorgang an die Disposition weiter
  • + +
]]>
+ SequenceFlow_18 + SequenceFlow_34 + SequenceFlow_17 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + namcurrenteditor.]]> + + + false + + + + SequenceFlow_18 + + + + + + + + SequenceFlow_37 + + +
+ + + SequenceFlow_6 + + + + + home]]> + + + namcurrenteditor ]]> + + + SequenceFlow_2 + SequenceFlow_7 + + + + + + + + _description]]> + + + + + + + + + numsequenceNumber]]> + + + true + + + + + + + + + + + + + + Werkstattkarte schreiben +
    +
  1. Auftrag im Kfz-Win anlegen
  2. +
  3. Arbeiten lt. Kaufvertrag eintragen
  4. +
  5. Ausdruck der Werkstattkarte
  6. +
  7. Übergabe an den Werkstattleiter
  8. +
+]]>
+ SequenceFlow_4 + SequenceFlow_6 + SequenceFlow_30 + SequenceFlow_2 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + namcurrenteditor.]]> + + + false + + + + SequenceFlow_4 + + + + + + + + true + + + + + + + + + + + + + + + _subject (numsequenceNumber)]]> + + + + + + Internen Auftrag durchführen +
    +
  1. Öffnen Sie die anhängende Werkstattkarte
  2. +
  3. Führen Sie die Arbeiten lt. Auftrag durch
  4. +
  5. Leiten Sie den Vorgang nach Abschluss der Arbeiten an die Endkontrolle weiter
  6. +
  7. Übergabe an den Werkstattleiter
  8. +
+]]>
+ SequenceFlow_7 + SequenceFlow_38 +
+ + + SequenceFlow_38 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + namcurrenteditor.]]> + + + false + + + + SequenceFlow_30 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file