use of org.activiti.engine.HistoryService in project Activiti by Activiti.
the class MyTransactionalOperationTransactionDependentTaskListener method notify.
@Override
public void notify(String processInstanceId, String executionId, Task task, Map<String, Object> executionVariables, Map<String, Object> customPropertiesMap) {
super.notify(processInstanceId, executionId, task, executionVariables, customPropertiesMap);
if (Context.getCommandContext().getProcessEngineConfiguration().getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
HistoryService historyService = Context.getCommandContext().getProcessEngineConfiguration().getHistoryService();
// delete first historic instance
List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().list();
historyService.deleteHistoricProcessInstance(historicProcessInstances.get(0).getId());
}
}
Aggregations