bpmn-auto-layout icon indicating copy to clipboard operation
bpmn-auto-layout copied to clipboard

auto layout works not with non-bpmn element prefix

Open pinussilvestrus opened this issue 8 years ago • 2 comments

Hi,

I've tried your auto-layout module for converting bpmn generated by Camunda's java model api into xml with bpmndi elements. When I put your example xml (test/fixtures/diagram_1.bpmn) into the module, it works perfectly. Unfortunately Camunda's model api produces bpmn that looks like that:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions id="definitions_64a2f436-4ab3-423e-bd8e-8f6850b39731" targetNamespace="http://camunda.org/examples" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
  <process id="pid-cbf5bddf-5dcb-4706-ac74-e4cd9e1ea2e6">
    <startEvent id="startevent1" name="message incoming">
      <outgoing>startevent1-gateway1</outgoing>
    </startEvent>
    <userTask id="usertask1" name="do something">
      <incoming>gateway1-usertask1</incoming>
      <outgoing>usertask1-gateway2</outgoing>
    </userTask>
    <userTask id="usertask2">
      <incoming>gateway1-usertask2</incoming>
      <outgoing>usertask2-gateway2</outgoing>
    </userTask>
    <parallelGateway id="gateway1">
      <incoming>startevent1-gateway1</incoming>
      <outgoing>gateway1-usertask1</outgoing>
      <outgoing>gateway1-usertask2</outgoing>
    </parallelGateway>
    <parallelGateway id="gateway2">
      <incoming>usertask1-gateway2</incoming>
      <incoming>usertask2-gateway2</incoming>
      <outgoing>gateway2-endevent1</outgoing>
    </parallelGateway>
    <sequenceFlow id="startevent1-gateway1" sourceRef="startevent1" targetRef="gateway1"/>
    <sequenceFlow id="gateway1-usertask1" sourceRef="gateway1" targetRef="usertask1"/>
    <sequenceFlow id="gateway1-usertask2" sourceRef="gateway1" targetRef="usertask2"/>
    <sequenceFlow id="usertask1-gateway2" sourceRef="usertask1" targetRef="gateway2"/>
    <sequenceFlow id="usertask2-gateway2" sourceRef="usertask2" targetRef="gateway2"/>
    <endEvent id="endevent1" name="terminated">
      <incoming>gateway2-endevent1</incoming>
    </endEvent>
    <sequenceFlow id="gateway2-endevent1" sourceRef="gateway2" targetRef="endevent1"/>
  </process>
</definitions>

and the layouting crashes:

~/Github/bpmn-moddle-auto-layout/lib/AutoLayout.js:158
  var childrenDi = parentDi.get('planeElement'),
                            ^

TypeError: parentDi.get is not a function
    at AutoLayout._layoutElements (/Users/niklaskiefer/Github/bpmn-moddle-auto-layout/lib/AutoLayout.js:158:29)
    at AutoLayout._layoutGroup (/Users/niklaskiefer/Github/bpmn-moddle-auto-layout/lib/AutoLayout.js:136:24)
    at AutoLayout._breadFirstSearch (/Users/niklaskiefer/Github/bpmn-moddle-auto-layout/lib/AutoLayout.js:110:8)
    at /Users/niklaskiefer/Github/bpmn-moddle-auto-layout/lib/AutoLayout.js:41:10
    at /Users/niklaskiefer/Github/bpmn-moddle-auto-layout/node_modules/moddle-xml/lib/reader.js:720:5
    at Timeout._onTimeout (/Users/niklaskiefer/Github/bpmn-moddle-auto-layout/node_modules/lodash/internal/baseDelay.js:18:39)
    at tryOnTimeout (timers.js:224:11)
    at Timer.listOnTimeout (timers.js:198:5)

I think it's about the bpmn generated by camunda do not have the bpmn-prefix in each element, while the example bpmn file (test/fixtures/diagram_1.bpmn) has it. Is there any way to auto-layouting bpmn-xml without the bpmn-prefix?

pinussilvestrus avatar Sep 22 '16 14:09 pinussilvestrus

I would like to understand better if this project is paused because there is something alredy available in the market, or just cause is not priority. I would like to contribute. My understanding is that this is different that https://github.com/camunda-consulting/code/tree/master/snippets/bpmndi-generator . This one enable an autolayour from a created BPMN file (lets say we parse a csv into BPMN format) and it distribute all the swimlanes and nodes automatically following a flow, like the feature one-clik from yEd. Am I right?

Thank you for your support.

corinabioinformatic avatar Jun 24 '20 17:06 corinabioinformatic

@corinabioinformatic Exactly. And sorry for late response.

nikku avatar May 23 '23 07:05 nikku

@abdul99ahad Could you have a quick look at this one? It is old, and likely fixed. But I want to be sure.

nikku avatar Sep 16 '24 06:09 nikku

@abdul99ahad Could you have a quick look at this one? It is old, and likely fixed. But I want to be sure.

Yes @nikku, this issue is already resolved.

abdul99ahad avatar Sep 16 '24 09:09 abdul99ahad