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