use of io.automatiko.engine.api.runtime.process.ProcessWorkItemHandlerException in project automatiko-engine by automatiko-io.
the class WorkItemNodeInstance method internalTrigger.
@Override
public void internalTrigger(final NodeInstance from, String type) {
super.internalTrigger(from, type);
// if node instance was cancelled, abort
if (getNodeInstanceContainer().getNodeInstance(getId()) == null) {
return;
}
WorkItemNode workItemNode = getWorkItemNode();
createWorkItem(workItemNode);
if (workItemNode.isWaitForCompletion()) {
addWorkItemListener();
}
((WorkItemImpl) workItem).setNodeInstanceId(this.getId());
((WorkItemImpl) workItem).setNodeId(getNodeId());
workItem.setNodeInstance(this);
workItem.setProcessInstance(getProcessInstance());
setProcessId();
try {
((DefaultWorkItemManager) getProcessInstance().getProcessRuntime().getWorkItemManager()).internalExecuteWorkItem(workItem);
} catch (WorkItemHandlerNotFoundException wihnfe) {
getProcessInstance().setState(STATE_ABORTED);
throw wihnfe;
} catch (ProcessWorkItemHandlerException handlerException) {
this.workItemId = workItem.getId();
removeEventListeners();
handleWorkItemHandlerException(handlerException, workItem);
} catch (WorkItemExecutionError e) {
removeEventListeners();
handleException(e.getErrorCode(), e);
} catch (Exception e) {
removeEventListeners();
String exceptionName = e.getClass().getName();
handleException(exceptionName, e);
}
if (!workItemNode.isWaitForCompletion()) {
triggerCompleted();
}
this.workItemId = workItem.getId();
}
Aggregations