fix(modeling): properly handle DataInput / DataOutput move

Closes #961
This commit is contained in:
Nico Rehwaldt 2019-03-28 20:46:00 +01:00 committed by merge-me[bot]
parent 4c270a01e4
commit 8c49cb679b
3 changed files with 137 additions and 4 deletions

View File

@ -492,6 +492,14 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
return; return;
} }
if (is(businessObject, 'bpmn:DataInput') || is(businessObject, 'bpmn:DataOutput')) {
// already in correct ioSpecification
if ('ioSpecification' in newParent && newParent.ioSpecification === businessObject.$parent) {
return;
}
}
if (is(businessObject, 'bpmn:Lane')) { if (is(businessObject, 'bpmn:Lane')) {
if (newParent) { if (newParent) {

View File

@ -0,0 +1,74 @@
<semantic:definitions xmlns:semantic="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:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="_af3cbf6a-9c69-460b-9a1d-276711d30213" targetNamespace="http://www.trisotech.com/definitions/_af3cbf6a-9c69-460b-9a1d-276711d30213" expressionLanguage="http://www.w3.org/1999/XPath" exporter="BPMN Modeler" exporterVersion="6.1.22" name="Travel Booking with Event Subprocess">
<semantic:process id="_898aa942-9a96-4405-ae71-22b5e2e3d235" name="Simple Travel Booking" isClosed="false">
<semantic:ioSpecification>
<semantic:dataInput name="Input" isCollection="false" id="DataInput"/>
<semantic:dataOutput name="Output" isCollection="false" id="DataOutput"/>
<semantic:inputSet id="_9f9aea93-30cd-4899-bbe1-e62165c3dbc9">
<semantic:dataInputRefs>DataInput</semantic:dataInputRefs>
</semantic:inputSet>
<semantic:outputSet id="_8154d47e-5733-41c1-8125-29ff926b3cd2">
<semantic:dataOutputRefs>DataOutput</semantic:dataOutputRefs>
</semantic:outputSet>
</semantic:ioSpecification>
<semantic:sendTask id="Task" name="Process Data" implementation="##WebService">
<semantic:ioSpecification>
<semantic:dataInput id="_9628422b-85a6-4857-8c14-7289b9fd9a8a"/>
<semantic:dataOutput id="_29b8c649-e2a0-4dd3-804b-567e8cc71718"/>
<semantic:inputSet id="_1957232b-478c-49d4-b3a7-86da323a1629">
<semantic:dataInputRefs>_9628422b-85a6-4857-8c14-7289b9fd9a8a</semantic:dataInputRefs>
</semantic:inputSet>
<semantic:outputSet id="_eb462f09-2a8c-43fb-b398-09da73357dde">
<semantic:dataOutputRefs>_29b8c649-e2a0-4dd3-804b-567e8cc71718</semantic:dataOutputRefs>
</semantic:outputSet>
</semantic:ioSpecification>
<semantic:dataInputAssociation id="_82006a49-2cc8-4814-83e2-28c5a85a4c4a">
<semantic:sourceRef>DataInput</semantic:sourceRef>
<semantic:targetRef>_9628422b-85a6-4857-8c14-7289b9fd9a8a</semantic:targetRef>
</semantic:dataInputAssociation>
<semantic:dataOutputAssociation id="_ef945053-2c76-4796-8d8b-afc6be8bbfec">
<semantic:sourceRef>_29b8c649-e2a0-4dd3-804b-567e8cc71718</semantic:sourceRef>
<semantic:targetRef>DataOutput</semantic:targetRef>
</semantic:dataOutputAssociation>
</semantic:sendTask>
</semantic:process>
<bpmndi:BPMNDiagram id="_f1aecfc3-a3da-4bde-bece-87786e25273d" name="Simple Travel Booking">
<bpmndi:BPMNPlane bpmnElement="_898aa942-9a96-4405-ae71-22b5e2e3d235" id="_f1aecfc3-a3da-4bde-bece-87786e25273d_plane">
<bpmndi:BPMNShape id="DataOutput_di" bpmnElement="DataOutput">
<dc:Bounds x="285" y="150" width="34" height="40"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds height="12" width="30" x="285" y="195"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataInput_di" bpmnElement="DataInput">
<dc:Bounds x="100" y="100" width="34" height="40"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds height="12" width="30" x="100" y="150"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_8eb52f6a-0fd6-4fad-8ade-14bca1b066bf" bpmnElement="Task">
<dc:Bounds x="167" y="200" width="96" height="76"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds height="26" width="89" x="170.5" y="261.9739767206677"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="_fa1439cb-56e1-4399-bfe8-638b37a16866" bpmnElement="_82006a49-2cc8-4814-83e2-28c5a85a4c4a" targetElement="_8eb52f6a-0fd6-4fad-8ade-14bca1b066bf">
<di:waypoint x="135" y="113.99809778522484"/>
<di:waypoint x="215" y="113.99809778522484"/>
<di:waypoint x="215" y="200"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="_9f83d262-8e6a-47f5-84b3-86f560fbfcec" bpmnElement="_ef945053-2c76-4796-8d8b-afc6be8bbfec" sourceElement="Task">
<di:waypoint x="230" y="200"/>
<di:waypoint x="230" y="170"/>
<di:waypoint x="285" y="170"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
<bpmndi:BPMNLabelStyle id="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_0">
<dc:Font name="Arial" size="11" isBold="false" isItalic="false" isStrikeThrough="false" isUnderline="false"/>
</bpmndi:BPMNLabelStyle>
<bpmndi:BPMNLabelStyle id="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Font name="arial,helvetica,sans-serif" size="11" isBold="false" isItalic="false" isStrikeThrough="false" isUnderline="false"/>
</bpmndi:BPMNLabelStyle>
</bpmndi:BPMNDiagram>
</semantic:definitions>

View File

@ -9,7 +9,7 @@ import coreModule from 'lib/core';
describe('features/modeling - move elements', function() { describe('features/modeling - move elements', function() {
describe('should keep flow parent', function() { describe('flow parent', function() {
var diagramXML = require('./MoveElements.flow-collaboration.bpmn'); var diagramXML = require('./MoveElements.flow-collaboration.bpmn');
@ -21,7 +21,7 @@ describe('features/modeling - move elements', function() {
})); }));
it('when moving shapes', inject(function(elementRegistry, modeling, bpmnFactory) { it('should keep when moving shapes', inject(function(elementRegistry, modeling, bpmnFactory) {
// given // given
var connectionSequenceFlow = elementRegistry.get('SequenceFlow'), var connectionSequenceFlow = elementRegistry.get('SequenceFlow'),
@ -44,7 +44,7 @@ describe('features/modeling - move elements', function() {
})); }));
it('when moving shapes with flow', inject(function(elementRegistry, modeling, bpmnFactory) { it('should keep when moving shapes with flow', inject(function(elementRegistry, modeling, bpmnFactory) {
// given // given
var connectionSequenceFlow = elementRegistry.get('SequenceFlow'), var connectionSequenceFlow = elementRegistry.get('SequenceFlow'),
@ -69,7 +69,7 @@ describe('features/modeling - move elements', function() {
}); });
describe('should move boundary connection with tasks', function() { describe('boundary connection with tasks', function() {
var diagramXML = require('./MoveElements.boundary-connection.bpmn'); var diagramXML = require('./MoveElements.boundary-connection.bpmn');
@ -105,6 +105,57 @@ describe('features/modeling - move elements', function() {
}); });
describe('data input / data output', function() {
var diagramXML = require('./MoveElements.data-input-output.bpmn');
beforeEach(bootstrapModeler(diagramXML, {
modules: [
coreModule,
modelingModule
]
}));
it('should move', inject(function(elementRegistry, modeling) {
// given
var dataInput = elementRegistry.get('DataInput');
var dataOutput = elementRegistry.get('DataOutput');
var elements = [
dataInput,
dataOutput,
elementRegistry.get('Task')
];
// when
modeling.moveElements(
elements,
{ x: -10, y: -10 }
);
// then
expect(dataOutput).to.have.bounds({
x: 275,
y: 140,
width: 34,
height: 40
});
expect(dataInput).to.have.bounds({
x: 90,
y: 90,
width: 34,
height: 40
});
}));
});
}); });