Hey everyone,
although this question might seems to be repetitive, I could not find an answer for our problem yet. In this post, I shared some details on our use case. What we do is creating workflows of different elements with each having a variety of parameters. Moreover, we have several sub elements that again take these elements to be the superClass
of it.
For the moment, each custom element has the superClass
of the bpmn:ServiceTask
. When we add this moddleExtension
to the BpmnModeler
using for instance the key custom
, our elements are represented in the XML format the following way (which works quite well):
<bpmn2:startEvent id="StartEvent_1" name="StartEvent">
<bpmn2:outgoing>SequenceFlow_0k0bmor</bpmn2:outgoing>
</bpmn2:startEvent>
<custom:myCustomElement id="MyCustomElement_1ty1max" customParameter="abc">
<bpmn2:incoming>SequenceFlow_0k0bmor</bpmn2:incoming>
...
</custom:myCustomElement>
However, I wonder, if this is the proper way to implement this modeling extension. While I found this answer from @nikku at Github, saying that making elements a sub-class of bpmn:Task
is a valid option, I also read about bpmn:ExtensionElements
on https://github.com/bpmn-io/bpmn-js-example-model-extension:
A few things are worth noting here:
You can extend existing types using the "extends" property.
If you want to add extension elements to bpmn:ExtensionElements they have to have "superClass": [ "Element" ].
I also found this answer from @philippfromme that lists the trade-offs of our solution. Now, I wonder, if our elements should not make use of the bpmn:ExtensionElements
, too? In order to result in something like:
<bpmn2:startEvent id="StartEvent_1" name="StartEvent">
<bpmn2:outgoing>SequenceFlow_0k0bmor</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:extensionElements>
<custom:myCustomElement id="MyCustomElement_1ty1max" customParameter="abc">
<bpmn2:incoming>SequenceFlow_0k0bmor</bpmn2:incoming>
...
</custom:myCustomElement>
</bpmn2:extensionElements>
However, this is also the part, where I got stuck after checking out the example project GitHub - bpmn-io/bpmn-js-example-model-extension: An example of creating a model extension for bpmn-js and read some issues such as regarding extends and superClass.
I am really curious whether this structure a few lines above is even possible to create or whether it would instead look like the following:
<bpmn2:startEvent id="StartEvent_1" name="StartEvent">
<bpmn2:outgoing>SequenceFlow_0k0bmor</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:serviceTask id="ServiceTask_XYZ">
<bpmn2:incoming>SequenceFlow_0k0bmor</bpmn2:incoming>
...
<bpmn2:extensionElements>
<custom:myCustomElement id="MyCustomElement_1ty1max" customParameter="abc" />
</bpmn2:extensionElements>
</bpmn2:serviceTask>
Maybe you can provide us some hints on when to use the solution of "superClass": ["bpmn:ServiceTask"]
and when to use "superClass": ["Element"]
? This would be really helpful.
As always, I am thankful for every hint. Additionally, thank you very much for your time and effort you are putting in this project and its support.