use of org.camunda.bpm.engine.cdi.annotation.StartProcess in project camunda-bpm-platform by camunda.
the class StartProcessInterceptor method invoke.
@AroundInvoke
public Object invoke(InvocationContext ctx) throws Exception {
try {
Object result = ctx.proceed();
StartProcess startProcessAnnotation = ctx.getMethod().getAnnotation(StartProcess.class);
String key = startProcessAnnotation.value();
Map<String, Object> variables = extractVariables(startProcessAnnotation, ctx);
businessProcess.startProcessByKey(key, variables);
return result;
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause != null && cause instanceof Exception) {
throw (Exception) cause;
} else {
throw e;
}
} catch (Exception e) {
throw new ProcessEngineException("Error while starting process using @StartProcess on method '" + ctx.getMethod() + "': " + e.getMessage(), e);
}
}
Aggregations