use of org.activiti.cdi.annotation.StartProcess in project Activiti by Activiti.
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 name = startProcessAnnotation.name();
String key = startProcessAnnotation.value();
Map<String, Object> variables = extractVariables(startProcessAnnotation, ctx);
if (name.length() > 0) {
businessProcess.startProcessByName(name, variables);
} else {
businessProcess.startProcessByKey(key, variables);
}
return result;
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof Exception) {
throw (Exception) cause;
} else {
throw e;
}
} catch (Exception e) {
throw new ActivitiException("Error while starting process using @StartProcess on method '" + ctx.getMethod() + "': " + e.getMessage(), e);
}
}
Aggregations