feat(import): add flowElements to participant
This changes the tree walker to add FlowElements directly to a participant, independent of their lane assignments.
This commit is contained in:
parent
a0a8b38c46
commit
523c10b5c6
|
@ -315,11 +315,6 @@ function BpmnTreeWalker(handler) {
|
|||
|
||||
if (lane.childLaneSet) {
|
||||
handleLaneSet(lane.childLaneSet, newContext || context);
|
||||
} else {
|
||||
var filterList = filter(lane.flowNodeRef, function(e) {
|
||||
return e.$type !== 'bpmn:BoundaryEvent';
|
||||
});
|
||||
handleFlowElements(filterList, newContext || context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,40 +327,11 @@ function BpmnTreeWalker(handler) {
|
|||
}
|
||||
|
||||
function handleFlowElementsContainer(container, context) {
|
||||
|
||||
if (container.laneSets) {
|
||||
handleLaneSets(container.laneSets, context);
|
||||
handleNonFlowNodes(container.flowElements, context);
|
||||
} else {
|
||||
handleFlowElements(container.flowElements, context);
|
||||
}
|
||||
}
|
||||
|
||||
function handleNonFlowNodes(flowElements, context) {
|
||||
forEach(flowElements, function(e) {
|
||||
|
||||
if (isHandled(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is(e, 'bpmn:SequenceFlow')) {
|
||||
deferred.push(function() {
|
||||
handleSequenceFlow(e, context);
|
||||
});
|
||||
} else if (is(e, 'bpmn:BoundaryEvent')) {
|
||||
deferred.unshift(function() {
|
||||
handleBoundaryEvent(e, context);
|
||||
});
|
||||
} else if (is(e, 'bpmn:FlowNode')) {
|
||||
handleFlowNode(e, context);
|
||||
} else if (is(e, 'bpmn:DataObject')) {
|
||||
// SKIP (assume correct referencing via DataObjectReference)
|
||||
} else if (is(e, 'bpmn:DataStoreReference')) {
|
||||
handleDataElement(e, context);
|
||||
} else if (is(e, 'bpmn:DataObjectReference')) {
|
||||
handleDataElement(e, context);
|
||||
}
|
||||
});
|
||||
handleFlowElements(container.flowElements, context);
|
||||
}
|
||||
|
||||
function handleFlowElements(flowElements, context) {
|
||||
|
|
|
@ -252,7 +252,7 @@ describe('import - Importer', function() {
|
|||
// when
|
||||
runImport(diagram, xml, function(err, warnings) {
|
||||
|
||||
expect(warnings.length).to.equal(1);
|
||||
expect(warnings.length).to.equal(0);
|
||||
|
||||
done(err);
|
||||
});
|
||||
|
|
|
@ -144,16 +144,15 @@ describe('import - model wiring', function() {
|
|||
beforeEach(bootstrapViewer(xml));
|
||||
|
||||
|
||||
it('should wire parent child relationship', inject(function(elementRegistry) {
|
||||
it('should import flowElements as children of Participant', inject(function(elementRegistry) {
|
||||
|
||||
// when
|
||||
var laneShape = elementRegistry.get('Lane'),
|
||||
participantShape = elementRegistry.get('Participant_Lane'),
|
||||
var participantShape = elementRegistry.get('Participant_Lane'),
|
||||
taskShape = elementRegistry.get('Task'),
|
||||
sequenceFlowElement = elementRegistry.get('SequenceFlow');
|
||||
|
||||
// then
|
||||
expect(taskShape.parent).to.eql(laneShape);
|
||||
expect(taskShape.parent).to.eql(participantShape);
|
||||
expect(sequenceFlowElement.parent).to.eql(participantShape);
|
||||
}));
|
||||
|
||||
|
@ -167,7 +166,7 @@ describe('import - model wiring', function() {
|
|||
beforeEach(bootstrapViewer(xml));
|
||||
|
||||
|
||||
it('should wire parent child relationship', inject(function(elementRegistry) {
|
||||
it('should import flowElements as children of Participant', inject(function(elementRegistry) {
|
||||
|
||||
// when
|
||||
var participantShape = elementRegistry.get('Participant_Lane'),
|
||||
|
|
Loading…
Reference in New Issue