use of org.jbpm.casemgmt.api.event.CaseCancelEvent in project jbpm by kiegroup.
the class NotifyParentCaseEventListener method afterProcessCompleted.
@Override
public void afterProcessCompleted(ProcessCompletedEvent event) {
CaseFileInstance caseFile = getCaseFile((KieSession) event.getKieRuntime());
if (caseFile != null) {
String caseId = ((WorkflowProcessInstanceImpl) event.getProcessInstance()).getCorrelationKey();
if (caseFile.getCaseId().equals(caseId)) {
logger.debug("Process instance {} that represents main case instance {} has completed/was aborted, notify parent if exists", event.getProcessInstance().getId(), caseId);
CaseEvent caseEvent = null;
if (event.getProcessInstance().getState() == ProcessInstance.STATE_COMPLETED) {
caseEvent = new CaseCloseEvent(identityProvider.getName(), caseId, caseFile, "");
} else {
caseEvent = new CaseCancelEvent(identityProvider.getName(), caseId, caseFile, Arrays.asList(event.getProcessInstance().getId()));
}
notifyParentOnCompletion(caseEvent);
}
}
}
Aggregations