boolean otherUnsupportedThrowingIntermediateEvent =
(intermediateEventElement.element("escalationEventDefinition") != null); //
// All other event definition types cannot be intermediate throwing (cancelEventDefinition, conditionalEventDefinition, errorEventDefinition, terminateEventDefinition, timerEventDefinition
ActivityImpl nestedActivityImpl = createActivityOnScope(intermediateEventElement, scopeElement);
ActivityBehavior activityBehavior = null;
parseAsynchronousContinuation(intermediateEventElement, nestedActivityImpl);
if(signalEventDefinitionElement != null) {
nestedActivityImpl.setProperty("type", "intermediateSignalThrow");
EventSubscriptionDeclaration signalDefinition = parseSignalEventDefinition(signalEventDefinitionElement);
activityBehavior = new IntermediateThrowSignalEventActivityBehavior(signalDefinition);
} else if(compensateEventDefinitionElement != null) {
nestedActivityImpl.setProperty("type", "intermediateCompensationThrowEvent");
CompensateEventDefinition compensateEventDefinition = parseCompensateEventDefinition(compensateEventDefinitionElement, scopeElement);
activityBehavior = new IntermediateThrowCompensationEventActivityBehavior(compensateEventDefinition);
} else if (messageEventDefinitionElement != null) {
if (isServiceTaskLike(messageEventDefinitionElement)) {
// CAM-436 same behavior as service task
nestedActivityImpl.setProperty("type", "intermediateMessageThrowEvent");
activityBehavior = parseServiceTaskLike("intermediateMessageThrowEvent", messageEventDefinitionElement, scopeElement).getActivityBehavior();
} else {
// default to non behavior if no service task
// properties have been specified
nestedActivityImpl.setProperty("type", "intermediateNoneThrowEvent");
activityBehavior = new IntermediateThrowNoneEventActivityBehavior();
}
} else if (otherUnsupportedThrowingIntermediateEvent) {
addError("Unsupported intermediate throw event type", intermediateEventElement);
} else { // None intermediate event
nestedActivityImpl.setProperty("type", "intermediateNoneThrowEvent");
activityBehavior = new IntermediateThrowNoneEventActivityBehavior();
}
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseIntermediateThrowEvent(intermediateEventElement, scopeElement, nestedActivityImpl);
}
nestedActivityImpl.setActivityBehavior(activityBehavior);
parseExecutionListenersOnScope(intermediateEventElement, nestedActivityImpl);
return nestedActivityImpl;
}