2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
is,
|
2021-08-06 08:35:41 +00:00
|
|
|
getBusinessObject,
|
|
|
|
getDi
|
2018-04-02 19:01:53 +00:00
|
|
|
} from './ModelUtil';
|
2015-04-27 14:50:09 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
forEach
|
|
|
|
} from 'min-dash';
|
2016-11-09 10:45:12 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
|
2021-08-06 08:35:41 +00:00
|
|
|
export function isExpanded(element, di) {
|
2015-04-27 14:50:09 +00:00
|
|
|
|
|
|
|
if (is(element, 'bpmn:CallActivity')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is(element, 'bpmn:SubProcess')) {
|
2021-08-06 08:35:41 +00:00
|
|
|
di = di || getDi(element);
|
|
|
|
|
2021-09-17 07:44:58 +00:00
|
|
|
if (di && is(di, 'bpmndi:BPMNPlane')) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-08-06 08:35:41 +00:00
|
|
|
return di && !!di.isExpanded;
|
2015-04-27 14:50:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is(element, 'bpmn:Participant')) {
|
|
|
|
return !!getBusinessObject(element).processRef;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2018-04-02 19:01:53 +00:00
|
|
|
}
|
2015-08-04 15:52:43 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
export function isInterrupting(element) {
|
2015-08-11 09:58:30 +00:00
|
|
|
return element && getBusinessObject(element).isInterrupting !== false;
|
2018-04-02 19:01:53 +00:00
|
|
|
}
|
2015-08-11 09:58:30 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
export function isEventSubProcess(element) {
|
2015-08-04 15:52:43 +00:00
|
|
|
return element && !!getBusinessObject(element).triggeredByEvent;
|
2018-04-02 19:01:53 +00:00
|
|
|
}
|
2016-11-09 10:45:12 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
export function hasEventDefinition(element, eventType) {
|
2016-11-09 10:45:12 +00:00
|
|
|
var bo = getBusinessObject(element),
|
|
|
|
hasEventDefinition = false;
|
|
|
|
|
|
|
|
if (bo.eventDefinitions) {
|
|
|
|
forEach(bo.eventDefinitions, function(event) {
|
|
|
|
if (is(event, eventType)) {
|
|
|
|
hasEventDefinition = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return hasEventDefinition;
|
|
|
|
}
|
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
export function hasErrorEventDefinition(element) {
|
2016-11-09 10:45:12 +00:00
|
|
|
return hasEventDefinition(element, 'bpmn:ErrorEventDefinition');
|
2018-04-02 19:01:53 +00:00
|
|
|
}
|
2016-11-09 10:45:12 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
export function hasEscalationEventDefinition(element) {
|
2016-11-09 10:45:12 +00:00
|
|
|
return hasEventDefinition(element, 'bpmn:EscalationEventDefinition');
|
2018-04-02 19:01:53 +00:00
|
|
|
}
|
2016-11-09 10:45:12 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
export function hasCompensateEventDefinition(element) {
|
2016-11-09 10:45:12 +00:00
|
|
|
return hasEventDefinition(element, 'bpmn:CompensateEventDefinition');
|
2018-04-02 19:01:53 +00:00
|
|
|
}
|