Support for data object collections

The support for data collections is currently incomplete and/or broken:

  • Even if the attribute isCollection is set to true, the class BpmnRenderer does not add the corresponding marker to the data object shape.
  • The attribute isCollection is not serialized in the BPMN/XML file.
  • There is not an icon for data collection that can be used within the modeler palette.

To describe the workaround that I found, let us assume that we set up the modeler’s palette with the following snippet (based on the custom elements example):

'create.data-object-collection': createAction(
    'bpmn:DataObjectReference', 'data-object', 'bpmn-icon-data-object',
            'Create data object collection', {isCollection: true}
)

With the above, I can create a data object element with the attribute isCollection set to true. I found that BpmnRenderer decides whether to add the collection marker to the data object shape or not in lines 144-148:

var semantic = getSemantic(element);

if (isCollection(semantic)) {
   renderDataItemCollection(parentGfx, element);
} 

Hence, I patched the same lines of code as follows:

var semantic = getSemantic(element);

if (isCollection(semantic) || isCollection(element)) {
   renderDataItemCollection(parentGfx, element);
} 

which solves the first bullet point in my list of issues above. That said, I could try to write a custom bpmn renderer and get my modeler working as required. However, I also thought the problem is probably a bug you are not aware of, and that it makes sense to fix it in the right place (i.e. BpmnRenderer).

Now, another possibility is that the palette has to be set up in a different way. Maybe, this is also the reason why the attribute isCollection is not serialized into the XML document.

I agree that we should fix bugs in bpmn-js, not custom renderers.

Would you be so kind and create a Pull Request for the changes you propose on GitHub. That makes discussing, reviewing and eventually merging things easier.

Thanks a lot for your response. I created the Pull Request on GitHub and now I am waiting to see what happens.
Now, there are two additional issues: the serialization of such attribute into XML, and the icon to be used if I want to add the data collection in the palette. Anything you could say about such issues?

Please post the link to your PR for reference.

Hi,

The link to my PR is the following:

BTW I dug a bit more in the problem and proposed a patch that solves both rendering of the marker and proper serialization/deserialization of the model to/from XML. I wrote some additional details about the patch in the PR.

Thanks for fixing the problem with rendering the marker. I was wondering if your change also fixes the problem with serialization/deserialization to/from XML files of the property isCollection?

The change merged only fixes isCollection rendering.

My patch was also addressing the problem of serialization/deserialization.