Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
endEventShape,
dropPosition,
sequenceFlow
);
// then
// new incoming connection
expect(newShape.incoming.length).to.equal(1);
expect(newShape.incoming[0]).to.eql(sequenceFlow);
// no outgoing edges
expect(newShape.outgoing.length).to.equal(0);
// split target at insertion point
expect(sequenceFlow).to.have.waypoints(flatten([
originalWaypoints.slice(0, 1),
{ x: 322, y: 120 }
]));
}
));
initiator: allParticipants[0],
receiver: allParticipants[1]
};
if (hints && hints.sourceShape) {
let source = hints.sourceShape;
const precedingActivities = getConnectedElements(hints.sourceShape, 'incoming', isChoreoActivity);
if (isChoreoActivity(source) || precedingActivities.length === 1) {
// We reverse the participants roles compared to the previous activity.
const participants = isChoreoActivity(source) ? source.bandShapes : precedingActivities[0].bandShapes;
recommended.receiver = participants.find(p => isInitiating(p)).businessObject;
recommended.initiator = participants.find(p => !isInitiating(p)).businessObject;
} else if (precedingActivities.length > 1) {
// If there are more than two preceding activities, e.g., due to a join we select the most used participants.
const participants = flatten(precedingActivities.map(p => p.bandShapes.map(bs => bs.businessObject)));
const count = {};
participants.forEach(bo => {
count[bo.id] = (count[bo.id] || 0) + 1;
});
let list = allParticipants.map(bo => [bo, count[bo.id]]);
list.sort((a, b) => b[1] - a[1]);
recommended.initiator = list[0][0];
recommended.receiver = list[1][0];
}
}
return recommended;
}
function traverse(node) {
if (!node.flowElements) {
// A FlowElementContainer might not contain any elements so we have to check for undefined here.
return [];
}
const matches = node.flowElements.filter(fe => is(fe, type));
return matches.concat(flatten(
node.flowElements.filter(fe => is(fe, 'bpmn:FlowElementsContainer')).map(fc => traverse(fc))));
}
const found = flatten(choreos.map(choreo => traverse(choreo)));
function getAttachers(shapes) {
return flatten(map(shapes, function(s) {
return s.attachers || [];
}));
}
function getAttachers(shapes) {
return flatten(map(shapes, function(s) {
var attachers = [];
if (s.attachers) {
attachers = s.attachers;
}
else {
var bo = getBusinessObject(s);
var exitCriteria = bo.get('exitCriteria');
forEach(exitCriteria, function(criterion) {
attachers.push(criterion);
});
var entryCriteria = bo.get('entryCriteria');
forEach(entryCriteria, function(criterion) {
attachers.push(criterion);
var bo = element.businessObject || element;
context.businessObject = bo;
var changed = [];
if (element.businessObject) {
changed.push(element);
}
if (shape) {
changed.push(shape);
}
context.changed = flatten(changed);
};
function getAllDraggedElements(shapes) {
var allShapes = selfAndAllChildren(shapes, true);
var allConnections = map(allShapes, function(shape) {
return (shape.incoming || []).concat(shape.outgoing || []);
});
return flatten(allShapes.concat(allConnections));
}