Search in sources :

Example 1 with JavaDelegateInvocation

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);
    }
}
Also used : JavaDelegateInvocation(org.activiti.engine.impl.delegate.JavaDelegateInvocation) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ExecutionListenerInvocation(org.activiti.engine.impl.delegate.ExecutionListenerInvocation) JavaDelegate(org.activiti.engine.delegate.JavaDelegate) ExecutionListener(org.activiti.engine.delegate.ExecutionListener)

Aggregations

ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)1 ExecutionListener (org.activiti.engine.delegate.ExecutionListener)1 JavaDelegate (org.activiti.engine.delegate.JavaDelegate)1 ExecutionListenerInvocation (org.activiti.engine.impl.delegate.ExecutionListenerInvocation)1 JavaDelegateInvocation (org.activiti.engine.impl.delegate.JavaDelegateInvocation)1