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);
}
Aggregations