modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java
/**
   * Parses the boundary events of a certain 'level' (process, subprocess or
   * other scope).
   * 
   * Note that the boundary events are not parsed during the parsing of the bpmn
   * activities, since the semantics are different (boundaryEvent needs to be
   * added as nested activity to the reference activity on PVM level).
   * 
   * @param parentElement
   *          The 'parent' element that contains the activities (process,
   *          subprocess).
   * @param scopeElement
   *          The {@link ScopeImpl} to which the activities must be added.
   */
Parses the boundary events of a certain 'level' (process, subprocess or
other scope).

Note that the boundary events are not parsed during the parsing of the bpmn
activities, since the semantics are different (boundaryEvent needs to be
added as nested activity to the reference activity on PVM level).

@param parentElement
The 'parent' element that contains the activities (process,
subprocess).
@param scopeElement
The  ScopeImpl to which the activities must be added.
Parses the boundary events of a certain ' level ' ( process subprocess or other scope ) . Note that the boundary events are not parsed during the parsing of the bpmn activities since the semantics are different ( boundaryEvent needs to be added as nested activity to the reference activity on PVM level ) . @param parentElement The ' parent ' element that contains the activities ( process subprocess ) . @param scopeElement The ScopeImpl to which the activities must be added .
public void createBoundaryEvent(BoundaryEvent boundaryEvent, ScopeImpl scopeElement) {
    ActivityImpl parentActivity = scopeElement.findActivity(boundaryEvent.getAttachedToRefId());
    if (parentActivity == null) {
      bpmnModel.addProblem("Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event", 
              boundaryEvent);
      return;
    }
    ActivityImpl nestedActivity = createActivityOnScope(boundaryEvent, ELEMENT_EVENT_BOUNDARY, parentActivity);
    EventDefinition eventDefinition = null;
    if (boundaryEvent.getEventDefinitions().size() > 0) {
      eventDefinition = boundaryEvent.getEventDefinitions().get(0);
    }
    boolean interrupting = boundaryEvent.isCancelActivity();
    ActivityBehavior behavior = null;
    if (eventDefinition instanceof TimerEventDefinition) {
      behavior = activityBehaviorFactory.createBoundaryEventActivityBehavior(boundaryEvent, interrupting, nestedActivity); 
      createBoundaryTimerEventDefinition((TimerEventDefinition) eventDefinition, interrupting, nestedActivity);
    } else if (eventDefinition instanceof org.activiti.bpmn.model.ErrorEventDefinition) {
      interrupting = true; 
      behavior = activityBehaviorFactory.createBoundaryEventActivityBehavior(boundaryEvent, interrupting, nestedActivity);
      org.activiti.bpmn.model.ErrorEventDefinition modelErrorEvent = (org.activiti.bpmn.model.ErrorEventDefinition) eventDefinition;
      if (bpmnModel.containsErrorRef(modelErrorEvent.getErrorCode())) {
        String errorCode = bpmnModel.getErrors().get(modelErrorEvent.getErrorCode());
        if (StringUtils.isEmpty(errorCode)) {
          bpmnModel.addProblem("errorCode is required for an error event", boundaryEvent);
        }
        modelErrorEvent.setErrorCode(errorCode);
      }
      createBoundaryErrorEventDefinition(modelErrorEvent, interrupting, parentActivity, nestedActivity);
    } else if (eventDefinition instanceof SignalEventDefinition) {
      behavior = activityBehaviorFactory.createBoundaryEventActivityBehavior(boundaryEvent, interrupting, nestedActivity);
      createBoundarySignalEventDefinition((SignalEventDefinition) eventDefinition, interrupting, nestedActivity);
    } else if (eventDefinition instanceof CancelEventDefinition) {
      behavior = createBoundaryCancelEventDefinition((CancelEventDefinition) eventDefinition, nestedActivity);
    } else if (eventDefinition instanceof org.activiti.bpmn.model.CompensateEventDefinition) {
      behavior = activityBehaviorFactory.createBoundaryEventActivityBehavior(boundaryEvent, interrupting, nestedActivity);
      createCatchCompensateEventDefinition((org.activiti.bpmn.model.CompensateEventDefinition) eventDefinition, nestedActivity);      
    } else if (eventDefinition instanceof MessageEventDefinition) {
      behavior = activityBehaviorFactory.createBoundaryEventActivityBehavior(boundaryEvent, interrupting, nestedActivity);
      MessageEventDefinition modelMessageEvent = (MessageEventDefinition) eventDefinition;
      if (bpmnModel.containsMessageId(modelMessageEvent.getMessageRef())) {
        String messageName = bpmnModel.getMessage(modelMessageEvent.getMessageRef()).getName();
        if (StringUtils.isEmpty(messageName)) {
          bpmnModel.addProblem("messageName is required for a message event", boundaryEvent);
        }
        modelMessageEvent.setMessageRef(messageName);
      }
      createBoundaryMessageEventDefinition((MessageEventDefinition) eventDefinition, interrupting, nestedActivity);
    } else {
      bpmnModel.addProblem("Unsupported boundary event type", boundaryEvent);
    }
    nestedActivity.setActivityBehavior(behavior);
    for (BpmnParseListener parseListener : parseListeners) {
      parseListener.parseBoundaryEvent(boundaryEvent, scopeElement, nestedActivity);
    }
  }
