}
public void processStop(ProcessStopMsg psMsg) throws Exception {
ProcessInstance instance = pm.getProcessInstance(psMsg.getInstanceId());
EndActivity endActivity = new EndActivity();
endActivity.setEscalate(true);
String instanceStatus = psMsg.getInstanceStatus();
if (ProcessStopMsg.INSTANCE_STATUS_CANCELLED.equalsIgnoreCase(instanceStatus)) {
endActivity.setStatus(EndActivity.STATUS_CANCELLED);
} else if (ProcessStopMsg.INSTANCE_STATUS_COMPLETED.equalsIgnoreCase(instanceStatus)) {
endActivity.setStatus(EndActivity.STATUS_COMPLETED);
} else if (ProcessStopMsg.INSTANCE_STATUS_FAULT.equalsIgnoreCase(instanceStatus)) {
endActivity.setStatus(EndActivity.STATUS_FAULT);
} else if (ProcessStopMsg.INSTANCE_STATUS_STOPPED.equalsIgnoreCase(instanceStatus)) {
endActivity.setStatus(EndActivity.STATUS_STOPPED);
} else {
endActivity.setStatus(EndActivity.STATUS_COMPLETED);
}
endActivity.executeActivity(instance);
}