use of org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation 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);
}
use of org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation in project camunda-bpm-platform by camunda.
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);
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 LOG.resolveDelegateExpressionException(expression, ExecutionListener.class, JavaDelegate.class);
}
}
Aggregations