use of org.camunda.bpm.engine.impl.bpmn.listener.DelegateExpressionExecutionListener in project camunda-bpm-platform by camunda.
the class BpmnParse method parseExecutionListener.
/**
* Parses an {@link ExecutionListener} implementation for the given
* executionListener element.
*
* @param executionListenerElement
* the XML element containing the executionListener definition.
*/
public ExecutionListener parseExecutionListener(Element executionListenerElement) {
ExecutionListener executionListener = null;
String className = executionListenerElement.attribute(PROPERTYNAME_CLASS);
String expression = executionListenerElement.attribute(PROPERTYNAME_EXPRESSION);
String delegateExpression = executionListenerElement.attribute(PROPERTYNAME_DELEGATE_EXPRESSION);
Element scriptElement = executionListenerElement.elementNS(CAMUNDA_BPMN_EXTENSIONS_NS, "script");
if (className != null) {
executionListener = new ClassDelegateExecutionListener(className, parseFieldDeclarations(executionListenerElement));
} else if (expression != null) {
executionListener = new ExpressionExecutionListener(expressionManager.createExpression(expression));
} else if (delegateExpression != null) {
executionListener = new DelegateExpressionExecutionListener(expressionManager.createExpression(delegateExpression), parseFieldDeclarations(executionListenerElement));
} else if (scriptElement != null) {
try {
ExecutableScript executableScript = parseCamundaScript(scriptElement);
if (executableScript != null) {
executionListener = new ScriptExecutionListener(executableScript);
}
} catch (BpmnParseException e) {
addError(e);
}
} else {
addError("Element 'class', 'expression', 'delegateExpression' or 'script' is mandatory on executionListener", executionListenerElement);
}
return executionListener;
}
Aggregations