use of org.activiti.cdi.ActivitiCdiException in project Activiti by Activiti.
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 ActivitiCdiException("Error while completing task: " + e.getCause().getMessage(), e.getCause());
}
}
use of org.activiti.cdi.ActivitiCdiException in project Activiti by Activiti.
the class DefaultContextAssociationManager method setExecution.
@Override
public void setExecution(Execution execution) {
if (execution == null) {
throw new ActivitiCdiException("Cannot associate with execution: null");
}
if (Context.getCommandContext() != null) {
throw new ActivitiCdiException("Cannot work with scoped associations inside command context.");
}
ScopedAssociation scopedAssociation = getScopedAssociation();
Execution associatedExecution = scopedAssociation.getExecution();
if (associatedExecution != null && !associatedExecution.getId().equals(execution.getId())) {
throw new ActivitiCdiException("Cannot associate " + execution + ", already associated with " + associatedExecution + ". Disassociate first!");
}
if (log.isTraceEnabled()) {
log.trace("Associating {} (@{})", execution, scopedAssociation.getClass().getAnnotations()[0].annotationType().getSimpleName());
}
scopedAssociation.setExecution(execution);
}
Aggregations