public WorkItem getWorkItem(long id) {
return workItems.get(id);
}
public void completeWorkItem(long id, Map<String, Object> results) {
WorkItem workItem = workItems.get(new Long(id));
// work item may have been aborted
if (workItem != null) {
(workItem).setResults(results);
ProcessInstance processInstance = kruntime.getProcessInstance(workItem.getProcessInstanceId());
(workItem).setState(WorkItem.COMPLETED);
// process instance may have finished already
if (processInstance != null) {
processInstance.signalEvent("workItemCompleted", workItem);
}