2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
filter,
|
|
|
|
find,
|
|
|
|
forEach
|
|
|
|
} from 'min-dash';
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import Refs from 'object-refs';
|
2014-07-16 14:15:23 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
elementToString
|
|
|
|
} from './Util';
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2018-04-23 06:52:35 +00:00
|
|
|
// TODO: should be configurable: true as well which would allow to remove binding
|
2014-07-16 14:15:23 +00:00
|
|
|
var diRefs = new Refs({ name: 'bpmnElement', enumerable: true }, { name: 'di' });
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2015-02-17 09:55:28 +00:00
|
|
|
/**
|
|
|
|
* Returns true if an element has the given meta-model type
|
|
|
|
*
|
|
|
|
* @param {ModdleElement} element
|
|
|
|
* @param {String} type
|
|
|
|
*
|
|
|
|
* @return {Boolean}
|
|
|
|
*/
|
|
|
|
function is(element, type) {
|
|
|
|
return element.$instanceOf(type);
|
|
|
|
}
|
|
|
|
|
2014-10-28 14:09:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Find a suitable display candidate for definitions where the DI does not
|
|
|
|
* correctly specify one.
|
|
|
|
*/
|
|
|
|
function findDisplayCandidate(definitions) {
|
2015-02-02 13:46:21 +00:00
|
|
|
return find(definitions.rootElements, function(e) {
|
2015-02-17 09:55:28 +00:00
|
|
|
return is(e, 'bpmn:Process') || is(e, 'bpmn:Collaboration');
|
2014-10-28 14:09:17 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
export default function BpmnTreeWalker(handler, translate) {
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2014-03-22 00:47:03 +00:00
|
|
|
// list of containers already walked
|
2015-08-25 13:45:44 +00:00
|
|
|
var handledElements = {};
|
2014-03-22 00:47:03 +00:00
|
|
|
|
2014-07-23 16:53:04 +00:00
|
|
|
// list of elements to handle deferred to ensure
|
|
|
|
// prerequisites are drawn
|
|
|
|
var deferred = [];
|
|
|
|
|
2018-02-27 08:57:22 +00:00
|
|
|
// Helpers //////////////////////
|
2014-03-13 15:06:30 +00:00
|
|
|
|
|
|
|
function contextual(fn, ctx) {
|
|
|
|
return function(e) {
|
|
|
|
fn(e, ctx);
|
|
|
|
};
|
|
|
|
}
|
2014-04-28 09:09:47 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
function handled(element) {
|
|
|
|
handledElements[element.id] = element;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isHandled(element) {
|
|
|
|
return handledElements[element.id];
|
|
|
|
}
|
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
function visit(element, ctx) {
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var gfx = element.gfx;
|
2014-03-22 00:47:03 +00:00
|
|
|
|
|
|
|
// avoid multiple rendering of elements
|
|
|
|
if (gfx) {
|
2016-02-25 16:40:56 +00:00
|
|
|
throw new Error(
|
|
|
|
translate('already rendered {element}', { element: elementToString(element) })
|
|
|
|
);
|
2014-03-22 00:47:03 +00:00
|
|
|
}
|
|
|
|
|
2014-03-21 15:46:56 +00:00
|
|
|
// call handler
|
2014-07-16 14:15:23 +00:00
|
|
|
return handler.element(element, ctx);
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
2014-07-01 09:33:28 +00:00
|
|
|
function visitRoot(element, diagram) {
|
|
|
|
return handler.root(element, diagram);
|
|
|
|
}
|
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
function visitIfDi(element, ctx) {
|
2015-08-25 13:45:44 +00:00
|
|
|
|
2014-07-23 16:53:04 +00:00
|
|
|
try {
|
2015-08-25 13:45:44 +00:00
|
|
|
var gfx = element.di && visit(element, ctx);
|
|
|
|
|
|
|
|
handled(element);
|
|
|
|
|
|
|
|
return gfx;
|
2014-07-23 16:53:04 +00:00
|
|
|
} catch (e) {
|
|
|
|
logError(e.message, { element: element, error: e });
|
2014-12-09 17:32:34 +00:00
|
|
|
|
2016-02-25 16:40:56 +00:00
|
|
|
console.error(translate('failed to import {element}', { element: elementToString(element) }));
|
2014-12-09 17:32:34 +00:00
|
|
|
console.error(e);
|
2014-03-13 19:21:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-21 15:46:56 +00:00
|
|
|
function logError(message, context) {
|
|
|
|
handler.error(message, context);
|
|
|
|
}
|
2014-03-13 19:21:42 +00:00
|
|
|
|
2018-02-27 08:57:22 +00:00
|
|
|
// DI handling //////////////////////
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
function registerDi(di) {
|
|
|
|
var bpmnElement = di.bpmnElement;
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2014-03-21 15:46:56 +00:00
|
|
|
if (bpmnElement) {
|
2014-11-26 19:54:52 +00:00
|
|
|
if (bpmnElement.di) {
|
2016-02-25 16:40:56 +00:00
|
|
|
logError(
|
|
|
|
translate('multiple DI elements defined for {element}', {
|
|
|
|
element: elementToString(bpmnElement)
|
|
|
|
}),
|
2018-02-27 09:08:31 +00:00
|
|
|
{ element: bpmnElement }
|
2016-02-25 16:40:56 +00:00
|
|
|
);
|
2014-11-26 19:54:52 +00:00
|
|
|
} else {
|
|
|
|
diRefs.bind(bpmnElement, 'di');
|
|
|
|
bpmnElement.di = di;
|
|
|
|
}
|
2014-03-21 15:46:56 +00:00
|
|
|
} else {
|
2016-02-25 16:40:56 +00:00
|
|
|
logError(
|
|
|
|
translate('no bpmnElement referenced in {element}', {
|
|
|
|
element: elementToString(di)
|
|
|
|
}),
|
|
|
|
{ element: di }
|
|
|
|
);
|
2014-03-21 15:46:56 +00:00
|
|
|
}
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function handleDiagram(diagram) {
|
|
|
|
handlePlane(diagram.plane);
|
|
|
|
}
|
|
|
|
|
|
|
|
function handlePlane(plane) {
|
|
|
|
registerDi(plane);
|
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(plane.planeElement, handlePlaneElement);
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function handlePlaneElement(planeElement) {
|
|
|
|
registerDi(planeElement);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-27 08:57:22 +00:00
|
|
|
// Semantic handling //////////////////////
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2015-11-24 11:53:18 +00:00
|
|
|
/**
|
|
|
|
* Handle definitions and return the rendered diagram (if any)
|
|
|
|
*
|
|
|
|
* @param {ModdleElement} definitions to walk and import
|
|
|
|
* @param {ModdleElement} [diagram] specific diagram to import and display
|
|
|
|
*
|
|
|
|
* @throws {Error} if no diagram to display could be found
|
|
|
|
*/
|
2014-03-13 15:06:30 +00:00
|
|
|
function handleDefinitions(definitions, diagram) {
|
|
|
|
// make sure we walk the correct bpmnElement
|
2014-04-28 09:09:47 +00:00
|
|
|
|
2014-03-13 15:06:30 +00:00
|
|
|
var diagrams = definitions.diagrams;
|
|
|
|
|
|
|
|
if (diagram && diagrams.indexOf(diagram) === -1) {
|
2016-02-25 16:40:56 +00:00
|
|
|
throw new Error(translate('diagram not part of bpmn:Definitions'));
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
2014-07-01 09:33:28 +00:00
|
|
|
if (!diagram && diagrams && diagrams.length) {
|
|
|
|
diagram = diagrams[0];
|
2014-03-17 10:11:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// no diagram -> nothing to import
|
|
|
|
if (!diagram) {
|
2016-02-25 16:40:56 +00:00
|
|
|
throw new Error(translate('no diagram to display'));
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-22 00:47:03 +00:00
|
|
|
// load DI from selected diagram only
|
|
|
|
handleDiagram(diagram);
|
|
|
|
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2014-10-28 14:09:17 +00:00
|
|
|
var plane = diagram.plane;
|
|
|
|
|
|
|
|
if (!plane) {
|
2016-02-25 16:40:56 +00:00
|
|
|
throw new Error(translate(
|
|
|
|
'no plane for {element}',
|
|
|
|
{ element: elementToString(diagram) }
|
|
|
|
));
|
2014-10-28 14:09:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var rootElement = plane.bpmnElement;
|
|
|
|
|
|
|
|
// ensure we default to a suitable display candidate (process or collaboration),
|
|
|
|
// even if non is specified in DI
|
2014-05-23 14:31:28 +00:00
|
|
|
if (!rootElement) {
|
2014-10-28 14:09:17 +00:00
|
|
|
rootElement = findDisplayCandidate(definitions);
|
|
|
|
|
|
|
|
if (!rootElement) {
|
2016-02-25 16:40:56 +00:00
|
|
|
throw new Error(translate('no process or collaboration to display'));
|
2014-10-28 14:09:17 +00:00
|
|
|
} else {
|
|
|
|
|
2016-02-25 16:40:56 +00:00
|
|
|
logError(
|
|
|
|
translate('correcting missing bpmnElement on {plane} to {rootElement}', {
|
|
|
|
plane: elementToString(plane),
|
|
|
|
rootElement: elementToString(rootElement)
|
|
|
|
})
|
|
|
|
);
|
2014-10-28 14:09:17 +00:00
|
|
|
|
|
|
|
// correct DI on the fly
|
|
|
|
plane.bpmnElement = rootElement;
|
|
|
|
registerDi(plane);
|
|
|
|
}
|
2014-05-23 14:31:28 +00:00
|
|
|
}
|
|
|
|
|
2014-07-01 09:33:28 +00:00
|
|
|
|
|
|
|
var ctx = visitRoot(rootElement, plane);
|
|
|
|
|
2014-03-13 15:06:30 +00:00
|
|
|
if (is(rootElement, 'bpmn:Process')) {
|
2014-07-01 09:33:28 +00:00
|
|
|
handleProcess(rootElement, ctx);
|
2014-07-15 10:43:30 +00:00
|
|
|
} else if (is(rootElement, 'bpmn:Collaboration')) {
|
2014-07-01 09:33:28 +00:00
|
|
|
handleCollaboration(rootElement, ctx);
|
2014-03-22 00:47:03 +00:00
|
|
|
|
|
|
|
// force drawing of everything not yet drawn that is part of the target DI
|
2014-07-01 09:33:28 +00:00
|
|
|
handleUnhandledProcesses(definitions.rootElements, ctx);
|
2014-03-13 15:06:30 +00:00
|
|
|
} else {
|
2016-02-25 16:40:56 +00:00
|
|
|
throw new Error(
|
|
|
|
translate('unsupported bpmnElement for {plane}: {rootElement}', {
|
|
|
|
plane: elementToString(plane),
|
|
|
|
rootElement: elementToString(rootElement)
|
|
|
|
})
|
|
|
|
);
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
2014-07-23 16:53:04 +00:00
|
|
|
|
|
|
|
// handle all deferred elements
|
|
|
|
handleDeferred(deferred);
|
|
|
|
}
|
|
|
|
|
2018-04-23 06:52:35 +00:00
|
|
|
function handleDeferred() {
|
2017-11-13 10:11:07 +00:00
|
|
|
|
|
|
|
var fn;
|
|
|
|
|
|
|
|
// drain deferred until empty
|
|
|
|
while (deferred.length) {
|
|
|
|
fn = deferred.shift();
|
|
|
|
|
|
|
|
fn();
|
|
|
|
}
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
2014-07-15 10:43:30 +00:00
|
|
|
function handleProcess(process, context) {
|
|
|
|
handleFlowElementsContainer(process, context);
|
|
|
|
handleIoSpecification(process.ioSpecification, context);
|
|
|
|
|
|
|
|
handleArtifacts(process.artifacts, context);
|
|
|
|
|
|
|
|
// log process handled
|
2015-08-25 13:45:44 +00:00
|
|
|
handled(process);
|
2014-07-15 10:43:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-22 00:47:03 +00:00
|
|
|
function handleUnhandledProcesses(rootElements) {
|
|
|
|
|
|
|
|
// walk through all processes that have not yet been drawn and draw them
|
2014-07-01 09:33:28 +00:00
|
|
|
// if they contain lanes with DI information.
|
|
|
|
// we do this to pass the free-floating lane test cases in the MIWG test suite
|
2015-02-02 13:46:21 +00:00
|
|
|
var processes = filter(rootElements, function(e) {
|
2015-08-25 13:45:44 +00:00
|
|
|
return !isHandled(e) && is(e, 'bpmn:Process') && e.laneSets;
|
2014-03-22 00:47:03 +00:00
|
|
|
});
|
2014-07-01 09:33:28 +00:00
|
|
|
|
2014-03-22 00:47:03 +00:00
|
|
|
processes.forEach(contextual(handleProcess));
|
|
|
|
}
|
|
|
|
|
2014-07-15 10:43:30 +00:00
|
|
|
function handleMessageFlow(messageFlow, context) {
|
|
|
|
visitIfDi(messageFlow, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleMessageFlows(messageFlows, context) {
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(messageFlows, contextual(handleMessageFlow, context));
|
2014-07-15 10:43:30 +00:00
|
|
|
}
|
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
function handleDataAssociation(association, context) {
|
|
|
|
visitIfDi(association, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleDataInput(dataInput, context) {
|
|
|
|
visitIfDi(dataInput, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleDataOutput(dataOutput, context) {
|
|
|
|
visitIfDi(dataOutput, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleArtifact(artifact, context) {
|
|
|
|
|
|
|
|
// bpmn:TextAnnotation
|
|
|
|
// bpmn:Group
|
|
|
|
// bpmn:Association
|
2014-04-28 09:09:47 +00:00
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
visitIfDi(artifact, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleArtifacts(artifacts, context) {
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(artifacts, function(e) {
|
2014-10-31 14:05:16 +00:00
|
|
|
if (is(e, 'bpmn:Association')) {
|
|
|
|
deferred.push(function() {
|
|
|
|
handleArtifact(e, context);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
handleArtifact(e, context);
|
|
|
|
}
|
|
|
|
});
|
2014-03-13 19:21:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function handleIoSpecification(ioSpecification, context) {
|
2014-04-28 09:09:47 +00:00
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
if (!ioSpecification) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(ioSpecification.dataInputs, contextual(handleDataInput, context));
|
|
|
|
forEach(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
|
2014-03-13 19:21:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function handleSubProcess(subProcess, context) {
|
|
|
|
handleFlowElementsContainer(subProcess, context);
|
|
|
|
handleArtifacts(subProcess.artifacts, context);
|
|
|
|
}
|
|
|
|
|
2014-03-13 15:06:30 +00:00
|
|
|
function handleFlowNode(flowNode, context) {
|
2014-03-13 19:21:42 +00:00
|
|
|
var childCtx = visitIfDi(flowNode, context);
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
if (is(flowNode, 'bpmn:SubProcess')) {
|
|
|
|
handleSubProcess(flowNode, childCtx || context);
|
|
|
|
}
|
2015-08-25 13:45:44 +00:00
|
|
|
|
|
|
|
if (is(flowNode, 'bpmn:Activity')) {
|
|
|
|
handleIoSpecification(flowNode.ioSpecification, context);
|
|
|
|
}
|
2016-01-21 14:18:09 +00:00
|
|
|
|
|
|
|
// defer handling of associations
|
|
|
|
// affected types:
|
|
|
|
//
|
|
|
|
// * bpmn:Activity
|
|
|
|
// * bpmn:ThrowEvent
|
|
|
|
// * bpmn:CatchEvent
|
|
|
|
//
|
|
|
|
deferred.push(function() {
|
|
|
|
forEach(flowNode.dataInputAssociations, contextual(handleDataAssociation, context));
|
|
|
|
forEach(flowNode.dataOutputAssociations, contextual(handleDataAssociation, context));
|
|
|
|
});
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function handleSequenceFlow(sequenceFlow, context) {
|
2014-03-13 19:21:42 +00:00
|
|
|
visitIfDi(sequenceFlow, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleDataElement(dataObject, context) {
|
|
|
|
visitIfDi(dataObject, context);
|
|
|
|
}
|
|
|
|
|
2014-07-23 16:53:04 +00:00
|
|
|
function handleBoundaryEvent(dataObject, context) {
|
2014-07-15 10:43:30 +00:00
|
|
|
visitIfDi(dataObject, context);
|
|
|
|
}
|
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
function handleLane(lane, context) {
|
|
|
|
|
2017-11-13 10:11:07 +00:00
|
|
|
deferred.push(function() {
|
|
|
|
|
|
|
|
var newContext = visitIfDi(lane, context);
|
2015-10-15 21:49:52 +00:00
|
|
|
|
2017-11-13 10:11:07 +00:00
|
|
|
if (lane.childLaneSet) {
|
|
|
|
handleLaneSet(lane.childLaneSet, newContext || context);
|
|
|
|
}
|
|
|
|
|
|
|
|
wireFlowNodeRefs(lane);
|
|
|
|
});
|
2014-03-13 19:21:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function handleLaneSet(laneSet, context) {
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(laneSet.lanes, contextual(handleLane, context));
|
2014-03-13 19:21:42 +00:00
|
|
|
}
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
function handleLaneSets(laneSets, context) {
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(laneSets, contextual(handleLaneSet, context));
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function handleFlowElementsContainer(container, context) {
|
2017-11-13 10:11:07 +00:00
|
|
|
handleFlowElements(container.flowElements, context);
|
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
if (container.laneSets) {
|
|
|
|
handleLaneSets(container.laneSets, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleFlowElements(flowElements, context) {
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(flowElements, function(e) {
|
2014-03-13 15:06:30 +00:00
|
|
|
if (is(e, 'bpmn:SequenceFlow')) {
|
2014-07-23 16:53:04 +00:00
|
|
|
deferred.push(function() {
|
|
|
|
handleSequenceFlow(e, context);
|
|
|
|
});
|
2014-07-15 10:43:30 +00:00
|
|
|
} else if (is(e, 'bpmn:BoundaryEvent')) {
|
2014-07-23 16:53:04 +00:00
|
|
|
deferred.unshift(function() {
|
|
|
|
handleBoundaryEvent(e, context);
|
|
|
|
});
|
2014-07-15 10:43:30 +00:00
|
|
|
} else if (is(e, 'bpmn:FlowNode')) {
|
2014-03-13 15:06:30 +00:00
|
|
|
handleFlowNode(e, context);
|
2014-07-15 10:43:30 +00:00
|
|
|
} else if (is(e, 'bpmn:DataObject')) {
|
2014-03-13 19:21:42 +00:00
|
|
|
// SKIP (assume correct referencing via DataObjectReference)
|
2014-07-15 10:43:30 +00:00
|
|
|
} else if (is(e, 'bpmn:DataStoreReference')) {
|
2014-03-13 19:21:42 +00:00
|
|
|
handleDataElement(e, context);
|
2014-07-15 10:43:30 +00:00
|
|
|
} else if (is(e, 'bpmn:DataObjectReference')) {
|
2014-03-13 19:21:42 +00:00
|
|
|
handleDataElement(e, context);
|
2014-03-13 15:06:30 +00:00
|
|
|
} else {
|
2014-06-23 12:44:03 +00:00
|
|
|
logError(
|
2016-02-25 16:40:56 +00:00
|
|
|
translate('unrecognized flowElement {element} in context {context}', {
|
|
|
|
element: elementToString(e),
|
|
|
|
context: (context ? elementToString(context.businessObject) : 'null')
|
|
|
|
}),
|
|
|
|
{ element: e, context: context }
|
|
|
|
);
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleParticipant(participant, context) {
|
2014-03-13 19:21:42 +00:00
|
|
|
var newCtx = visitIfDi(participant, context);
|
2014-03-13 15:06:30 +00:00
|
|
|
|
|
|
|
var process = participant.processRef;
|
|
|
|
if (process) {
|
2014-03-13 19:21:42 +00:00
|
|
|
handleProcess(process, newCtx || context);
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleCollaboration(collaboration) {
|
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(collaboration.participants, contextual(handleParticipant));
|
2014-03-13 15:06:30 +00:00
|
|
|
|
2014-03-13 19:21:42 +00:00
|
|
|
handleArtifacts(collaboration.artifacts);
|
|
|
|
|
2015-01-02 11:56:32 +00:00
|
|
|
// handle message flows latest in the process
|
|
|
|
deferred.push(function() {
|
|
|
|
handleMessageFlows(collaboration.messageFlows);
|
|
|
|
});
|
2014-03-13 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-15 21:49:52 +00:00
|
|
|
function wireFlowNodeRefs(lane) {
|
|
|
|
// wire the virtual flowNodeRefs <-> relationship
|
|
|
|
forEach(lane.flowNodeRef, function(flowNode) {
|
|
|
|
var lanes = flowNode.get('lanes');
|
|
|
|
|
|
|
|
if (lanes) {
|
|
|
|
lanes.push(lane);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-02-27 08:57:22 +00:00
|
|
|
// API //////////////////////
|
2014-04-28 09:09:47 +00:00
|
|
|
|
2014-03-13 15:06:30 +00:00
|
|
|
return {
|
2018-04-23 06:52:35 +00:00
|
|
|
handleDeferred: handleDeferred,
|
|
|
|
handleDefinitions: handleDefinitions,
|
|
|
|
handleSubProcess: handleSubProcess,
|
|
|
|
registerDi: registerDi
|
2014-03-13 15:06:30 +00:00
|
|
|
};
|
2018-04-02 19:01:53 +00:00
|
|
|
}
|