2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
is,
|
|
|
|
getBusinessObject
|
|
|
|
} 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
|
|
|
|
|
|
|
export function isExpanded(element) {
|
2015-04-27 14:50:09 +00:00
|
|
|
|
|
|
|
if (is(element, 'bpmn:CallActivity')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is(element, 'bpmn:SubProcess')) {
|
2016-01-27 14:11:27 +00:00
|
|
|
return !!getBusinessObject(element).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
|
|
|
}
|