imixs / imixs-workflow

The open source technology for business process management
http://www.imixs.org/
GNU General Public License v3.0
358 stars 64 forks source link

Introduce Open-BPMN-Meta Model #823

Closed rsoika closed 4 weeks ago

rsoika commented 1 year ago

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

image

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:

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

It looks like this methods should become part of the ModelManger

rsoika commented 1 year ago

Find Demo Model here:

https://github.com/imixs/imixs-workflow/blob/master/imixs-workflow-core/src/test/resources/bpmn/conditional_complex_event0.bpmn

complex-model0.txt

rsoika commented 2 months ago

Verify the case process workitem with $modelversion = "" and $workflowGroup="Some Groupname"