2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
every,
|
2019-08-07 13:17:28 +00:00
|
|
|
find,
|
|
|
|
forEach,
|
|
|
|
some
|
2018-04-02 19:01:53 +00:00
|
|
|
} from 'min-dash';
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import inherits from 'inherits';
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
is,
|
|
|
|
getBusinessObject
|
|
|
|
} from '../../util/ModelUtil';
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import {
|
2019-08-06 16:57:30 +00:00
|
|
|
getParent,
|
2018-04-02 19:01:53 +00:00
|
|
|
isAny
|
|
|
|
} from '../modeling/util/ModelingUtil';
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2018-04-30 09:06:26 +00:00
|
|
|
import {
|
|
|
|
isLabel
|
|
|
|
} from '../../util/LabelUtil';
|
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
isExpanded,
|
|
|
|
isEventSubProcess,
|
|
|
|
isInterrupting,
|
|
|
|
hasErrorEventDefinition,
|
|
|
|
hasEscalationEventDefinition,
|
|
|
|
hasCompensateEventDefinition
|
|
|
|
} from '../../util/DiUtil';
|
|
|
|
|
|
|
|
import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider';
|
|
|
|
|
|
|
|
import {
|
|
|
|
getBoundaryAttachment as isBoundaryAttachment
|
|
|
|
} from '../snapping/BpmnSnappingUtil';
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
/**
|
|
|
|
* BPMN specific modeling rule
|
|
|
|
*/
|
2018-04-02 19:01:53 +00:00
|
|
|
export default function BpmnRules(eventBus) {
|
2015-04-16 07:11:04 +00:00
|
|
|
RuleProvider.call(this, eventBus);
|
|
|
|
}
|
|
|
|
|
|
|
|
inherits(BpmnRules, RuleProvider);
|
|
|
|
|
|
|
|
BpmnRules.$inject = [ 'eventBus' ];
|
|
|
|
|
|
|
|
BpmnRules.prototype.init = function() {
|
|
|
|
|
2018-10-10 15:26:03 +00:00
|
|
|
this.addRule('connection.start', function(context) {
|
|
|
|
var source = context.source;
|
|
|
|
|
|
|
|
return canStartConnection(source);
|
|
|
|
});
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
this.addRule('connection.create', function(context) {
|
|
|
|
var source = context.source,
|
2017-12-20 09:34:45 +00:00
|
|
|
target = context.target,
|
|
|
|
hints = context.hints || {},
|
|
|
|
targetParent = hints.targetParent,
|
|
|
|
targetAttach = hints.targetAttach;
|
|
|
|
|
|
|
|
// don't allow incoming connections on
|
|
|
|
// newly created boundary events
|
|
|
|
// to boundary events
|
|
|
|
if (targetAttach) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// temporarily set target parent for scoping
|
|
|
|
// checks to work
|
|
|
|
if (targetParent) {
|
|
|
|
target.parent = targetParent;
|
|
|
|
}
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
try {
|
|
|
|
return canConnect(source, target);
|
|
|
|
} finally {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
// unset temporary target parent
|
|
|
|
if (targetParent) {
|
|
|
|
target.parent = null;
|
|
|
|
}
|
|
|
|
}
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
2019-11-04 08:13:50 +00:00
|
|
|
this.addRule('connection.reconnect', function(context) {
|
|
|
|
|
|
|
|
var connection = context.connection,
|
|
|
|
source = context.source,
|
|
|
|
target = context.target;
|
|
|
|
|
|
|
|
return canConnect(source, target, connection);
|
|
|
|
});
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
this.addRule('connection.updateWaypoints', function(context) {
|
2019-05-27 14:13:38 +00:00
|
|
|
return {
|
|
|
|
type: context.connection.type
|
|
|
|
};
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
this.addRule('shape.resize', function(context) {
|
|
|
|
|
|
|
|
var shape = context.shape,
|
|
|
|
newBounds = context.newBounds;
|
|
|
|
|
|
|
|
return canResize(shape, newBounds);
|
|
|
|
});
|
|
|
|
|
2019-08-06 16:57:30 +00:00
|
|
|
this.addRule('elements.create', function(context) {
|
|
|
|
var elements = context.elements,
|
|
|
|
position = context.position,
|
|
|
|
target = context.target;
|
|
|
|
|
|
|
|
return every(elements, function(element) {
|
|
|
|
if (isConnection(element)) {
|
|
|
|
return canConnect(element.source, element.target, element);
|
|
|
|
}
|
|
|
|
|
2019-08-12 14:21:49 +00:00
|
|
|
if (element.host) {
|
|
|
|
return canAttach(element, element.host, null, position);
|
|
|
|
}
|
|
|
|
|
2019-08-06 16:57:30 +00:00
|
|
|
return canCreate(element, target, null, position);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2015-08-13 08:51:52 +00:00
|
|
|
this.addRule('elements.move', function(context) {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-03 14:00:41 +00:00
|
|
|
var target = context.target,
|
2015-08-06 07:40:58 +00:00
|
|
|
shapes = context.shapes,
|
|
|
|
position = context.position;
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-06-14 11:24:09 +00:00
|
|
|
return canAttach(shapes, target, null, position) ||
|
|
|
|
canReplace(shapes, target, position) ||
|
|
|
|
canMove(shapes, target, position) ||
|
|
|
|
canInsert(shapes, target, position);
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
this.addRule('shape.create', function(context) {
|
|
|
|
return canCreate(
|
|
|
|
context.shape,
|
|
|
|
context.target,
|
|
|
|
context.source,
|
|
|
|
context.position
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
this.addRule('shape.attach', function(context) {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
return canAttach(
|
|
|
|
context.shape,
|
|
|
|
context.target,
|
|
|
|
null,
|
|
|
|
context.position
|
|
|
|
);
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
2016-04-20 15:31:42 +00:00
|
|
|
this.addRule('element.copy', function(context) {
|
2019-08-07 13:17:28 +00:00
|
|
|
var element = context.element,
|
|
|
|
elements = context.elements;
|
2016-04-20 15:31:42 +00:00
|
|
|
|
2019-08-07 13:17:28 +00:00
|
|
|
return canCopy(elements, element);
|
2016-04-20 15:31:42 +00:00
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
BpmnRules.prototype.canConnectMessageFlow = canConnectMessageFlow;
|
|
|
|
|
|
|
|
BpmnRules.prototype.canConnectSequenceFlow = canConnectSequenceFlow;
|
|
|
|
|
2015-10-06 10:33:21 +00:00
|
|
|
BpmnRules.prototype.canConnectDataAssociation = canConnectDataAssociation;
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
BpmnRules.prototype.canConnectAssociation = canConnectAssociation;
|
|
|
|
|
|
|
|
BpmnRules.prototype.canMove = canMove;
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
BpmnRules.prototype.canAttach = canAttach;
|
|
|
|
|
2015-08-17 14:43:15 +00:00
|
|
|
BpmnRules.prototype.canReplace = canReplace;
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
BpmnRules.prototype.canDrop = canDrop;
|
|
|
|
|
2015-05-21 12:55:10 +00:00
|
|
|
BpmnRules.prototype.canInsert = canInsert;
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
BpmnRules.prototype.canCreate = canCreate;
|
|
|
|
|
|
|
|
BpmnRules.prototype.canConnect = canConnect;
|
|
|
|
|
|
|
|
BpmnRules.prototype.canResize = canResize;
|
|
|
|
|
2016-04-20 15:31:42 +00:00
|
|
|
BpmnRules.prototype.canCopy = canCopy;
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
/**
|
|
|
|
* Utility functions for rule checking
|
|
|
|
*/
|
|
|
|
|
2018-10-10 15:26:03 +00:00
|
|
|
/**
|
|
|
|
* Checks if given element can be used for starting connection.
|
|
|
|
*
|
|
|
|
* @param {Element} source
|
2020-04-06 08:26:04 +00:00
|
|
|
* @return {boolean}
|
2018-10-10 15:26:03 +00:00
|
|
|
*/
|
|
|
|
function canStartConnection(element) {
|
|
|
|
if (nonExistingOrLabel(element)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-11-21 08:37:38 +00:00
|
|
|
return isAny(element, [
|
2018-10-10 15:26:03 +00:00
|
|
|
'bpmn:FlowNode',
|
|
|
|
'bpmn:InteractionNode',
|
|
|
|
'bpmn:DataObjectReference',
|
2020-06-05 08:35:24 +00:00
|
|
|
'bpmn:DataStoreReference',
|
2021-04-07 09:48:35 +00:00
|
|
|
'bpmn:Group',
|
|
|
|
'bpmn:TextAnnotation'
|
2018-10-10 15:26:03 +00:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
function nonExistingOrLabel(element) {
|
2015-04-16 07:11:04 +00:00
|
|
|
return !element || isLabel(element);
|
|
|
|
}
|
|
|
|
|
|
|
|
function isSame(a, b) {
|
|
|
|
return a === b;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getOrganizationalParent(element) {
|
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
do {
|
|
|
|
if (is(element, 'bpmn:Process')) {
|
|
|
|
return getBusinessObject(element);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
if (is(element, 'bpmn:Participant')) {
|
2018-04-12 17:34:47 +00:00
|
|
|
return (
|
|
|
|
getBusinessObject(element).processRef ||
|
|
|
|
getBusinessObject(element)
|
|
|
|
);
|
2017-12-20 09:34:45 +00:00
|
|
|
}
|
|
|
|
} while ((element = element.parent));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-01-21 13:19:59 +00:00
|
|
|
function isTextAnnotation(element) {
|
|
|
|
return is(element, 'bpmn:TextAnnotation');
|
|
|
|
}
|
|
|
|
|
2019-05-02 08:39:07 +00:00
|
|
|
function isGroup(element) {
|
2019-05-22 06:45:12 +00:00
|
|
|
return is(element, 'bpmn:Group') && !element.labelTarget;
|
2019-05-02 08:39:07 +00:00
|
|
|
}
|
|
|
|
|
2016-01-21 13:19:59 +00:00
|
|
|
function isCompensationBoundary(element) {
|
|
|
|
return is(element, 'bpmn:BoundaryEvent') &&
|
|
|
|
hasEventDefinition(element, 'bpmn:CompensateEventDefinition');
|
|
|
|
}
|
|
|
|
|
2016-01-20 17:30:34 +00:00
|
|
|
function isForCompensation(e) {
|
|
|
|
return getBusinessObject(e).isForCompensation;
|
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
function isSameOrganization(a, b) {
|
|
|
|
var parentA = getOrganizationalParent(a),
|
|
|
|
parentB = getOrganizationalParent(b);
|
|
|
|
|
|
|
|
return parentA === parentB;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isMessageFlowSource(element) {
|
2018-01-05 13:32:52 +00:00
|
|
|
return (
|
2020-06-22 13:56:12 +00:00
|
|
|
is(element, 'bpmn:InteractionNode') &&
|
|
|
|
!is(element, 'bpmn:BoundaryEvent') && (
|
2018-01-05 13:32:52 +00:00
|
|
|
!is(element, 'bpmn:Event') || (
|
|
|
|
is(element, 'bpmn:ThrowEvent') &&
|
|
|
|
hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')
|
|
|
|
)
|
|
|
|
)
|
2015-04-16 07:11:04 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function isMessageFlowTarget(element) {
|
2018-01-05 13:32:52 +00:00
|
|
|
return (
|
|
|
|
is(element, 'bpmn:InteractionNode') &&
|
|
|
|
!isForCompensation(element) && (
|
|
|
|
!is(element, 'bpmn:Event') || (
|
|
|
|
is(element, 'bpmn:CatchEvent') &&
|
|
|
|
hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')
|
|
|
|
)
|
2020-09-14 11:24:37 +00:00
|
|
|
) && !(
|
|
|
|
is(element, 'bpmn:BoundaryEvent') &&
|
|
|
|
!hasEventDefinition(element, 'bpmn:MessageEventDefinition')
|
2018-01-05 13:32:52 +00:00
|
|
|
)
|
2015-04-16 07:11:04 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getScopeParent(element) {
|
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
var parent = element;
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
while ((parent = parent.parent)) {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
if (is(parent, 'bpmn:FlowElementsContainer')) {
|
|
|
|
return getBusinessObject(parent);
|
|
|
|
}
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
if (is(parent, 'bpmn:Participant')) {
|
|
|
|
return getBusinessObject(parent).processRef;
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-20 09:34:45 +00:00
|
|
|
return null;
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function isSameScope(a, b) {
|
|
|
|
var scopeParentA = getScopeParent(a),
|
|
|
|
scopeParentB = getScopeParent(b);
|
|
|
|
|
2019-08-06 16:57:30 +00:00
|
|
|
return scopeParentA === scopeParentB;
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function hasEventDefinition(element, eventDefinition) {
|
|
|
|
var bo = getBusinessObject(element);
|
|
|
|
|
2015-05-11 15:55:06 +00:00
|
|
|
return !!find(bo.eventDefinitions || [], function(definition) {
|
|
|
|
return is(definition, eventDefinition);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function hasEventDefinitionOrNone(element, eventDefinition) {
|
|
|
|
var bo = getBusinessObject(element);
|
|
|
|
|
|
|
|
return (bo.eventDefinitions || []).every(function(definition) {
|
2015-04-16 07:11:04 +00:00
|
|
|
return is(definition, eventDefinition);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function isSequenceFlowSource(element) {
|
2018-01-05 13:32:52 +00:00
|
|
|
return (
|
|
|
|
is(element, 'bpmn:FlowNode') &&
|
|
|
|
!is(element, 'bpmn:EndEvent') &&
|
|
|
|
!isEventSubProcess(element) &&
|
|
|
|
!(is(element, 'bpmn:IntermediateThrowEvent') &&
|
|
|
|
hasEventDefinition(element, 'bpmn:LinkEventDefinition')
|
|
|
|
) &&
|
|
|
|
!isCompensationBoundary(element) &&
|
|
|
|
!isForCompensation(element)
|
|
|
|
);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function isSequenceFlowTarget(element) {
|
2018-01-05 13:32:52 +00:00
|
|
|
return (
|
|
|
|
is(element, 'bpmn:FlowNode') &&
|
|
|
|
!is(element, 'bpmn:StartEvent') &&
|
|
|
|
!is(element, 'bpmn:BoundaryEvent') &&
|
|
|
|
!isEventSubProcess(element) &&
|
|
|
|
!(is(element, 'bpmn:IntermediateCatchEvent') &&
|
|
|
|
hasEventDefinition(element, 'bpmn:LinkEventDefinition')
|
|
|
|
) &&
|
|
|
|
!isForCompensation(element)
|
|
|
|
);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function isEventBasedTarget(element) {
|
2018-01-05 13:32:52 +00:00
|
|
|
return (
|
|
|
|
is(element, 'bpmn:ReceiveTask') || (
|
|
|
|
is(element, 'bpmn:IntermediateCatchEvent') && (
|
|
|
|
hasEventDefinition(element, 'bpmn:MessageEventDefinition') ||
|
|
|
|
hasEventDefinition(element, 'bpmn:TimerEventDefinition') ||
|
|
|
|
hasEventDefinition(element, 'bpmn:ConditionalEventDefinition') ||
|
|
|
|
hasEventDefinition(element, 'bpmn:SignalEventDefinition')
|
|
|
|
)
|
|
|
|
)
|
2015-04-16 07:11:04 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function isConnection(element) {
|
|
|
|
return element.waypoints;
|
|
|
|
}
|
|
|
|
|
2016-12-06 13:49:45 +00:00
|
|
|
function getParents(element) {
|
|
|
|
|
|
|
|
var parents = [];
|
|
|
|
|
|
|
|
while (element) {
|
|
|
|
element = element.parent;
|
|
|
|
|
|
|
|
if (element) {
|
|
|
|
parents.push(element);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return parents;
|
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
function isParent(possibleParent, element) {
|
|
|
|
var allParents = getParents(element);
|
|
|
|
return allParents.indexOf(possibleParent) !== -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
function canConnect(source, target, connection) {
|
|
|
|
|
2018-10-10 15:26:03 +00:00
|
|
|
if (nonExistingOrLabel(source) || nonExistingOrLabel(target)) {
|
2015-04-16 07:11:04 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-01-21 13:19:59 +00:00
|
|
|
if (!is(connection, 'bpmn:DataAssociation')) {
|
|
|
|
|
|
|
|
if (canConnectMessageFlow(source, target)) {
|
|
|
|
return { type: 'bpmn:MessageFlow' };
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canConnectSequenceFlow(source, target)) {
|
|
|
|
return { type: 'bpmn:SequenceFlow' };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var connectDataAssociation = canConnectDataAssociation(source, target);
|
|
|
|
|
|
|
|
if (connectDataAssociation) {
|
|
|
|
return connectDataAssociation;
|
2015-10-06 10:33:21 +00:00
|
|
|
}
|
|
|
|
|
2016-01-21 13:19:59 +00:00
|
|
|
if (isCompensationBoundary(source) && isForCompensation(target)) {
|
|
|
|
return {
|
|
|
|
type: 'bpmn:Association',
|
|
|
|
associationDirection: 'One'
|
|
|
|
};
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
2017-04-10 12:21:14 +00:00
|
|
|
if (canConnectAssociation(source, target)) {
|
2016-01-21 13:19:59 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
type: 'bpmn:Association'
|
|
|
|
};
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can an element be dropped into the target element
|
|
|
|
*
|
2020-04-06 08:26:04 +00:00
|
|
|
* @return {boolean}
|
2015-04-16 07:11:04 +00:00
|
|
|
*/
|
2015-09-17 07:05:09 +00:00
|
|
|
function canDrop(element, target, position) {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-06-14 11:24:09 +00:00
|
|
|
// can move labels and groups everywhere
|
|
|
|
if (isLabel(element) || isGroup(element)) {
|
|
|
|
return true;
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
2019-06-14 11:24:09 +00:00
|
|
|
|
2016-03-08 16:21:41 +00:00
|
|
|
// disallow to create elements on collapsed pools
|
|
|
|
if (is(target, 'bpmn:Participant') && !isExpanded(target)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
// allow to create new participants on
|
2019-05-02 08:39:07 +00:00
|
|
|
// existing collaboration and process diagrams
|
2015-04-16 07:11:04 +00:00
|
|
|
if (is(element, 'bpmn:Participant')) {
|
|
|
|
return is(target, 'bpmn:Process') || is(target, 'bpmn:Collaboration');
|
|
|
|
}
|
|
|
|
|
2019-03-29 10:20:45 +00:00
|
|
|
// allow moving DataInput / DataOutput within its original container only
|
|
|
|
if (isAny(element, [ 'bpmn:DataInput', 'bpmn:DataOutput' ])) {
|
|
|
|
|
|
|
|
if (element.parent) {
|
|
|
|
return target === element.parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-11 12:46:17 +00:00
|
|
|
// allow creating lanes on participants and other lanes only
|
|
|
|
if (is(element, 'bpmn:Lane')) {
|
|
|
|
return is(target, 'bpmn:Participant') || is(target, 'bpmn:Lane');
|
|
|
|
}
|
|
|
|
|
2019-06-24 11:16:11 +00:00
|
|
|
// disallow dropping boundary events which cannot replace with intermediate event
|
|
|
|
if (is(element, 'bpmn:BoundaryEvent') && !isDroppableBoundaryEvent(element)) {
|
|
|
|
return false;
|
2015-07-13 08:37:43 +00:00
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
// drop flow elements onto flow element containers
|
|
|
|
// and participants
|
2018-05-03 14:02:41 +00:00
|
|
|
if (is(element, 'bpmn:FlowElement') && !is(element, 'bpmn:DataStoreReference')) {
|
2015-04-16 07:11:04 +00:00
|
|
|
if (is(target, 'bpmn:FlowElementsContainer')) {
|
2016-01-27 14:11:27 +00:00
|
|
|
return isExpanded(target);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
2015-10-21 14:25:56 +00:00
|
|
|
return isAny(target, [ 'bpmn:Participant', 'bpmn:Lane' ]);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
2016-12-06 13:49:45 +00:00
|
|
|
// account for the fact that data associations are always
|
|
|
|
// rendered and moved to top (Process or Collaboration level)
|
2016-12-19 14:57:34 +00:00
|
|
|
//
|
|
|
|
// artifacts may be placed wherever, too
|
2018-05-03 14:02:41 +00:00
|
|
|
if (isAny(element, [ 'bpmn:Artifact', 'bpmn:DataAssociation', 'bpmn:DataStoreReference' ])) {
|
2015-10-21 14:25:56 +00:00
|
|
|
return isAny(target, [
|
2016-06-07 06:46:45 +00:00
|
|
|
'bpmn:Collaboration',
|
|
|
|
'bpmn:Lane',
|
|
|
|
'bpmn:Participant',
|
|
|
|
'bpmn:Process',
|
|
|
|
'bpmn:SubProcess' ]);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
if (is(element, 'bpmn:MessageFlow')) {
|
2016-09-22 18:41:12 +00:00
|
|
|
return is(target, 'bpmn:Collaboration')
|
|
|
|
|| element.source.parent == target
|
|
|
|
|| element.target.parent == target;
|
2015-05-12 16:03:51 +00:00
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-06-24 11:16:11 +00:00
|
|
|
function isDroppableBoundaryEvent(event) {
|
|
|
|
return getBusinessObject(event).cancelActivity && (
|
|
|
|
hasNoEventDefinition(event) || hasCommonBoundaryIntermediateEventDefinition(event)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
function isBoundaryEvent(element) {
|
|
|
|
return !isLabel(element) && is(element, 'bpmn:BoundaryEvent');
|
|
|
|
}
|
|
|
|
|
2015-10-09 23:42:09 +00:00
|
|
|
function isLane(element) {
|
|
|
|
return is(element, 'bpmn:Lane');
|
|
|
|
}
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
/**
|
|
|
|
* We treat IntermediateThrowEvents as boundary events during create,
|
|
|
|
* this must be reflected in the rules.
|
|
|
|
*/
|
|
|
|
function isBoundaryCandidate(element) {
|
2019-05-22 08:42:07 +00:00
|
|
|
if (isBoundaryEvent(element)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is(element, 'bpmn:IntermediateThrowEvent') && hasNoEventDefinition(element)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
is(element, 'bpmn:IntermediateCatchEvent') &&
|
|
|
|
hasCommonBoundaryIntermediateEventDefinition(element)
|
|
|
|
);
|
2015-07-13 08:37:43 +00:00
|
|
|
}
|
|
|
|
|
2019-05-24 12:46:01 +00:00
|
|
|
function hasNoEventDefinition(element) {
|
|
|
|
var bo = getBusinessObject(element);
|
|
|
|
|
|
|
|
return bo && !(bo.eventDefinitions && bo.eventDefinitions.length);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hasCommonBoundaryIntermediateEventDefinition(element) {
|
|
|
|
return hasOneOfEventDefinitions(element, [
|
|
|
|
'bpmn:MessageEventDefinition',
|
|
|
|
'bpmn:TimerEventDefinition',
|
|
|
|
'bpmn:SignalEventDefinition',
|
|
|
|
'bpmn:ConditionalEventDefinition'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hasOneOfEventDefinitions(element, eventDefinitions) {
|
|
|
|
return eventDefinitions.some(function(definition) {
|
|
|
|
return hasEventDefinition(element, definition);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-10-16 09:07:28 +00:00
|
|
|
function isReceiveTaskAfterEventBasedGateway(element) {
|
|
|
|
return (
|
|
|
|
is(element, 'bpmn:ReceiveTask') &&
|
|
|
|
find(element.incoming, function(incoming) {
|
|
|
|
return is(incoming.source, 'bpmn:EventBasedGateway');
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
function canAttach(elements, target, source, position) {
|
2016-03-08 16:21:41 +00:00
|
|
|
|
2015-09-17 07:05:09 +00:00
|
|
|
if (!Array.isArray(elements)) {
|
|
|
|
elements = [ elements ];
|
|
|
|
}
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
// only (re-)attach one element at a time
|
|
|
|
if (elements.length !== 1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var element = elements[0];
|
|
|
|
|
|
|
|
// do not attach labels
|
|
|
|
if (isLabel(element)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// only handle boundary events
|
|
|
|
if (!isBoundaryCandidate(element)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-08-04 15:52:43 +00:00
|
|
|
// disallow drop on event sub processes
|
|
|
|
if (isEventSubProcess(target)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-20 17:30:34 +00:00
|
|
|
// only allow drop on non compensation activities
|
|
|
|
if (!is(target, 'bpmn:Activity') || isForCompensation(target)) {
|
2015-07-13 08:37:43 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// only attach to subprocess border
|
2015-08-06 07:40:58 +00:00
|
|
|
if (position && !isBoundaryAttachment(position, target)) {
|
2015-07-13 08:37:43 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-10-16 09:07:28 +00:00
|
|
|
// do not attach on receive tasks after event based gateways
|
|
|
|
if (isReceiveTaskAfterEventBasedGateway(target)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
return 'attach';
|
|
|
|
}
|
|
|
|
|
2015-08-17 14:43:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines how to replace elements for a given target.
|
|
|
|
*
|
|
|
|
* Returns an array containing all elements which will be replaced.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
*
|
|
|
|
* [{ id: 'IntermediateEvent_2',
|
|
|
|
* type: 'bpmn:StartEvent'
|
|
|
|
* },
|
|
|
|
* { id: 'IntermediateEvent_5',
|
|
|
|
* type: 'bpmn:EndEvent'
|
|
|
|
* }]
|
|
|
|
*
|
|
|
|
* @param {Array} elements
|
|
|
|
* @param {Object} target
|
|
|
|
*
|
|
|
|
* @return {Object} an object containing all elements which have to be replaced
|
|
|
|
*/
|
2015-09-17 07:05:09 +00:00
|
|
|
function canReplace(elements, target, position) {
|
2015-08-17 14:43:15 +00:00
|
|
|
|
|
|
|
if (!target) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var canExecute = {
|
2015-09-01 15:57:32 +00:00
|
|
|
replacements: []
|
2015-08-17 14:43:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
forEach(elements, function(element) {
|
|
|
|
|
|
|
|
if (!isEventSubProcess(target)) {
|
|
|
|
|
|
|
|
if (is(element, 'bpmn:StartEvent') &&
|
|
|
|
element.type !== 'label' &&
|
|
|
|
canDrop(element, target)) {
|
|
|
|
|
2016-11-09 10:45:12 +00:00
|
|
|
// replace a non-interrupting start event by a blank interrupting start event
|
|
|
|
// when the target is not an event sub process
|
|
|
|
if (!isInterrupting(element)) {
|
|
|
|
canExecute.replacements.push({
|
|
|
|
oldElementId: element.id,
|
|
|
|
newElementType: 'bpmn:StartEvent'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-09-09 10:21:33 +00:00
|
|
|
// replace an error/escalation/compensate start event by a blank interrupting start event
|
2016-11-09 10:45:12 +00:00
|
|
|
// when the target is not an event sub process
|
|
|
|
if (hasErrorEventDefinition(element) ||
|
|
|
|
hasEscalationEventDefinition(element) ||
|
|
|
|
hasCompensateEventDefinition(element)) {
|
|
|
|
canExecute.replacements.push({
|
|
|
|
oldElementId: element.id,
|
|
|
|
newElementType: 'bpmn:StartEvent'
|
|
|
|
});
|
|
|
|
}
|
2020-07-29 15:18:38 +00:00
|
|
|
|
|
|
|
// replace a typed start event by a blank interrupting start event
|
|
|
|
// when the target is a sub process but not an event sub process
|
|
|
|
if (hasOneOfEventDefinitions(element,
|
|
|
|
[
|
|
|
|
'bpmn:MessageEventDefinition',
|
|
|
|
'bpmn:TimerEventDefinition',
|
|
|
|
'bpmn:SignalEventDefinition',
|
|
|
|
'bpmn:ConditionalEventDefinition'
|
|
|
|
]) &&
|
|
|
|
is(target, 'bpmn:SubProcess')) {
|
|
|
|
canExecute.replacements.push({
|
|
|
|
oldElementId: element.id,
|
|
|
|
newElementType: 'bpmn:StartEvent'
|
|
|
|
});
|
|
|
|
}
|
2015-08-17 14:43:15 +00:00
|
|
|
}
|
|
|
|
}
|
2015-09-17 07:05:09 +00:00
|
|
|
|
|
|
|
if (!is(target, 'bpmn:Transaction')) {
|
|
|
|
if (hasEventDefinition(element, 'bpmn:CancelEventDefinition') &&
|
|
|
|
element.type !== 'label') {
|
|
|
|
|
|
|
|
if (is(element, 'bpmn:EndEvent') && canDrop(element, target)) {
|
|
|
|
canExecute.replacements.push({
|
|
|
|
oldElementId: element.id,
|
|
|
|
newElementType: 'bpmn:EndEvent'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is(element, 'bpmn:BoundaryEvent') && canAttach(element, target, null, position)) {
|
|
|
|
canExecute.replacements.push({
|
|
|
|
oldElementId: element.id,
|
|
|
|
newElementType: 'bpmn:BoundaryEvent'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-17 14:43:15 +00:00
|
|
|
});
|
|
|
|
|
2015-09-01 15:57:32 +00:00
|
|
|
return canExecute.replacements.length ? canExecute : false;
|
2015-08-17 14:43:15 +00:00
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
function canMove(elements, target) {
|
|
|
|
|
2015-10-09 23:42:09 +00:00
|
|
|
// do not move selection containing lanes
|
2018-03-22 09:22:37 +00:00
|
|
|
if (some(elements, isLane)) {
|
2015-10-09 23:42:09 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
// allow default move check to start move operation
|
2015-04-16 07:11:04 +00:00
|
|
|
if (!target) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-06-14 11:24:09 +00:00
|
|
|
return elements.every(function(element) {
|
|
|
|
return canDrop(element, target);
|
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
function canCreate(shape, target, source, position) {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
if (!target) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-07-22 11:53:45 +00:00
|
|
|
if (isLabel(shape) || isGroup(shape)) {
|
2019-06-14 11:24:09 +00:00
|
|
|
return true;
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isSame(source, target)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ensure we do not drop the element
|
|
|
|
// into source
|
|
|
|
if (source && isParent(source, target)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
return canDrop(shape, target, position) || canInsert(shape, target, position);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function canResize(shape, newBounds) {
|
|
|
|
if (is(shape, 'bpmn:SubProcess')) {
|
2018-01-05 13:32:52 +00:00
|
|
|
return (
|
|
|
|
isExpanded(shape) && (
|
|
|
|
!newBounds || (newBounds.width >= 100 && newBounds.height >= 80)
|
|
|
|
)
|
2015-04-16 07:11:04 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-08-11 12:46:17 +00:00
|
|
|
if (is(shape, 'bpmn:Lane')) {
|
|
|
|
return !newBounds || (newBounds.width >= 130 && newBounds.height >= 60);
|
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
if (is(shape, 'bpmn:Participant')) {
|
2015-08-21 11:58:23 +00:00
|
|
|
return !newBounds || (newBounds.width >= 250 && newBounds.height >= 50);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
2016-12-01 12:17:44 +00:00
|
|
|
if (isTextAnnotation(shape)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-05-02 08:39:07 +00:00
|
|
|
if (isGroup(shape)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-05-17 14:37:05 +00:00
|
|
|
/**
|
|
|
|
* Check, whether one side of the relationship
|
|
|
|
* is a text annotation.
|
|
|
|
*/
|
|
|
|
function isOneTextAnnotation(source, target) {
|
|
|
|
|
|
|
|
var sourceTextAnnotation = isTextAnnotation(source),
|
|
|
|
targetTextAnnotation = isTextAnnotation(target);
|
|
|
|
|
|
|
|
return (
|
|
|
|
(sourceTextAnnotation || targetTextAnnotation) &&
|
|
|
|
(sourceTextAnnotation !== targetTextAnnotation)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
function canConnectAssociation(source, target) {
|
|
|
|
|
|
|
|
// do not connect connections
|
|
|
|
if (isConnection(source) || isConnection(target)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-04-10 12:21:14 +00:00
|
|
|
// compensation boundary events are exception
|
|
|
|
if (isCompensationBoundary(source) && isForCompensation(target)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-17 14:37:05 +00:00
|
|
|
// don't connect parent <-> child
|
|
|
|
if (isParent(target, source) || isParent(source, target)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// allow connection of associations between <!TextAnnotation> and <TextAnnotation>
|
2019-12-16 13:37:09 +00:00
|
|
|
if (isOneTextAnnotation(source, target)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// can connect associations where we can connect
|
|
|
|
// data associations, too (!)
|
|
|
|
return !!canConnectDataAssociation(source, target);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function canConnectMessageFlow(source, target) {
|
|
|
|
|
2019-08-06 16:57:30 +00:00
|
|
|
// during connect user might move mouse out of canvas
|
|
|
|
// https://github.com/bpmn-io/bpmn-js/issues/1033
|
|
|
|
if (getRootElement(source) && !getRootElement(target)) {
|
2019-05-17 09:57:12 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
isMessageFlowSource(source) &&
|
|
|
|
isMessageFlowTarget(target) &&
|
|
|
|
!isSameOrganization(source, target)
|
|
|
|
);
|
2015-04-16 07:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function canConnectSequenceFlow(source, target) {
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
if (
|
|
|
|
isEventBasedTarget(target) &&
|
|
|
|
target.incoming.length > 0 &&
|
|
|
|
areOutgoingEventBasedGatewayConnections(target.incoming) &&
|
|
|
|
!is(source, 'bpmn:EventBasedGateway')
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
return isSequenceFlowSource(source) &&
|
|
|
|
isSequenceFlowTarget(target) &&
|
|
|
|
isSameScope(source, target) &&
|
|
|
|
!(is(source, 'bpmn:EventBasedGateway') && !isEventBasedTarget(target));
|
2015-05-19 21:58:52 +00:00
|
|
|
}
|
|
|
|
|
2015-10-21 14:25:56 +00:00
|
|
|
|
2015-10-06 10:33:21 +00:00
|
|
|
function canConnectDataAssociation(source, target) {
|
2015-10-21 14:25:56 +00:00
|
|
|
|
2016-01-25 20:25:30 +00:00
|
|
|
if (isAny(source, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ]) &&
|
2015-10-21 14:25:56 +00:00
|
|
|
isAny(target, [ 'bpmn:Activity', 'bpmn:ThrowEvent' ])) {
|
2015-10-06 10:33:21 +00:00
|
|
|
return { type: 'bpmn:DataInputAssociation' };
|
|
|
|
}
|
|
|
|
|
2016-01-25 20:25:30 +00:00
|
|
|
if (isAny(target, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ]) &&
|
2015-10-21 14:25:56 +00:00
|
|
|
isAny(source, [ 'bpmn:Activity', 'bpmn:CatchEvent' ])) {
|
2015-10-06 10:33:21 +00:00
|
|
|
return { type: 'bpmn:DataOutputAssociation' };
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
function canInsert(shape, flow, position) {
|
2015-05-21 12:55:10 +00:00
|
|
|
|
2018-08-28 14:02:49 +00:00
|
|
|
if (!flow) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-01-25 16:27:30 +00:00
|
|
|
if (Array.isArray(shape)) {
|
|
|
|
if (shape.length !== 1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
shape = shape[0];
|
|
|
|
}
|
|
|
|
|
2018-07-24 14:16:53 +00:00
|
|
|
if (flow.source === shape ||
|
|
|
|
flow.target === shape) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-05-21 12:55:10 +00:00
|
|
|
// return true if we can drop on the
|
|
|
|
// underlying flow parent
|
|
|
|
//
|
|
|
|
// at this point we are not really able to talk
|
|
|
|
// about connection rules (yet)
|
2017-03-10 09:38:29 +00:00
|
|
|
|
2015-05-21 12:55:10 +00:00
|
|
|
return (
|
2015-10-21 14:25:56 +00:00
|
|
|
isAny(flow, [ 'bpmn:SequenceFlow', 'bpmn:MessageFlow' ]) &&
|
2017-03-10 09:38:29 +00:00
|
|
|
!isLabel(flow) &&
|
2015-10-21 14:25:56 +00:00
|
|
|
is(shape, 'bpmn:FlowNode') &&
|
|
|
|
!is(shape, 'bpmn:BoundaryEvent') &&
|
|
|
|
canDrop(shape, flow.parent, position));
|
2015-07-03 08:48:32 +00:00
|
|
|
}
|
2016-04-20 15:31:42 +00:00
|
|
|
|
2019-08-07 13:17:28 +00:00
|
|
|
function includes(elements, element) {
|
|
|
|
return (elements && element) && elements.indexOf(element) !== -1;
|
2016-04-20 15:31:42 +00:00
|
|
|
}
|
|
|
|
|
2019-08-07 13:17:28 +00:00
|
|
|
function canCopy(elements, element) {
|
2019-08-08 08:50:05 +00:00
|
|
|
if (isLabel(element)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-07 13:17:28 +00:00
|
|
|
if (is(element, 'bpmn:Lane') && !includes(elements, element.parent)) {
|
2016-04-20 15:31:42 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-04-25 12:37:13 +00:00
|
|
|
|
|
|
|
function isOutgoingEventBasedGatewayConnection(connection) {
|
|
|
|
|
|
|
|
if (connection && connection.source) {
|
|
|
|
return is(connection.source, 'bpmn:EventBasedGateway');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function areOutgoingEventBasedGatewayConnections(connections) {
|
|
|
|
connections = connections || [];
|
|
|
|
|
|
|
|
return connections.some(isOutgoingEventBasedGatewayConnection);
|
|
|
|
}
|
2019-08-06 16:57:30 +00:00
|
|
|
|
|
|
|
function getRootElement(element) {
|
|
|
|
return getParent(element, 'bpmn:Process') || getParent(element, 'bpmn:Collaboration');
|
2019-10-11 14:39:29 +00:00
|
|
|
}
|