use of org.camunda.bpm.engine.impl.task.listener.ClassDelegateTaskListener in project camunda-bpm-platform by camunda.
the class BpmnParse method parseTaskListener.
protected TaskListener parseTaskListener(Element taskListenerElement) {
TaskListener taskListener = null;
String className = taskListenerElement.attribute(PROPERTYNAME_CLASS);
String expression = taskListenerElement.attribute(PROPERTYNAME_EXPRESSION);
String delegateExpression = taskListenerElement.attribute(PROPERTYNAME_DELEGATE_EXPRESSION);
Element scriptElement = taskListenerElement.elementNS(CAMUNDA_BPMN_EXTENSIONS_NS, "script");
if (className != null) {
taskListener = new ClassDelegateTaskListener(className, parseFieldDeclarations(taskListenerElement));
} else if (expression != null) {
taskListener = new ExpressionTaskListener(expressionManager.createExpression(expression));
} else if (delegateExpression != null) {
taskListener = new DelegateExpressionTaskListener(expressionManager.createExpression(delegateExpression), parseFieldDeclarations(taskListenerElement));
} else if (scriptElement != null) {
try {
ExecutableScript executableScript = parseCamundaScript(scriptElement);
if (executableScript != null) {
taskListener = new ScriptTaskListener(executableScript);
}
} catch (BpmnParseException e) {
addError(e);
}
} else {
addError("Element 'class', 'expression', 'delegateExpression' or 'script' is mandatory on taskListener", taskListenerElement);
}
return taskListener;
}
Aggregations