}
private void cleanProcessInstanceHistory(HistoryService hs, String... instances) {
for (String instanceId : instances) {
// query and if exists delete.
HistoricProcessInstance hpi = hs.createHistoricProcessInstanceQuery()
.processInstanceId(instanceId).singleResult();
if (hpi != null) {
hs.deleteHistoricProcessInstance(hpi.getId());
out().printf("History removed for process instance %s \n", hpi.getId());
} else {
out().printf("No History found for process instance %s \n", instanceId);
}
}
}