e2ebridge / bpmn

BPMN 2.0 execution engine
466 stars 138 forks source link

Reading other bpmn 2 formats #27

Open baloodevil opened 8 years ago

baloodevil commented 8 years ago

I designed a workflow using Camunda's bpmn-io, which is a great Javascript/HTML designer/viewer. However the generated BPMN looks completely different than what you have in your samples. Here is an excerpt from both...

bpmn-io...

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="http://bpmn.io" exporterVersion="0.10.1">
  <process id="Process_1" isExecutable="false">
    <startEvent id="StartEvent_1" name="MyStart">
      <outgoing>SequenceFlow_1</outgoing>
    </startEvent>
    <task id="Task_1" name="MyTask">
      <incoming>SequenceFlow_1</incoming>
      <outgoing>SequenceFlow_03hcm0h</outgoing>
    </task>
    <sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Task_1" />
    <endEvent id="EndEvent_06zsuum" name="MyEnd">
      <incoming>SequenceFlow_03hcm0h</incoming>
    </endEvent>
    <sequenceFlow id="SequenceFlow_03hcm0h" sourceRef="Task_1" targetRef="EndEvent_06zsuum" />
  </process>
  <bpmndi:BPMNDiagram id="BpmnDiagram_1">
    <bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="StartEvent_1_gui" bpmnElement="StartEvent_1">
        <omgdc:Bounds x="242" y="187" width="30" height="30" />
        <bpmndi:BPMNLabel>
          <omgdc:Bounds x="212" y="219" width="90" height="22" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_1_gui" bpmnElement="Task_1">
        <omgdc:Bounds x="340" y="162" width="100" height="80" />
        <bpmndi:BPMNLabel>
          <omgdc:Bounds x="118.85714721679688" y="47" width="82.28570556640625" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1_gui" bpmnElement="SequenceFlow_1">
        <omgdi:waypoint xsi:type="omgdc:Point" x="272" y="202" />
        <omgdi:waypoint xsi:type="omgdc:Point" x="340" y="202" />
        <bpmndi:BPMNLabel>
          <omgdc:Bounds x="225" y="140" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="EndEvent_06zsuum_di" bpmnElement="EndEvent_06zsuum">
        <omgdc:Bounds x="518" y="184" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <omgdc:Bounds x="491" y="220" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_03hcm0h_di" bpmnElement="SequenceFlow_03hcm0h">
        <omgdi:waypoint xsi:type="omgdc:Point" x="440" y="202" />
        <omgdi:waypoint xsi:type="omgdc:Point" x="475" y="202" />
        <omgdi:waypoint xsi:type="omgdc:Point" x="475" y="202" />
        <omgdi:waypoint xsi:type="omgdc:Point" x="518" y="202" />
        <bpmndi:BPMNLabel>
          <omgdc:Bounds x="430" y="235" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

and comparatively the same sample with e2e's bpmn...

<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:debugger="http://e2e.ch/bpmneditor/debugger">
  <bpmn:extensionElements>
    <debugger:position href="http://localhost:7261/grapheditor/debugger/position"/>
  </bpmn:extensionElements>
  <bpmn:process id="PROCESS_1">
    <bpmn:startEvent name="MyStart" label="MyStart" id="2">
      <mxCell style="shape=mxgraph.bpmn.none_start_event;verticalLabelPosition=bottom;verticalAlign=top;" vertex="1" parent="1">
        <mxGeometry x="91" y="91" width="40" height="40" as="geometry"/>
      </mxCell>
    </bpmn:startEvent>
    <bpmn:task name="MyTask" label="MyTask" id="3">
      <mxCell style="shape=mxgraph.bpmn.task;" vertex="1" parent="1">
        <mxGeometry x="240" y="81" width="140" height="60" as="geometry"/>
      </mxCell>
    </bpmn:task>
    <bpmn:sequenceFlow name="" sourceRef="2" targetRef="3" id="4">
      <mxCell style="endArrow=block;endFill=1;endSize=6;edgeStyle=orthogonalEdgeStyle" edge="1" parent="1" source="2" target="3">
        <mxGeometry x="1" y="1" as="geometry">
          <mxPoint as="sourcePoint"/>
          <mxPoint x="30" y="30" as="targetPoint"/>
        </mxGeometry>
      </mxCell>
    </bpmn:sequenceFlow>
    <bpmn:endEvent name="MyEnd" label="MyEnd" id="5">
      <mxCell style="shape=mxgraph.bpmn.none_end_event;verticalLabelPosition=bottom;verticalAlign=top;" vertex="1" parent="1">
        <mxGeometry x="470" y="91" width="40" height="40" as="geometry"/>
      </mxCell>
    </bpmn:endEvent>
    <bpmn:sequenceFlow name="" sourceRef="3" targetRef="5" id="6">
      <mxCell style="endArrow=block;endFill=1;endSize=6;edgeStyle=orthogonalEdgeStyle" edge="1" parent="1" source="3" target="5">
        <mxGeometry x="1" y="1" as="geometry">
          <mxPoint as="sourcePoint"/>
          <mxPoint x="30" y="30" as="targetPoint"/>
        </mxGeometry>
      </mxCell>
    </bpmn:sequenceFlow>
  </bpmn:process>
</bpmn:definitions>

I am new to BPMN, but shouldn't these two be compatible? Shouldn't I be able to design a workflow in any bpmn designer and execute in any execution engine?

cyrilschmitt commented 8 years ago

Hello baloodevil,

The only part that is used by our bpmn engine are the elements in namespace "http://www.omg.org/spec/BPMN/20100524/MODEL" the others are graphical info which are useless for us.

So for these two bpmn they are the same.

I didn't tested but the result with one or the other should be the same with our engine.

pradysam1 commented 8 years ago

Hi @cyrilschmitt I encountered the exact same issue. It seems like bpmn has an issue parsing the bmpn generated by camunda designer.

I think its a great combination for us to use the bpmn engine from you guys and the camunda designer. I really hope you guys can fix this issue

/Users/zzz/Documents/BPMN/boo.js:7
    myProcess.triggerEvent("MyStart");
              ^
TypeError: Cannot call method 'triggerEvent' of undefined
    at /Users/prady/Documents/BPMN/boo.js:7:15
    at exports.createUnmanagedProcess (/Users/prady/node_modules/bpmn/lib/public.js:45:13)
    at Object.<anonymous> (/Users/prady/Documents/BPMN/boo.js:4:6)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
gregd-icesoft commented 8 years ago

@pradysam1, is your process definition in the Camunda editor marked as executable? The exception can lead to looking into parse issues which is not the base problem. The parser wont handle the top level process definition unless it's marked executable. There is, however, a misleading log statement in the code that says there have been multiple processes found when really the problem is that none have been found.

At line 26 in definitions.js

if (processDefinitions.length === 1) { processDefinition = processDefinitions[0]; } else { throw new Error("The BPMN file '" + bpmnFilePath + "'. contains more than one process definition. Use 'getBPMNProcessDefinitions' instead of 'getBPMNProcessDefinition'"); }

ghost commented 8 years ago

You can simply change this:

<process id="Process_1" isExecutable="false">

to

<process id="Process_1">

Btw, the parser should have pre-checking to filter all unnecessary attributes.

guyspr commented 7 years ago

I ran into the same issue here, I'm wondering why the choice is made to ignore everything that is not marked as executable. Like the bpmn.io editor, there is no way to disable it other than going into the code and editing it like @yhjor1212 explained.