Search in sources :

Example 1 with ActivityBehaviorInvocation

use of org.camunda.bpm.engine.impl.bpmn.delegate.ActivityBehaviorInvocation in project camunda-bpm-platform by camunda.

the class ServiceTaskDelegateExpressionActivityBehavior method performExecution.

@Override
public void performExecution(final ActivityExecution execution) throws Exception {
    Callable<Void> callable = new Callable<Void>() {

        @Override
        public Void call() 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);
            applyFieldDeclaration(fieldDeclarations, delegate);
            if (delegate instanceof ActivityBehavior) {
                Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(new ActivityBehaviorInvocation((ActivityBehavior) delegate, execution));
            } else if (delegate instanceof JavaDelegate) {
                Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(new JavaDelegateInvocation((JavaDelegate) delegate, execution));
                leave(execution);
            } else {
                throw LOG.resolveDelegateExpressionException(expression, ActivityBehavior.class, JavaDelegate.class);
            }
            return null;
        }
    };
    executeWithErrorPropagation(execution, callable);
}
Also used : JavaDelegateInvocation(org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation) SignallableActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior) ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior) ActivityBehaviorInvocation(org.camunda.bpm.engine.impl.bpmn.delegate.ActivityBehaviorInvocation) Callable(java.util.concurrent.Callable) JavaDelegate(org.camunda.bpm.engine.delegate.JavaDelegate)

Aggregations

Callable (java.util.concurrent.Callable)1 JavaDelegate (org.camunda.bpm.engine.delegate.JavaDelegate)1 ActivityBehaviorInvocation (org.camunda.bpm.engine.impl.bpmn.delegate.ActivityBehaviorInvocation)1 JavaDelegateInvocation (org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation)1 ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)1 SignallableActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior)1