public ActivityImpl parseSubProcess(Element subProcessElement, ScopeImpl scope) {
    ActivityImpl subProcessActivity = createActivityOnScope(subProcessElement, scope);
    subProcessActivity.setSubProcessScope(true);

    parseAsynchronousContinuationForActivity(subProcessElement, subProcessActivity);

    Boolean isTriggeredByEvent = parseBooleanAttribute(subProcessElement.attribute("triggeredByEvent"), false);
    subProcessActivity.getProperties().set(BpmnProperties.TRIGGERED_BY_EVENT, isTriggeredByEvent);
    subProcessActivity.setProperty(PROPERTYNAME_CONSUMES_COMPENSATION, !isTriggeredByEvent);

    subProcessActivity.setScope(true);
    if (isTriggeredByEvent) {
      subProcessActivity.setActivityBehavior(new EventSubProcessActivityBehavior());
      subProcessActivity.setEventScope(scope);
    } else {
      subProcessActivity.setActivityBehavior(new SubProcessActivityBehavior());
    }
    parseScope(subProcessElement, subProcessActivity);

    for (BpmnParseListener parseListener : parseListeners) {
      parseListener.parseSubProcess(subProcessElement, scope, subProcessActivity);
    }
    return subProcessActivity;
  }
public ActivityImpl parseSubProcess ( Element subProcessElement , ScopeImpl scope ) { ActivityImpl subProcessActivity = createActivityOnScope ( subProcessElement , scope ) ; subProcessActivity . setSubProcessScope ( true ) ; parseAsynchronousContinuationForActivity ( subProcessElement , subProcessActivity ) ; Boolean isTriggeredByEvent = parseBooleanAttribute ( subProcessElement . attribute ( "triggeredByEvent" ) , false ) ; subProcessActivity . getProperties ( ) . set ( BpmnProperties . TRIGGERED_BY_EVENT , isTriggeredByEvent ) ; subProcessActivity . setProperty ( PROPERTYNAME_CONSUMES_COMPENSATION , ! isTriggeredByEvent ) ; subProcessActivity . setScope ( true ) ; if ( isTriggeredByEvent ) { subProcessActivity . setActivityBehavior ( new EventSubProcessActivityBehavior ( ) ) ; subProcessActivity . setEventScope ( scope ) ; } else { subProcessActivity . setActivityBehavior ( new SubProcessActivityBehavior ( ) ) ; } parseScope ( subProcessElement , subProcessActivity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseSubProcess ( subProcessElement , scope , subProcessActivity ) ; } return subProcessActivity ; }
Parses a subprocess (formally known as an embedded subprocess): a
subprocess defined within another process definition.

@param subProcessElement
The XML element corresponding with the subprocess definition
@param scope
The current scope on which the subprocess is defined.