protected void parseScopeStartEvent(ActivityImpl startEventActivity, Element startEventElement, Element parentElement, ScopeImpl scope) {
Object triggeredByEvent = scope.getProperty(PROPERTYNAME_TRIGGERED_BY_EVENT);
boolean isTriggeredByEvent = triggeredByEvent != null && ((Boolean) triggeredByEvent);
Element errorEventDefinition = startEventElement.element("errorEventDefinition");
Element messageEventDefinition = startEventElement.element("messageEventDefinition");
Element signalEventDefinition = startEventElement.element("signalEventDefinition");
Element timerEventDefinition = startEventElement.element("timerEventDefinition");
if (isTriggeredByEvent) { // event subprocess
// all start events of an event subprocess share common behavior
EventSubProcessStartEventActivityBehavior activityBehavior = new EventSubProcessStartEventActivityBehavior();
startEventActivity.setActivityBehavior(activityBehavior);
String isInterrupting = startEventElement.attribute("isInterrupting");
boolean interrupting = isInterrupting.equalsIgnoreCase("true");
((ActivityImpl)scope).setCancelScope(interrupting);
((ActivityImpl)scope).setConcurrent(!interrupting);
// the scope of the event subscription is the parent of the event
// subprocess (subscription must be created when parent is initialized).
ScopeImpl catchingScope = ((ActivityImpl) scope).getParent();
startEventActivity.setScope(catchingScope);
// the flow scope is the event subprocess activity.
startEventActivity.setFlowScope(scope);
if (scope.getProperty(PROPERTYNAME_INITIAL) == null) {
scope.setProperty(PROPERTYNAME_INITIAL, startEventActivity);
} else {
addError("multiple start events not supported for subprocess", startEventElement);
}
if (errorEventDefinition != null) {
if(!interrupting) {
addError("error start event of event subprocess must be interrupting", startEventElement);
}
parseErrorStartEventDefinition(errorEventDefinition, startEventActivity, catchingScope);
} else if (messageEventDefinition != null) {
startEventActivity.setProperty("type", "messageStartEvent");
EventSubscriptionDeclaration eventSubscriptionDeclaration = parseMessageEventDefinition(messageEventDefinition);
parseEventDefinitionForSubprocess(eventSubscriptionDeclaration, startEventActivity, catchingScope, messageEventDefinition);
} else if (signalEventDefinition != null) {
startEventActivity.setProperty("type", "signalStartEvent");
EventSubscriptionDeclaration eventSubscriptionDeclaration = parseSignalEventDefinition(signalEventDefinition);
parseEventDefinitionForSubprocess(eventSubscriptionDeclaration, startEventActivity, catchingScope, signalEventDefinition);
} else if (timerEventDefinition != null) {
parseTimerStartEventDefinitionForEventSubprocess(timerEventDefinition, startEventActivity, catchingScope);
} else {
addError("start event of event subprocess must be of type 'error', 'message', 'timer' or 'signal'", startEventElement);
}
} else { // "regular" subprocess
Element compensateEventDefinition = startEventElement.element("compensateEventDefinition");
Element conditionalEventDefinition = startEventElement.element("conditionalEventDefinition");
Element escalationEventDefinition = startEventElement.element("escalationEventDefinition");
if (conditionalEventDefinition != null) {
addError("conditionalEventDefinition is not allowed on start event within a subprocess", conditionalEventDefinition);
}
if (timerEventDefinition != null) {