The current model implementation is using a sax parser and a ModelHandler. This implementation is not stable. In complex model situations duplicate event ids can occur. This is not detected by the org.imixs.workflow.bpmn.BPMNModelHandler.
In the following example, both the escalate event and the case2 event have the ID 100
As a result the following junit test will fail (task 2200 should have 5 events! but results in 3!!!)
@Test
public void testComplex0()
throws ParseException, ParserConfigurationException, SAXException, IOException, ModelException {
InputStream inputStream = getClass().getResourceAsStream("/bpmn/conditional_complex_event0.bpmn");
BPMNModel model = null;
try {
model = BPMNParser.parseModel(inputStream, "UTF-8");
ItemCollection task2000 = model.getTask(2000);
ItemCollection task2200 = model.getTask(2200);
List<ItemCollection> events2000 = model.findAllEventsByTask(2000);
Assert.assertEquals(3,events2000.size());
List<ItemCollection> events2200 = model.findAllEventsByTask(2200);
Assert.assertEquals(5,events2200.size());
// NOTE:
// The following check is not resolvelable because in the demo model
// task 2200 contains a duplicate eventID which is not detected by the Parser!!
// Check event 2200.100 pointing to 2100
ItemCollection event =model.getEvent(2200,100);
Assert.assertEquals(2100, event.getItemValueInteger("numnextprocessid"));
event =model.getEvent(2200,100);
Assert.assertEquals(2100, event.getItemValueInteger("numnextprocessid"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
Assert.fail();
} catch (ModelException e) {
e.printStackTrace();
Assert.fail();
}
Assert.assertNotNull(model);
}
See the corresponding attached BPMN model in complex-model0.txt
Solution
To resolve this issue we should get rid of the org.imixs.workflow.bpmn.BPMNModelHandler and replace it with the Open-BPMN Meta model library.
The new implementation should follow a complete new approach:
[x] Replace the org.imixs.workflow.Model directly with org.openbpmn.bpmn.BPMNModel
[x] Implement an Util class that can handle the methods getTask and getEvent based on a OpenBPMN Model
[x] Move the method findVersionsByRegEx from the engine directly into the ModelManager core class
[x] Remove the method findNextTask from the WorkflowKernel - use a OpenBPMN method instead
[x] Remove the classes BPMNModelHandler, BPMNParser and BPMNModel form the package org.imixs.workflow.bpmn
[x] Remove BPMNRuleEngine (deprecated)
As a result, the new model implementation based on the Open-BPMN meta model should detect the issue with the two identical IDs in the example model.
New Methods to be implemented
[x] bpmnModel.findAllEventsByTask(taskID);
[x] bpmnModel.getTask(taskID)
[x] bpmnModel.getEvent(eventID)
[x] bpmnModel.findPlugins /getPlugin
Consequences
The WorkflowKernel need to be refactored
[x] It should not implement findNextTask
[x] It should not implement loadEvent
[x] Instead of updateEventList it should ask hasNextEvent
It looks like this methods should become part of the ModelManger
The current model implementation is using a sax parser and a ModelHandler. This implementation is not stable. In complex model situations duplicate event ids can occur. This is not detected by the
org.imixs.workflow.bpmn.BPMNModelHandler
.In the following example, both the escalate event and the case2 event have the ID 100
As a result the following junit test will fail (task 2200 should have 5 events! but results in 3!!!)
See the corresponding attached BPMN model in
complex-model0.txt
Solution
To resolve this issue we should get rid of the
org.imixs.workflow.bpmn.BPMNModelHandler
and replace it with the Open-BPMN Meta model library.The new implementation should follow a complete new approach:
org.imixs.workflow.Model
directly withorg.openbpmn.bpmn.BPMNModel
findVersionsByRegEx
from the engine directly into theModelManager
core classfindNextTask
from theWorkflowKernel
- use a OpenBPMN method insteadBPMNModelHandler
,BPMNParser
andBPMNModel
form the packageorg.imixs.workflow.bpmn
As a result, the new model implementation based on the Open-BPMN meta model should detect the issue with the two identical IDs in the example model.
New Methods to be implemented
Consequences
The WorkflowKernel need to be refactored
findNextTask
loadEvent
updateEventList
it should askhasNextEvent
It looks like this methods should become part of the ModelManger