use of org.jbpm.services.api.ProcessService in project jbpm by kiegroup.
the class NotifyParentCaseEventListener method notifyParentOnCompletion.
protected void notifyParentOnCompletion(CaseEvent event) {
CaseFileInstanceImpl caseFileInstance = (CaseFileInstanceImpl) event.getCaseFile();
if (caseFileInstance == null) {
return;
}
if (caseFileInstance.getParentInstanceId() != null && caseFileInstance.getParentWorkItemId() != null) {
logger.debug("Case {} has defined parent information instance {}, work item {}, going to notify it", event.getCaseId(), caseFileInstance.getParentInstanceId(), caseFileInstance.getParentWorkItemId());
ProcessService processService = (ProcessService) ServiceRegistry.get().service(ServiceRegistry.PROCESS_SERVICE);
Map<String, Object> results = new HashMap<>(caseFileInstance.getData());
results.put("CaseId", event.getCaseId());
processService.completeWorkItem(caseFileInstance.getParentWorkItemId(), results);
logger.debug("Parent instance id {}, work item id {}, has been successfully notified about case {} completion", caseFileInstance.getParentInstanceId(), caseFileInstance.getParentWorkItemId(), event.getCaseId());
caseFileInstance.setParentInstanceId(null);
caseFileInstance.setParentWorkItemId(null);
}
}
Aggregations