if (cascade) {
for (String processInstanceId: processInstanceIds) {
dbSession.deleteProcessInstance(processInstanceId, true);
}
dbSession.deleteProcessDefinitionHistory(processDefinitionId);
} else {
if (!processInstanceIds.isEmpty()) {
throw new JbpmException("cannot delete deployment "+deploymentId+": still executions for "+processDefinition+": "+processInstanceIds);
}