use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class TblTaLogJpaController method destroy.
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblTaLog tblTaLog;
try {
tblTaLog = em.getReference(TblTaLog.class, id);
tblTaLog.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblTaLog with id " + id + " no longer exists.", enfe);
}
em.remove(tblTaLog);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class TblRequestQueueJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblRequestQueue tblRequestQueue;
try {
tblRequestQueue = em.getReference(TblRequestQueue.class, id);
tblRequestQueue.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblRequestQueue with id " + id + " no longer exists.", enfe);
}
em.remove(tblRequestQueue);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class HostBO method deleteModulesForMLE.
private void deleteModulesForMLE(TxtHostRecord host) throws NonexistentEntityException, IOException {
TblMleJpaController tblMleJpaController = getMleJpaController();
TblModuleManifestJpaController tblModuleManifestJpaController = getModuleJpaController();
try {
TblMle tblMle = tblMleJpaController.findVmmMle(host.VMM_Name, host.VMM_Version, host.VMM_OSName, host.VMM_OSVersion);
if (tblMle != null) {
// Retrieve the list of all the modules for the specified VMM MLE.
List<TblModuleManifest> moduleList = tblModuleManifestJpaController.findTblModuleManifestByHardwareUuid(host.Hardware_Uuid);
if (moduleList != null && moduleList.size() > 0) {
for (TblModuleManifest moduleObj : moduleList) {
//if (moduleObj.getUseHostSpecificDigestValue()) // we cannot delete the host specific one since it would be referenced by the Hosts
// continue;
tblModuleManifestJpaController.destroy(moduleObj.getId());
}
}
}
} catch (IllegalOrphanException | NonexistentEntityException ex) {
log.error("Error during the deletion of VMM modules {}. ", host.VMM_Name, ex);
throw new ASException(ErrorCode.WS_MODULE_WHITELIST_DELETE_ERROR, ex.getClass().getSimpleName());
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class HostBO method deleteSAMLAssertions.
/**
* Deletes all the SAML assertions for the specified host. This should
* be called before deleting the host.
*
* @param hostId
*/
private void deleteSAMLAssertions(TblHosts hostId) throws IOException {
TblSamlAssertionJpaController samlJpaController = getSamlAssertionJpaController();
List<TblSamlAssertion> hostSAMLAssertions = samlJpaController.findByHostID(hostId);
if (hostSAMLAssertions != null) {
for (TblSamlAssertion hostSAML : hostSAMLAssertions) {
try {
samlJpaController.destroy(hostSAML.getId());
} catch (NonexistentEntityException e) {
log.error("Ta Log is already deleted " + hostSAML.getId());
}
}
log.info("Deleted all the logs for the given host " + hostId);
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class HostBO method deleteTALogs.
private void deleteTALogs(Integer hostId) throws IllegalOrphanException {
TblTaLogJpaController tblTaLogJpaController = getTaLogJpaController();
List<TblTaLog> taLogs = tblTaLogJpaController.findLogsByHostId(hostId, new Date());
if (taLogs != null) {
for (TblTaLog taLog : taLogs) {
try {
tblTaLogJpaController.destroy(taLog.getId());
} catch (NonexistentEntityException e) {
log.warn("Ta Log is already deleted " + taLog.getId());
}
}
log.info("Deleted all the logs for the given host " + hostId);
}
}
Aggregations