use of org.activiti.engine.impl.delegate.JavaDelegateInvocation in project Activiti by Activiti.
the class DelegateExpressionExecutionListener method notify.
public void notify(DelegateExecution execution) throws Exception {
// Note: we can't cache the result of the expression, because the
// execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}'
Object delegate = expression.getValue(execution);
ClassDelegate.applyFieldDeclaration(fieldDeclarations, delegate);
if (delegate instanceof ExecutionListener) {
Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(new ExecutionListenerInvocation((ExecutionListener) delegate, execution));
} else if (delegate instanceof JavaDelegate) {
Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(new JavaDelegateInvocation((JavaDelegate) delegate, execution));
} else {
throw new ActivitiIllegalArgumentException("Delegate expression " + expression + " did not resolve to an implementation of " + ExecutionListener.class + " nor " + JavaDelegate.class);
}
}
Aggregations