bpmn-js-cli icon indicating copy to clipboard operation
bpmn-js-cli copied to clipboard

Be able to create second process in collaboration diagram

Open dkapur17 opened this issue 9 months ago • 3 comments

Is your feature request related to a problem? Please describe.

I'm unable to create multiple processes using the CLI tool. By default, say there already exists a process, then creating a new participant would simply attach a participant to that process, which is fine. This also has a secondary effect, where in the elements list, it replaces a process with a collaboration and a participant. Now to create a second participant, we would call create again with type participant and pass it id of the collaboration as the parent. However, this only creates a participant in that collaboration and not a process, which leads to irregular diagram behavior.

Describe the solution you'd like

When creating a new participant, also create a new process and link it to the participant.

Describe alternatives you've considered

None.

Additional context

Here is the initial XML I use to feed into the modeller

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
  <bpmn:collaboration id="Collaboration">
    <bpmn:participant id="Participant_1" processRef="Process_1" />
  </bpmn:collaboration>
  <bpmn:process id="Process_1" isExecutable="false" />
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration">
      <bpmndi:BPMNShape id="Participant_1_di" bpmnElement="Participant_1" isHorizontal="true">
        <dc:Bounds x="0" y="0" width="600" height="250" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Here is what I see originally, which is expected

Image

Then on running the following commands in the console

cli.elements() // ['Collaboration', 'Participant_1']
cli.create('bpmn:Participant', '0,300', 'Collaboration')

I get this in the diagram, where the participant seems to be incorrectly diagrammed

Image

On viewing the current XML:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
    xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
    xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1"
    targetNamespace="http://bpmn.io/schema/bpmn">
    <bpmn:collaboration id="Collaboration">
        <bpmn:participant id="Participant_1" processRef="Process_1" />
        <bpmn:participant id="Participant_1i4u98a" />
    </bpmn:collaboration>
    <bpmn:process id="Process_1" isExecutable="false" />
    <bpmndi:BPMNDiagram id="BPMNDiagram_1">
        <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration">
            <bpmndi:BPMNShape id="Participant_1_di" bpmnElement="Participant_1" isHorizontal="true">
                <dc:Bounds x="0" y="0" width="600" height="250" />
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Participant_1i4u98a_di" bpmnElement="Participant_1i4u98a"
                isHorizontal="true">
                <dc:Bounds x="-200" y="270" width="400" height="60" />
            </bpmndi:BPMNShape>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>
</bpmn:definitions>

We can see that it has created a participant in the collaboration element, but it has not created a new process and linked to it. I'm not sure how we can achieve that through the CLI as well.

dkapur17 avatar Mar 05 '25 07:03 dkapur17

@dkapur17 Please use the existing issue templates, to provide full context of what you want to accomplish. Only then we'll be able to handle your request.

nikku avatar Mar 05 '25 08:03 nikku

Hey @nikku, updated the issue to follow the template.

dkapur17 avatar Mar 05 '25 09:03 dkapur17

From what I understand you want to create a second process, within a collaboration diagram. A process, inside a collaboration diagram, is represented ("wrapped") in a participant. We don't seem to support this at the moment. Neither can we blindly attach a process to any newly created participant (as an "empty pool") is a very valid BPMN construct.

nikku avatar Mar 21 '25 11:03 nikku