Search in sources :

Example 1 with TaskListenerInvocation

use of org.activiti.engine.impl.delegate.TaskListenerInvocation in project Activiti by Activiti.

the class DelegateExpressionTaskListener method notify.

public void notify(DelegateTask delegateTask) {
    // Note: we can't cache the result of the expression, because the
    // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}'
    Object delegate = expression.getValue(delegateTask.getExecution());
    ClassDelegate.applyFieldDeclaration(fieldDeclarations, delegate);
    if (delegate instanceof TaskListener) {
        try {
            Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(new TaskListenerInvocation((TaskListener) delegate, delegateTask));
        } catch (Exception e) {
            throw new ActivitiException("Exception while invoking TaskListener: " + e.getMessage(), e);
        }
    } else {
        throw new ActivitiIllegalArgumentException("Delegate expression " + expression + " did not resolve to an implementation of " + TaskListener.class);
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) TaskListenerInvocation(org.activiti.engine.impl.delegate.TaskListenerInvocation) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) TaskListener(org.activiti.engine.delegate.TaskListener) ActivitiException(org.activiti.engine.ActivitiException) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException)

Aggregations

ActivitiException (org.activiti.engine.ActivitiException)1 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)1 TaskListener (org.activiti.engine.delegate.TaskListener)1 TaskListenerInvocation (org.activiti.engine.impl.delegate.TaskListenerInvocation)1