if (processEngine == null) {
out().println("Process Engine NOT Found!");
return null;
}
RuntimeService runtimeService = processEngine.getRuntimeService();
if (this.instanceIDs != null && this.instanceIDs.length > 0) {
for (String instanceID : instanceIDs) {
runtimeService.deleteProcessInstance(instanceID, "Forcefully terminating the instance");
out().printf("Process instance %s terminated\n", instanceID);
}
return null;
}
if (!killAll) {
out().println("Process instance IDs required or use the command with -a or --all option");
return null;
} else {
out().println("Signalling all executions in all active process instances...");
List<ProcessInstance> piList = runtimeService.createProcessInstanceQuery().orderByProcessInstanceId().asc().list();
for (ProcessInstance pi : piList) {
String instanceID = pi.getProcessInstanceId();
runtimeService.deleteProcessInstance(instanceID, "Forcefully terminating the instance");
out().printf("Process instance %s terminated\n", instanceID);
}
}
return null;