public void createBoundaryEvent ( BoundaryEvent boundaryEvent , ScopeImpl scopeElement ) { ActivityImpl parentActivity = scopeElement . findActivity ( boundaryEvent . getAttachedToRefId ( ) ) ; if ( parentActivity == null ) { bpmnModel . addProblem ( "Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event" , boundaryEvent ) ; return ; } ActivityImpl nestedActivity = createActivityOnScope ( boundaryEvent , ELEMENT_EVENT_BOUNDARY , parentActivity ) ; EventDefinition eventDefinition = null ; if ( boundaryEvent . getEventDefinitions ( ) . size ( ) > 0 ) { eventDefinition = boundaryEvent . getEventDefinitions ( ) . get ( 0 ) ; } boolean interrupting = boundaryEvent . isCancelActivity ( ) ; ActivityBehavior behavior = null ; if ( eventDefinition instanceof TimerEventDefinition ) { behavior = activityBehaviorFactory . createBoundaryEventActivityBehavior ( boundaryEvent , interrupting , nestedActivity ) ; createBoundaryTimerEventDefinition ( ( TimerEventDefinition ) eventDefinition , interrupting , nestedActivity ) ; } else if ( eventDefinition instanceof org . activiti . bpmn . model . ErrorEventDefinition ) { interrupting = true ; behavior = activityBehaviorFactory . createBoundaryEventActivityBehavior ( boundaryEvent , interrupting , nestedActivity ) ; org . activiti . bpmn . model . ErrorEventDefinition modelErrorEvent = ( org . activiti . bpmn . model . ErrorEventDefinition ) eventDefinition ; if ( bpmnModel . containsErrorRef ( modelErrorEvent . getErrorCode ( ) ) ) { String errorCode = bpmnModel . getErrors ( ) . get ( modelErrorEvent . getErrorCode ( ) ) ; if ( StringUtils . isEmpty ( errorCode ) ) { bpmnModel . addProblem ( "errorCode is required for an error event" , boundaryEvent ) ; } modelErrorEvent . setErrorCode ( errorCode ) ; } createBoundaryErrorEventDefinition ( modelErrorEvent , interrupting , parentActivity , nestedActivity ) ; } else if ( eventDefinition instanceof SignalEventDefinition ) { behavior = activityBehaviorFactory . createBoundaryEventActivityBehavior ( boundaryEvent , interrupting , nestedActivity ) ; createBoundarySignalEventDefinition ( ( SignalEventDefinition ) eventDefinition , interrupting , nestedActivity ) ; } else if ( eventDefinition instanceof CancelEventDefinition ) { behavior = createBoundaryCancelEventDefinition ( ( CancelEventDefinition ) eventDefinition , nestedActivity ) ; } else if ( eventDefinition instanceof org . activiti . bpmn . model . CompensateEventDefinition ) { behavior = activityBehaviorFactory . createBoundaryEventActivityBehavior ( boundaryEvent , interrupting , nestedActivity ) ; createCatchCompensateEventDefinition ( ( org . activiti . bpmn . model . CompensateEventDefinition ) eventDefinition , nestedActivity ) ; } else if ( eventDefinition instanceof MessageEventDefinition ) { behavior = activityBehaviorFactory . createBoundaryEventActivityBehavior ( boundaryEvent , interrupting , nestedActivity ) ; MessageEventDefinition modelMessageEvent = ( MessageEventDefinition ) eventDefinition ; if ( bpmnModel . containsMessageId ( modelMessageEvent . getMessageRef ( ) ) ) { String messageName = bpmnModel . getMessage ( modelMessageEvent . getMessageRef ( ) ) . getName ( ) ; if ( StringUtils . isEmpty ( messageName ) ) { bpmnModel . addProblem ( "messageName is required for a message event" , boundaryEvent ) ; } modelMessageEvent . setMessageRef ( messageName ) ; } createBoundaryMessageEventDefinition ( ( MessageEventDefinition ) eventDefinition , interrupting , nestedActivity ) ; } else { bpmnModel . addProblem ( "Unsupported boundary event type" , boundaryEvent ) ; } nestedActivity . setActivityBehavior ( behavior ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseBoundaryEvent ( boundaryEvent , scopeElement , nestedActivity ) ; } }
Parses the boundary events of a certain 'level' (process, subprocess or
 other scope).
Parses the boundary events of a certain ' level ' ( process subprocess or other scope ) .
// non-interrupting not yet supported // always interrupting