fix(bpmn-updater): keep default flow when reconnecting sequence flow end

Closes #619
This commit is contained in:
Philipp Fromme 2016-10-18 13:18:13 +02:00 committed by pedesen
parent 738622b813
commit ccd5eeb758
3 changed files with 45 additions and 25 deletions

View File

@ -213,7 +213,7 @@ function BpmnUpdater(eventBus, bpmnFactory, connectionDocking, translate) {
}
// on reconnectStart -> default flow
if (oldSource && oldSource.default) {
if (oldSource && oldSource.default === businessObject) {
context.default = oldSource.default;
oldSource.default = undefined;
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_G5HDsJKJEeSY3uHQ7B6T_A" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_G5HDsJKJEeSY3uHQ7B6T_A" targetNamespace="http://activiti.org/bpmn" exporter="Camunda Modeler" exporterVersion="1.2.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:serviceTask id="ServiceTask_1">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
@ -7,7 +7,7 @@
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_3" name="conditional" sourceRef="ServiceTask_1" targetRef="EndEvent_1">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">${foo > bar}</bpmn2:conditionExpression>
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${foo > bar}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:task id="Task_2">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
@ -17,62 +17,66 @@
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="default" sourceRef="ExclusiveGateway_1" targetRef="ServiceTask_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="default" sourceRef="ExclusiveGateway_1" targetRef="ServiceTask_1" />
<bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ExclusiveGateway_1" targetRef="Task_2">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${foo < bar}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ServiceTask_1" targetRef="Task_2"/>
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ServiceTask_1" targetRef="Task_2" />
<bpmn2:endEvent id="EndEvent_1">
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:task id="Task_1" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_2" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
<dc:Bounds height="50.0" width="50.0" x="372.0" y="204.0"/>
<dc:Bounds x="372" y="204" width="50" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="397.0" y="259.0"/>
<dc:Bounds x="397" y="259" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ServiceTask_1">
<dc:Bounds height="80.0" width="100.0" x="492.0" y="84.0"/>
<dc:Bounds x="492" y="84" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ExclusiveGateway_2" targetElement="_BPMNShape_Task_2">
<di:waypoint xsi:type="dc:Point" x="397.0" y="204.0"/>
<di:waypoint xsi:type="dc:Point" x="397.0" y="124.0"/>
<di:waypoint xsi:type="dc:Point" x="492.0" y="124.0"/>
<di:waypoint xsi:type="dc:Point" x="397" y="204" />
<di:waypoint xsi:type="dc:Point" x="397" y="124" />
<di:waypoint xsi:type="dc:Point" x="492" y="124" />
<bpmndi:BPMNLabel>
<dc:Bounds height="21.0" width="44.0" x="348.0" y="138.0"/>
<dc:Bounds x="348" y="138" width="44" height="21" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_Task_3" bpmnElement="Task_2">
<dc:Bounds height="80.0" width="100.0" x="492.0" y="300.0"/>
<dc:Bounds x="492" y="300" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ExclusiveGateway_2" targetElement="_BPMNShape_Task_3">
<di:waypoint xsi:type="dc:Point" x="397.0" y="254.0"/>
<di:waypoint xsi:type="dc:Point" x="397.0" y="340.0"/>
<di:waypoint xsi:type="dc:Point" x="492.0" y="340.0"/>
<di:waypoint xsi:type="dc:Point" x="397" y="254" />
<di:waypoint xsi:type="dc:Point" x="397" y="340" />
<di:waypoint xsi:type="dc:Point" x="492" y="340" />
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="394.0" y="279.0"/>
<dc:Bounds x="394" y="279" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_2" bpmnElement="EndEvent_1">
<dc:Bounds height="36.0" width="36.0" x="732.0" y="106.0"/>
<dc:Bounds x="732" y="106" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="750.0" y="147.0"/>
<dc:Bounds x="750" y="147" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_EndEvent_2">
<di:waypoint xsi:type="dc:Point" x="592.0" y="124.0"/>
<di:waypoint xsi:type="dc:Point" x="732.0" y="124.0"/>
<di:waypoint xsi:type="dc:Point" x="592" y="124" />
<di:waypoint xsi:type="dc:Point" x="732" y="124" />
<bpmndi:BPMNLabel>
<dc:Bounds height="21.0" width="68.0" x="612.0" y="128.0"/>
<dc:Bounds x="612" y="128" width="68" height="21" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_Task_3">
<di:waypoint xsi:type="dc:Point" x="542.0" y="164.0"/>
<di:waypoint xsi:type="dc:Point" x="542.0" y="300.0"/>
<di:waypoint xsi:type="dc:Point" x="542" y="164" />
<di:waypoint xsi:type="dc:Point" x="542" y="300" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Task_0rfo67v_di" bpmnElement="Task_1">
<dc:Bounds x="204" y="300" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
</bpmn2:definitions>

View File

@ -87,6 +87,22 @@ describe('features/modeling - update properties', function() {
expect(updatedElements).to.include(newDefaultFlowConnection);
}));
it('should keep default flow when reconnecting another sequence flows start',
inject(function(elementRegistry, modeling) {
// given
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
sequenceFlow = elementRegistry.get('SequenceFlow_2'),
taskShape = elementRegistry.get('Task_1');
// when
modeling.reconnectStart(sequenceFlow, taskShape,
{ x: taskShape.x + taskShape.width, y: taskShape.y + taskShape.height / 2 });
// then
expect(gatewayShape.businessObject.default).not.to.be.undefined;
}));
it('updating conditional flow on source replace', inject(function(bpmnReplace, elementRegistry) {