* The XML element defining the call activity
* @param scope
* The current scope on which the call activity is defined.
*/
public ActivityImpl parseCallActivity(Element callActivityElement, ScopeImpl scope) {
ActivityImpl activity = createActivityOnScope(callActivityElement, scope);
activity.setAsync(isAsync(callActivityElement));
activity.setExclusive(isExclusive(callActivityElement));
String calledElement = callActivityElement.attribute("calledElement");
if (calledElement == null) {
addError("Missing attribute 'calledElement'", callActivityElement);
}
CallActivityBehavior callActivityBehaviour = null;
String expressionRegex = "\\$+\\{+.+\\}";
if (calledElement != null && calledElement.matches(expressionRegex)) {
callActivityBehaviour = new CallActivityBehavior(expressionManager.createExpression(calledElement));
} else {
callActivityBehaviour = new CallActivityBehavior(calledElement);
}
Element extentionsElement = callActivityElement.element("extensionElements");
if (extentionsElement != null) {
// input data elements
for (Element listenerElement : extentionsElement.elementsNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "in")) {
String sourceExpression = listenerElement.attribute("sourceExpression");
String target = listenerElement.attribute("target");
if (sourceExpression != null) {
Expression expression = expressionManager.createExpression(sourceExpression.trim());
callActivityBehaviour.addDataInputAssociation(new SimpleDataInputAssociation(expression, target));
} else {
String source = listenerElement.attribute("source");
callActivityBehaviour.addDataInputAssociation(new SimpleDataInputAssociation(source, target));
}
}
// output data elements
for (Element listenerElement : extentionsElement.elementsNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "out")) {
String sourceExpression = listenerElement.attribute("sourceExpression");
String target = listenerElement.attribute("target");
if (sourceExpression != null) {
Expression expression = expressionManager.createExpression(sourceExpression.trim());
callActivityBehaviour.addDataOutputAssociation(new MessageImplicitDataOutputAssociation(target, expression));
} else {
String source = listenerElement.attribute("source");
callActivityBehaviour.addDataOutputAssociation(new MessageImplicitDataOutputAssociation(target, source));
}
}
}
// // parse data input and output
// for (Element dataAssociationElement :
// callActivityElement.elements("dataInputAssociation")) {
// AbstractDataAssociation dataAssociation =
// this.parseDataInputAssociation(dataAssociationElement);
// callActivityBehaviour.addDataInputAssociation(dataAssociation);
// }
//
// for (Element dataAssociationElement :
// callActivityElement.elements("dataOutputAssociation")) {
// AbstractDataAssociation dataAssociation =
// this.parseDataOutputAssociation(dataAssociationElement);
// callActivityBehaviour.addDataOutputAssociation(dataAssociation);
// }
activity.setScope(true);
activity.setActivityBehavior(callActivityBehaviour);
parseExecutionListenersOnScope(callActivityElement, activity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseCallActivity(callActivityElement, scope, activity);