use of io.automatiko.engine.api.runtime.process.WorkItemNotFoundException in project automatiko-engine by automatiko-io.
the class LightWorkItemManager method transitionWorkItem.
@SuppressWarnings("unchecked")
@Override
public void transitionWorkItem(String id, Transition<?> transition) {
WorkItem workItem = workItems.get(id);
// work item may have been aborted
if (workItem != null) {
WorkItemHandler handler = this.workItemHandlers.get(workItem.getName());
if (handler != null) {
ProcessInstance processInstance = workItem.getProcessInstance();
eventSupport.fireBeforeWorkItemTransition(processInstance, workItem, transition, null);
try {
handler.transitionToPhase(workItem, this, transition);
} catch (UnsupportedOperationException e) {
((WorkItemImpl) workItem).setResults((Map<String, Object>) transition.data());
workItem.setPhaseId(Complete.ID);
workItem.setPhaseStatus(Complete.STATUS);
completePhase.apply(workItem, transition);
internalCompleteWorkItem(workItem);
}
eventSupport.fireAfterWorkItemTransition(processInstance, workItem, transition, null);
} else {
throw new WorkItemHandlerNotFoundException(workItem.getName());
}
} else {
throw new WorkItemNotFoundException("Work Item (" + id + ") does not exist", id);
}
}
Aggregations