Create Elements outside Pool like DataStoreReference

Hi,

i have a question regarding BpmnUpdater.

My goal is to create elements outside of a pool.

I believe i already found the reason why this is not working. As stated here, Process Elements outside of a Pool - #2 by barmac
" To make it easier for our users we clearly distinguish between process and collaboration diagrams."

The error occurs in this line:

If there is no pool present the newParent is a “bpmn:Process” and it works, with a pool it’s “bpmn:Collaboration” and it doesnt.

This behaviour is already possible with “bpmn:DataStoreReference”. If i create a DataStoreReference the newParent is always a “bpmn:Process”. How can i achieve this with other elements? Do i have to write somehting like DataStoreReferenceBehaviour? If so any tipps how to start, seems quite complex :wink:
To make things simpler these elements wont be connected to anything else! They will only be present outside of a pool, bascially my company wants to visually support diagramms.

Btw i already know this is possible with custom elements, as seen in your example. However i want to be able to export these elements like you do with “bpmn:DataStroreReference”.

As always thank you for your help and time!

Nearly fogot that i asked this question.

The answer seems to be rather simple. Instead of using “bpmn:Task” use the superClass “bpmn:DataStoreReference”.

After enabling drop outside of pools for your custom element, you can create it there and it also gets exported per XML.
After my testing it seems like it inherits all the behaviour of “bpmn:DataStoreReference”.

Placing data stores outside of participants (for convenience) is enabled by DataStoreBehavior. Whenever a data store is created or moved its semantic parent will be set to a process being referenced by one of the participants to ensure valid BPMN 2.0. What is you custom element supposed to represent?

Hi philipp,

i inserted a picture to illustrate my use case:
ForumPhaseFrage

At the beginning of every process there is one “Phase” present. Then the user can drop another phase only on top of this “Phase”.
After that i implemented a simple layout that positiones the elements next to each other. In between them a line is created.
Their purpose is similar to lanes, they are supposed to represent temporal phases of the process. Also the user can resize them only horizontally, he cant move them connect them etc.

After some testing this works okay at best.
I can export und import them. The XML looks like this:

Export XML
<bpmn2:process id="Process_0dgcvch">
    <bpmn2:laneSet id="LaneSet_0fs1gr1">
      <bpmn2:lane id="Lane_1dbaffk" name="Start_Lane" />
    </bpmn2:laneSet>
    <cu:phase id="Phase_1v8phpd" isPhase="true" />
 </bpmn2:process>

However i can only ex- and import one element. Also as you can see in the picture it calls
the create externalLabel(). Thats the reason why there are two names present. In my customRenderer
i created a renderEmbeddedLabel(). For every other custom element this works. In this case it seems like the dataStoreReference unique behaviour cant be overwritten that easily.
If necessary the Json file:

JSON
{
  "name": "PhaseLineExample",
  "uri": "http://example/PhaseLineExample",
  "prefix": "cu",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "types": [
      {
          "name": "Phase",
          "superClass": [
              "bpmn:DataStoreReference"
          ],
          "properties": [
          {
              "name": "isPhase",
              "isAttr": true,
              "type": "Boolean"
          }
          ]
      },
      {
        "name": "Line",
        "superClass": [
            "bpmn:Task"
        ],
        "properties": []
    }
  ],
  "emumerations": [],
  "associations": []
}

I would prefer creating this element by “superClass”: [ “bpmn:Task” ], to avoid the sideeffects.
However then i am unable to place the element outside the pool while being able to ex- and import it.
Do you have a suggestion?
Is it possible to place custom elements outside of a pool and still import and export them?
(Given i extended them properly)
Or is the best way to use DataStoreReference and try to implement my own behaviour?

Again Thanks for your help

Hey,

have to report that it actually works just fine. So if anybody wants a custom artifact just extend the dataobject.
Smart as I am I tested modeling.updateProperties in my custom behaviour and set an illegal id.
That was the entire Problem…
To fix the label I just had to adjust 5 lines…

So works great! My own mistake^^

I don’t think using data store references as the superclass makes sense. This is basically a hack. Is the phase arrow supposed to have any BPMN 2.0 semantics? You might be better off using overlays to display the arrow.

Hi philipp,

thanks for the advice! In terms of execution they dont have any meaning.
They are basically just a visual aid. However if possible i want to export them just like any other element.

Also the user is supposed to drag them from one spot to another and also resize them.
For this i need a Layout:
All Phases together are as wide as their Pool.

Is this possible to do with Overlays?

I would build this using overlays since the arrows are meant to visualize the phases (which would otherwise be hidden in the XML since they have no visual representation) but aren’t actual elements in the diagram. That would require some effort of course. Inheriting from bpmn:DataStoreReference makes no sense so I’d say don’t do it.