bpmn-io / bpmn-js-differ

A diffing utility for BPMN 2.0 documents.
44 stars 16 forks source link

Exception in case of input / output parameters #1

Closed romero83 closed 6 years ago

romero83 commented 7 years ago

Hi!

I am trying to compare two Camunda BPMN files using http://demo.bpmn.io/diff But it throws an exception: TypeError: element.$instanceOf is not a function when trying to diff input parameters. in change-handler.js at

function isTracked(element) {
  return element.$instanceOf('bpmn:FlowElement') ||
         element.$instanceOf('bpmn:MessageFlow') ||
         element.$instanceOf('bpmn:Participant') ||
         element.$instanceOf('bpmn:Lane');
}

The element $type is camunda:inputOutput.

First XML:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
  <bpmn:process id="fff" isExecutable="false">
    <bpmn:startEvent id="StartEvent_1">
      <bpmn:outgoing>SequenceFlow_1l2alrr</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:sequenceFlow id="SequenceFlow_1l2alrr" sourceRef="StartEvent_1" targetRef="Task_0geagms" />
    <bpmn:scriptTask id="Task_0geagms" name="script" scriptFormat="Groovy">
      <bpmn:incoming>SequenceFlow_1l2alrr</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0qh2ryo</bpmn:outgoing>
      <bpmn:script>def a = 5;</bpmn:script>
    </bpmn:scriptTask>
    <bpmn:exclusiveGateway id="ExclusiveGateway_0i9etvt">
      <bpmn:incoming>SequenceFlow_0qh2ryo</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_002h4dw</bpmn:outgoing>
      <bpmn:outgoing>SequenceFlow_1skof2e</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="SequenceFlow_0qh2ryo" sourceRef="Task_0geagms" targetRef="ExclusiveGateway_0i9etvt" />
    <bpmn:sequenceFlow id="SequenceFlow_002h4dw" sourceRef="ExclusiveGateway_0i9etvt" targetRef="Task_0hkdh1z" />
    <bpmn:sequenceFlow id="SequenceFlow_1skof2e" sourceRef="ExclusiveGateway_0i9etvt" targetRef="Task_18gmnrc" />
    <bpmn:exclusiveGateway id="ExclusiveGateway_045dd9c">
      <bpmn:incoming>SequenceFlow_172rbr7</bpmn:incoming>
      <bpmn:incoming>SequenceFlow_198g0r8</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1pf4zxa</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="SequenceFlow_172rbr7" sourceRef="Task_0hkdh1z" targetRef="ExclusiveGateway_045dd9c" />
    <bpmn:sequenceFlow id="SequenceFlow_198g0r8" sourceRef="Task_18gmnrc" targetRef="ExclusiveGateway_045dd9c" />
    <bpmn:endEvent id="EndEvent_0lgticq">
      <bpmn:incoming>SequenceFlow_0xlsm8m</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="SequenceFlow_1pf4zxa" sourceRef="ExclusiveGateway_045dd9c" targetRef="Task_1t96lfx" />
    <bpmn:businessRuleTask id="Task_0hkdh1z" name="dmn" camunda:decisionRef="abrakaDmn">
      <bpmn:incoming>SequenceFlow_002h4dw</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_172rbr7</bpmn:outgoing>
    </bpmn:businessRuleTask>
    <bpmn:serviceTask id="Task_18gmnrc" name="blacklistService" camunda:delegateExpression="${syncRestService}">
      <bpmn:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="abraka" />
          <camunda:inputParameter name="dabra" />
        </camunda:inputOutput>
      </bpmn:extensionElements>
      <bpmn:incoming>SequenceFlow_1skof2e</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_198g0r8</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:task id="Task_1t96lfx" name="delete">
      <bpmn:incoming>SequenceFlow_1pf4zxa</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0xlsm8m</bpmn:outgoing>
    </bpmn:task>
    <bpmn:sequenceFlow id="SequenceFlow_0xlsm8m" sourceRef="Task_1t96lfx" targetRef="EndEvent_0lgticq" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="fff">
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="173" y="102" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1l2alrr_di" bpmnElement="SequenceFlow_1l2alrr">
        <di:waypoint xsi:type="dc:Point" x="209" y="120" />
        <di:waypoint xsi:type="dc:Point" x="293" y="120" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="251" y="105" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ScriptTask_1j64jmy_di" bpmnElement="Task_0geagms">
        <dc:Bounds x="293" y="80" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ExclusiveGateway_0i9etvt_di" bpmnElement="ExclusiveGateway_0i9etvt" isMarkerVisible="true">
        <dc:Bounds x="482" y="95" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="507" y="145" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_0qh2ryo_di" bpmnElement="SequenceFlow_0qh2ryo">
        <di:waypoint xsi:type="dc:Point" x="393" y="120" />
        <di:waypoint xsi:type="dc:Point" x="482" y="120" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="438" y="105" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_002h4dw_di" bpmnElement="SequenceFlow_002h4dw">
        <di:waypoint xsi:type="dc:Point" x="507" y="145" />
        <di:waypoint xsi:type="dc:Point" x="507" y="228" />
        <di:waypoint xsi:type="dc:Point" x="583" y="228" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="522" y="186.5" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_1skof2e_di" bpmnElement="SequenceFlow_1skof2e">
        <di:waypoint xsi:type="dc:Point" x="507" y="95" />
        <di:waypoint xsi:type="dc:Point" x="507" y="14" />
        <di:waypoint xsi:type="dc:Point" x="583" y="14" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="522" y="54.5" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ExclusiveGateway_045dd9c_di" bpmnElement="ExclusiveGateway_045dd9c" isMarkerVisible="true">
        <dc:Bounds x="737" y="95" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="762" y="145" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_172rbr7_di" bpmnElement="SequenceFlow_172rbr7">
        <di:waypoint xsi:type="dc:Point" x="683" y="228" />
        <di:waypoint xsi:type="dc:Point" x="762" y="228" />
        <di:waypoint xsi:type="dc:Point" x="762" y="145" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="723" y="213" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_198g0r8_di" bpmnElement="SequenceFlow_198g0r8">
        <di:waypoint xsi:type="dc:Point" x="683" y="14" />
        <di:waypoint xsi:type="dc:Point" x="762" y="14" />
        <di:waypoint xsi:type="dc:Point" x="762" y="95" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="723" y="-1" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="EndEvent_0lgticq_di" bpmnElement="EndEvent_0lgticq">
        <dc:Bounds x="1005" y="102" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1023" y="138" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1pf4zxa_di" bpmnElement="SequenceFlow_1pf4zxa">
        <di:waypoint xsi:type="dc:Point" x="787" y="120" />
        <di:waypoint xsi:type="dc:Point" x="847" y="120" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="817" y="105" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BusinessRuleTask_1v6ifyn_di" bpmnElement="Task_0hkdh1z">
        <dc:Bounds x="583" y="188" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ServiceTask_0nxju3n_di" bpmnElement="Task_18gmnrc">
        <dc:Bounds x="583" y="-26" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_1t96lfx_di" bpmnElement="Task_1t96lfx">
        <dc:Bounds x="847" y="80" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_0xlsm8m_di" bpmnElement="SequenceFlow_0xlsm8m">
        <di:waypoint xsi:type="dc:Point" x="947" y="120" />
        <di:waypoint xsi:type="dc:Point" x="1005" y="120" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="976" y="105" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Second XML:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
  <bpmn:process id="fff" isExecutable="false">
    <bpmn:startEvent id="StartEvent_1">
      <bpmn:outgoing>SequenceFlow_1l2alrr</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:sequenceFlow id="SequenceFlow_1l2alrr" sourceRef="StartEvent_1" targetRef="Task_0geagms" />
    <bpmn:scriptTask id="Task_0geagms" name="script" scriptFormat="Groovy">
      <bpmn:incoming>SequenceFlow_1l2alrr</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0qh2ryo</bpmn:outgoing>
      <bpmn:script><![CDATA[def a = 5;

for(def i = 1 ; i <= 20; i++) {
    def nn = 87;
}]]></bpmn:script>
    </bpmn:scriptTask>
    <bpmn:exclusiveGateway id="ExclusiveGateway_0i9etvt">
      <bpmn:incoming>SequenceFlow_0qh2ryo</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_002h4dw</bpmn:outgoing>
      <bpmn:outgoing>SequenceFlow_1skof2e</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="SequenceFlow_0qh2ryo" sourceRef="Task_0geagms" targetRef="ExclusiveGateway_0i9etvt" />
    <bpmn:sequenceFlow id="SequenceFlow_002h4dw" sourceRef="ExclusiveGateway_0i9etvt" targetRef="Task_0hkdh1z" />
    <bpmn:sequenceFlow id="SequenceFlow_1skof2e" sourceRef="ExclusiveGateway_0i9etvt" targetRef="Task_18gmnrc" />
    <bpmn:exclusiveGateway id="ExclusiveGateway_045dd9c">
      <bpmn:incoming>SequenceFlow_172rbr7</bpmn:incoming>
      <bpmn:incoming>SequenceFlow_198g0r8</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1pf4zxa</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="SequenceFlow_172rbr7" sourceRef="Task_0hkdh1z" targetRef="ExclusiveGateway_045dd9c" />
    <bpmn:sequenceFlow id="SequenceFlow_198g0r8" sourceRef="Task_18gmnrc" targetRef="ExclusiveGateway_045dd9c" />
    <bpmn:endEvent id="EndEvent_0lgticq">
      <bpmn:incoming>SequenceFlow_1pf4zxa</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="SequenceFlow_1pf4zxa" sourceRef="ExclusiveGateway_045dd9c" targetRef="EndEvent_0lgticq" />
    <bpmn:businessRuleTask id="Task_0hkdh1z" name="dmn" camunda:decisionRef="abraka88Dmn">
      <bpmn:incoming>SequenceFlow_002h4dw</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_172rbr7</bpmn:outgoing>
    </bpmn:businessRuleTask>
    <bpmn:serviceTask id="Task_18gmnrc" name="somethingService" camunda:delegateExpression="${syncRestService}">
      <bpmn:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="apple" />
          <camunda:inputParameter name="melon" />
        </camunda:inputOutput>
      </bpmn:extensionElements>
      <bpmn:incoming>SequenceFlow_1skof2e</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_198g0r8</bpmn:outgoing>
    </bpmn:serviceTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="fff">
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="173" y="102" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1l2alrr_di" bpmnElement="SequenceFlow_1l2alrr">
        <di:waypoint xsi:type="dc:Point" x="209" y="120" />
        <di:waypoint xsi:type="dc:Point" x="293" y="120" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="251" y="105" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ScriptTask_1j64jmy_di" bpmnElement="Task_0geagms">
        <dc:Bounds x="293" y="80" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ExclusiveGateway_0i9etvt_di" bpmnElement="ExclusiveGateway_0i9etvt" isMarkerVisible="true">
        <dc:Bounds x="482" y="95" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="507" y="145" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_0qh2ryo_di" bpmnElement="SequenceFlow_0qh2ryo">
        <di:waypoint xsi:type="dc:Point" x="393" y="120" />
        <di:waypoint xsi:type="dc:Point" x="482" y="120" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="438" y="105" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_002h4dw_di" bpmnElement="SequenceFlow_002h4dw">
        <di:waypoint xsi:type="dc:Point" x="507" y="145" />
        <di:waypoint xsi:type="dc:Point" x="507" y="228" />
        <di:waypoint xsi:type="dc:Point" x="583" y="228" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="522" y="186.5" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_1skof2e_di" bpmnElement="SequenceFlow_1skof2e">
        <di:waypoint xsi:type="dc:Point" x="507" y="95" />
        <di:waypoint xsi:type="dc:Point" x="507" y="14" />
        <di:waypoint xsi:type="dc:Point" x="583" y="14" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="522" y="54.5" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ExclusiveGateway_045dd9c_di" bpmnElement="ExclusiveGateway_045dd9c" isMarkerVisible="true">
        <dc:Bounds x="737" y="95" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="762" y="145" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_172rbr7_di" bpmnElement="SequenceFlow_172rbr7">
        <di:waypoint xsi:type="dc:Point" x="683" y="228" />
        <di:waypoint xsi:type="dc:Point" x="762" y="228" />
        <di:waypoint xsi:type="dc:Point" x="762" y="145" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="723" y="213" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_198g0r8_di" bpmnElement="SequenceFlow_198g0r8">
        <di:waypoint xsi:type="dc:Point" x="683" y="14" />
        <di:waypoint xsi:type="dc:Point" x="762" y="14" />
        <di:waypoint xsi:type="dc:Point" x="762" y="95" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="723" y="-1" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="EndEvent_0lgticq_di" bpmnElement="EndEvent_0lgticq">
        <dc:Bounds x="900" y="102" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="918" y="138" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1pf4zxa_di" bpmnElement="SequenceFlow_1pf4zxa">
        <di:waypoint xsi:type="dc:Point" x="787" y="120" />
        <di:waypoint xsi:type="dc:Point" x="900" y="120" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="844" y="105" width="0" height="0" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BusinessRuleTask_1v6ifyn_di" bpmnElement="Task_0hkdh1z">
        <dc:Bounds x="583" y="188" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ServiceTask_0nxju3n_di" bpmnElement="Task_18gmnrc">
        <dc:Bounds x="583" y="-26" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
nikku commented 6 years ago

This is fixed with version v0.3.0 of this library.