protected void deleteHistoricVariableInstancesByProcessCaseInstanceId(String historicProcessInstanceId, String historicCaseInstanceId) { ensureOnlyOneNotNull("Only the process instance or case instance id should be set", historicProcessInstanceId, historicCaseInstanceId); if (isHistoryEnabled()) { // delete entries in DB List<HistoricVariableInstance> historicVariableInstances; if (historicProcessInstanceId != null) { historicVariableInstances = findHistoricVariableInstancesByProcessInstanceId(historicProcessInstanceId); } else { historicVariableInstances = findHistoricVariableInstancesByCaseInstanceId(historicCaseInstanceId); } for (HistoricVariableInstance historicVariableInstance : historicVariableInstances) { ((HistoricVariableInstanceEntity) historicVariableInstance).delete(); } // delete entries in Cache List <HistoricVariableInstanceEntity> cachedHistoricVariableInstances = getDbEntityManager().getCachedEntitiesByType(HistoricVariableInstanceEntity.class); for (HistoricVariableInstanceEntity historicVariableInstance : cachedHistoricVariableInstances) { // make sure we only delete the right ones (as we cannot make a proper query in the cache) if ((historicProcessInstanceId != null && historicProcessInstanceId.equals(historicVariableInstance.getProcessInstanceId())) || (historicCaseInstanceId != null && historicCaseInstanceId.equals(historicVariableInstance.getCaseInstanceId()))) { historicVariableInstance.delete(); } } } }
protected void deleteHistoricVariableInstancesByProcessCaseInstanceId(String historicProcessInstanceId, String historicCaseInstanceId) { ensureOnlyOneNotNull("Only the process instance or case instance id should be set", historicProcessInstanceId, historicCaseInstanceId); if (isHistoryEnabled()) { // delete entries in DB List<HistoricVariableInstance> historicVariableInstances; if (historicProcessInstanceId != null) { historicVariableInstances = findHistoricVariableInstancesByProcessInstanceId(historicProcessInstanceId); } else { historicVariableInstances = findHistoricVariableInstancesByCaseInstanceId(historicCaseInstanceId); } for (HistoricVariableInstance historicVariableInstance : historicVariableInstances) { ((HistoricVariableInstanceEntity) historicVariableInstance).delete(); } // delete entries in Cache List <HistoricVariableInstanceEntity> cachedHistoricVariableInstances = getDbEntityManager().getCachedEntitiesByType(HistoricVariableInstanceEntity.class); for (HistoricVariableInstanceEntity historicVariableInstance : cachedHistoricVariableInstances) { // make sure we only delete the right ones (as we cannot make a proper query in the cache) if ((historicProcessInstanceId != null && historicProcessInstanceId.equals(historicVariableInstance.getProcessInstanceId())) || (historicCaseInstanceId != null && historicCaseInstanceId.equals(historicVariableInstance.getCaseInstanceId()))) { historicVariableInstance.delete(); } } } }
protected void deleteHistoricVariableInstancesByProcessCaseInstanceId(String historicProcessInstanceId, String historicCaseInstanceId) { ensureOnlyOneNotNull("Only the process instance or case instance id should be set", historicProcessInstanceId, historicCaseInstanceId); if (isHistoryEnabled()) { // delete entries in DB List<HistoricVariableInstance> historicVariableInstances; if (historicProcessInstanceId != null) { historicVariableInstances = findHistoricVariableInstancesByProcessInstanceId(historicProcessInstanceId); } else { historicVariableInstances = findHistoricVariableInstancesByCaseInstanceId(historicCaseInstanceId); } for (HistoricVariableInstance historicVariableInstance : historicVariableInstances) { ((HistoricVariableInstanceEntity) historicVariableInstance).delete(); } // delete entries in Cache List <HistoricVariableInstanceEntity> cachedHistoricVariableInstances = getDbEntityManager().getCachedEntitiesByType(HistoricVariableInstanceEntity.class); for (HistoricVariableInstanceEntity historicVariableInstance : cachedHistoricVariableInstances) { // make sure we only delete the right ones (as we cannot make a proper query in the cache) if ((historicProcessInstanceId != null && historicProcessInstanceId.equals(historicVariableInstance.getProcessInstanceId())) || (historicCaseInstanceId != null && historicCaseInstanceId.equals(historicVariableInstance.getCaseInstanceId()))) { historicVariableInstance.delete(); } } } }