# all files / bpmn-js/lib/util/ DiUtil.js

100% Statements 19/19
100% Branches 14/14
100% Functions 8/8
100% Lines 19/19

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62

    16514×
    24×

    16490×
    4723×

    11767×
    2691×

    9076×

    64×

    4542×

    181×
    181×

    181×
    68×
    68×
    4×

    181×

    65×

    58×

    58×

     import {
      is,
      getBusinessObject
    } from './ModelUtil';

    import {
      forEach
    } from 'min-dash';

    export function isExpanded(element) {

      if (is(element, 'bpmn:CallActivity')) {
        return false;
      }

      if (is(element, 'bpmn:SubProcess')) {
        return !!getBusinessObject(element).di.isExpanded;
      }

      if (is(element, 'bpmn:Participant')) {
        return !!getBusinessObject(element).processRef;
      }

      return true;
    }

    export function isInterrupting(element) {
      return element && getBusinessObject(element).isInterrupting !== false;
    }

    export function isEventSubProcess(element) {
      return element && !!getBusinessObject(element).triggeredByEvent;
    }

    export function hasEventDefinition(element, eventType) {
      var bo = getBusinessObject(element),
          hasEventDefinition = false;

      if (bo.eventDefinitions) {
        forEach(bo.eventDefinitions, function(event) {
          if (is(event, eventType)) {
            hasEventDefinition = true;
          }
        });
      }

      return hasEventDefinition;
    }

    export function hasErrorEventDefinition(element) {
      return hasEventDefinition(element, 'bpmn:ErrorEventDefinition');
    }

    export function hasEscalationEventDefinition(element) {
      return hasEventDefinition(element, 'bpmn:EscalationEventDefinition');
    }

    export function hasCompensateEventDefinition(element) {
      return hasEventDefinition(element, 'bpmn:CompensateEventDefinition');
    }