modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java
/**
   * Parses the end events of a certain level in the process (process,
   * subprocess or another scope).
   * 
   * @param parentElement
   *          The 'parent' element that contains the end events (process,
   *          subprocess).
   * @param scope
   *          The {@link ScopeImpl} to which the end events must be added.
   */
Parses the end events of a certain level in the process (process,
subprocess or another scope).

@param parentElement
The 'parent' element that contains the end events (process,
subprocess).
@param scope
The  ScopeImpl to which the end events must be added.
Parses the end events of a certain level in the process ( process subprocess or another scope ) . @param parentElement The ' parent ' element that contains the end events ( process subprocess ) . @param scope The ScopeImpl to which the end events must be added .
public void createEndEvent(EndEvent endEvent, ScopeImpl scope) {
    ActivityImpl activity = createActivityOnScope(endEvent, ELEMENT_EVENT_END, scope);
    EventDefinition eventDefinition = null;
    if (endEvent.getEventDefinitions().size() > 0) {
      eventDefinition = endEvent.getEventDefinitions().get(0);
    }
    if (eventDefinition instanceof org.activiti.bpmn.model.ErrorEventDefinition) {
      org.activiti.bpmn.model.ErrorEventDefinition errorDefinition = (org.activiti.bpmn.model.ErrorEventDefinition) eventDefinition;
      if (bpmnModel.containsErrorRef(errorDefinition.getErrorCode())) {
        String errorCode = bpmnModel.getErrors().get(errorDefinition.getErrorCode());
        if (StringUtils.isEmpty(errorCode)) {
          bpmnModel.addProblem("errorCode is required for an error event", errorDefinition);
        }
        activity.setProperty("type", "errorEndEvent");
        errorDefinition.setErrorCode(errorCode);
      }
      activity.setActivityBehavior(activityBehaviorFactory.createErrorEndEventActivityBehavior(endEvent, errorDefinition));
    } else if (eventDefinition instanceof CancelEventDefinition) {
      if (scope.getProperty("type")==null || !scope.getProperty("type").equals("transaction")) {
        bpmnModel.addProblem("end event with cancelEventDefinition only supported inside transaction subprocess", endEvent);
      } else {
        activity.setProperty("type", "cancelEndEvent");
        activity.setActivityBehavior(activityBehaviorFactory.createCancelEndEventActivityBehavior(endEvent));
      }
    } else if (eventDefinition instanceof TerminateEventDefinition) {
      activity.setActivityBehavior(activityBehaviorFactory.createTerminateEndEventActivityBehavior(endEvent));
    } else if (eventDefinition == null) {
      activity.setActivityBehavior(activityBehaviorFactory.createNoneEndEventActivityBehavior(endEvent));
    }
    createExecutionListenersOnScope(endEvent.getExecutionListeners(), activity);
    for (BpmnParseListener parseListener : parseListeners) {
      parseListener.parseEndEvent(endEvent, scope, activity);
    }
  }
public void createEndEvent ( EndEvent endEvent , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( endEvent , ELEMENT_EVENT_END , scope ) ; EventDefinition eventDefinition = null ; if ( endEvent . getEventDefinitions ( ) . size ( ) > 0 ) { eventDefinition = endEvent . getEventDefinitions ( ) . get ( 0 ) ; } if ( eventDefinition instanceof org . activiti . bpmn . model . ErrorEventDefinition ) { org . activiti . bpmn . model . ErrorEventDefinition errorDefinition = ( org . activiti . bpmn . model . ErrorEventDefinition ) eventDefinition ; if ( bpmnModel . containsErrorRef ( errorDefinition . getErrorCode ( ) ) ) { String errorCode = bpmnModel . getErrors ( ) . get ( errorDefinition . getErrorCode ( ) ) ; if ( StringUtils . isEmpty ( errorCode ) ) { bpmnModel . addProblem ( "errorCode is required for an error event" , errorDefinition ) ; } activity . setProperty ( "type" , "errorEndEvent" ) ; errorDefinition . setErrorCode ( errorCode ) ; } activity . setActivityBehavior ( activityBehaviorFactory . createErrorEndEventActivityBehavior ( endEvent , errorDefinition ) ) ; } else if ( eventDefinition instanceof CancelEventDefinition ) { if ( scope . getProperty ( "type" ) == null || ! scope . getProperty ( "type" ) . equals ( "transaction" ) ) { bpmnModel . addProblem ( "end event with cancelEventDefinition only supported inside transaction subprocess" , endEvent ) ; } else { activity . setProperty ( "type" , "cancelEndEvent" ) ; activity . setActivityBehavior ( activityBehaviorFactory . createCancelEndEventActivityBehavior ( endEvent ) ) ; } } else if ( eventDefinition instanceof TerminateEventDefinition ) { activity . setActivityBehavior ( activityBehaviorFactory . createTerminateEndEventActivityBehavior ( endEvent ) ) ; } else if ( eventDefinition == null ) { activity . setActivityBehavior ( activityBehaviorFactory . createNoneEndEventActivityBehavior ( endEvent ) ) ; } createExecutionListenersOnScope ( endEvent . getExecutionListeners ( ) , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseEndEvent ( endEvent , scope , activity ) ; } }
Parses the end events of a certain level in the process (process,
 subprocess or another scope).
Parses the end events of a certain level in the process ( process subprocess or another scope ) .
// Error end event // Cancel end event       // Terminate end event   // None end event  