feat(modeling): add message flow modeling

Related to #199
Closes #201
This commit is contained in:
Nico Rehwaldt
2015-04-16 09:11:04 +02:00
committed by Ricardo Matias
parent 6011de1c4a
commit c14a87e5ad
21 changed files with 1114 additions and 647 deletions

View File

@ -0,0 +1,56 @@
'use strict';
var find = require('lodash/collection/find');
function getParents(element) {
var parents = [];
while (element) {
element = element.parent;
if (element) {
parents.push(element);
}
}
return parents;
}
module.exports.getParents = getParents;
function getSharedParent(a, b) {
var parentsA = getParents(a),
parentsB = getParents(b);
return find(parentsA, function(parent) {
return parentsB.indexOf(parent) !== -1;
});
}
module.exports.getSharedParent = getSharedParent;
/**
* Is an element of the given BPMN type?
*
* @param {djs.model.Base|ModdleElement} element
* @param {String} type
* @return {Boolean}
*/
function is(element, type) {
var bo = getBusinessObject(element);
return bo && bo.$instanceOf(type);
}
module.exports.is = is;
function getBusinessObject(element) {
return (element && element.businessObject) || element;
}
module.exports.getBusinessObject = getBusinessObject;