use of org.activiti.engine.impl.HistoricProcessInstanceQueryImpl in project Activiti by Activiti.
the class HistoricProcessInstanceEntityManager method deleteHistoricProcessInstanceById.
@SuppressWarnings("unchecked")
public void deleteHistoricProcessInstanceById(String historicProcessInstanceId) {
if (getHistoryManager().isHistoryEnabled()) {
CommandContext commandContext = Context.getCommandContext();
HistoricProcessInstanceEntity historicProcessInstance = findHistoricProcessInstance(historicProcessInstanceId);
commandContext.getHistoricDetailEntityManager().deleteHistoricDetailsByProcessInstanceId(historicProcessInstanceId);
commandContext.getHistoricVariableInstanceEntityManager().deleteHistoricVariableInstanceByProcessInstanceId(historicProcessInstanceId);
commandContext.getHistoricActivityInstanceEntityManager().deleteHistoricActivityInstancesByProcessInstanceId(historicProcessInstanceId);
commandContext.getHistoricTaskInstanceEntityManager().deleteHistoricTaskInstancesByProcessInstanceId(historicProcessInstanceId);
commandContext.getHistoricIdentityLinkEntityManager().deleteHistoricIdentityLinksByProcInstance(historicProcessInstanceId);
commandContext.getCommentEntityManager().deleteCommentsByProcessInstanceId(historicProcessInstanceId);
commandContext.getAttachmentEntityManager().deleteAttachmentsByProcessInstanceId(historicProcessInstanceId);
getDbSqlSession().delete(historicProcessInstance);
// Also delete any sub-processes that may be active (ACT-821)
HistoricProcessInstanceQueryImpl subProcessesQueryImpl = new HistoricProcessInstanceQueryImpl();
subProcessesQueryImpl.superProcessInstanceId(historicProcessInstanceId);
List<HistoricProcessInstance> selectList = getDbSqlSession().selectList("selectHistoricProcessInstancesByQueryCriteria", subProcessesQueryImpl);
for (HistoricProcessInstance child : selectList) {
deleteHistoricProcessInstanceById(child.getId());
}
}
}
Aggregations