}
}
public void deleteHistoricProcessInstanceById(String historicProcessInstanceId) {
if (getHistoryManager().isHistoryEnabled()) {
CommandContext commandContext = Context.getCommandContext();
HistoricProcessInstanceEntity historicProcessInstance = findHistoricProcessInstance(historicProcessInstanceId);
commandContext
.getHistoricDetailManager()
.deleteHistoricDetailsByProcessInstanceId(historicProcessInstanceId);
commandContext
.getHistoricVariableInstanceManager()
.deleteHistoricVariableInstanceByProcessInstanceId(historicProcessInstanceId);
commandContext
.getHistoricActivityInstanceManager()
.deleteHistoricActivityInstancesByProcessInstanceId(historicProcessInstanceId);
commandContext
.getHistoricTaskInstanceManager()
.deleteHistoricTaskInstancesByProcessInstanceId(historicProcessInstanceId);
getDbSqlSession().delete(historicProcessInstance);
}