I am wondering whether there is an event that I could use to consistently determine whether a new process has been created (as a result of adding a Pool/Participant).
I naturally first tried to determine this based on the shape.added event for the element of type Participant. However, I ran into a couple of inconsistencies there.
Firstly, I am not quite sure what happens internally when the first participant is added. Does the previous process get deleted, and recreated, or does it simply get placed under the added participant? I have also noticed that the root.changed event fires when the first participant is added. What does that mean? I have also noticed that the id of the process does not change, which makes me think that the process itself does not change. When more participants are added, everything works fine, new processes are created for each new participant.
However, I have found an anomaly (possible bug?).
- I start with a fresh model, the process has id Process_1
- I add the first participant, the process still has id Process_1
- I undo the action. The participant gets removed and the process still has id Process_1
- I redo the undo. The first participant gets re-added, however the process now has a completely different id
This behaviour was totally unexpected and I am not quite sure how to interpret what is going on internally.
PS: for anyone wondering why I need the information about the process being created: I am creating an “extension” of the modeller for a custom modelling language. My modeller uses bpmn modeller to model part of my custom model. I am however using Blazor, so I have to transform the data model into C#. I use the events to synchronize my .NET data model in real time. All of the elements seem to work fine, but I hit this snag when I tried to add support for multiple processes in the form of participants.