Search in sources :

Example 1 with CompleteTask

use of org.camunda.bpm.engine.cdi.annotation.CompleteTask in project camunda-bpm-platform by camunda.

the class CompleteTaskInterceptor method invoke.

@AroundInvoke
public Object invoke(InvocationContext ctx) throws Exception {
    try {
        Object result = ctx.proceed();
        CompleteTask completeTaskAnnotation = ctx.getMethod().getAnnotation(CompleteTask.class);
        boolean endConversation = completeTaskAnnotation.endConversation();
        businessProcess.completeTask(endConversation);
        return result;
    } catch (InvocationTargetException e) {
        throw new ProcessEngineCdiException("Error while completing task: " + e.getCause().getMessage(), e.getCause());
    }
}
Also used : ProcessEngineCdiException(org.camunda.bpm.engine.cdi.ProcessEngineCdiException) CompleteTask(org.camunda.bpm.engine.cdi.annotation.CompleteTask) InvocationTargetException(java.lang.reflect.InvocationTargetException) AroundInvoke(javax.interceptor.AroundInvoke)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 AroundInvoke (javax.interceptor.AroundInvoke)1 ProcessEngineCdiException (org.camunda.bpm.engine.cdi.ProcessEngineCdiException)1 CompleteTask (org.camunda.bpm.engine.cdi.annotation.CompleteTask)1