use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class MwAssetTagCertificateJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
MwAssetTagCertificate mwAssetTagCertificate;
try {
mwAssetTagCertificate = em.getReference(MwAssetTagCertificate.class, id);
mwAssetTagCertificate.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The mwAssetTagCertificate with id " + id + " no longer exists.", enfe);
}
em.remove(mwAssetTagCertificate);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class MwAssetTagCertificateJpaController method edit.
public void edit(MwAssetTagCertificate mwAssetTagCertificate) {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
mwAssetTagCertificate = em.merge(mwAssetTagCertificate);
mwAssetTagCertificate.getId();
em.getTransaction().commit();
} catch (PersistenceException ex) {
String msg = ex.getLocalizedMessage();
Integer id = mwAssetTagCertificate.getId();
if (msg == null || msg.length() == 0) {
if (id != null && findMwAssetTagCertificate(id) == null) {
try {
throw new NonexistentEntityException("The mwAssetTagCertificate with id " + id + " no longer exists.");
} catch (NonexistentEntityException ex1) {
Logger.getLogger(MwAssetTagCertificateJpaController.class.getName()).log(Level.SEVERE, null, ex1);
}
}
}
throw ex;
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class MwCertificateX509JpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
MwCertificateX509 mwCertificateX509;
try {
mwCertificateX509 = em.getReference(MwCertificateX509.class, id);
mwCertificateX509.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The mwCertificateX509 with id " + id + " no longer exists.", enfe);
}
em.remove(mwCertificateX509);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class TblTaLogJpaController method edit.
public void edit(TblTaLog tblTaLog) throws IllegalOrphanException, NonexistentEntityException, ASDataException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
// commenting out unused variable for klocwork scans
// stdalex 3/4
//TblTaLog persistentTblTaLog = em.find(TblTaLog.class, tblTaLog.getId());
em.merge(tblTaLog);
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
Integer id = tblTaLog.getId();
if (findTblTaLog(id) == null) {
throw new NonexistentEntityException("The tblTaLog with id " + id + " no longer exists.");
}
}
throw new ASDataException(ex);
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class TblMleJpaController method destroy.
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblMle tblMle;
try {
tblMle = em.getReference(TblMle.class, id);
tblMle.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblMle with id " + id + " no longer exists.", enfe);
}
List<String> illegalOrphanMessages = null;
Collection<TblHosts> tblHostsCollectionOrphanCheck = tblMle.getTblHostsCollection();
for (TblHosts tblHostsCollectionOrphanCheckTblHosts : tblHostsCollectionOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This TblMle (" + tblMle + ") cannot be destroyed since the TblHosts " + tblHostsCollectionOrphanCheckTblHosts + " in its tblHostsCollection field has a non-nullable vmmMleId field.");
}
Collection<TblHosts> tblHostsCollection1OrphanCheck = tblMle.getTblHostsCollection1();
for (TblHosts tblHostsCollection1OrphanCheckTblHosts : tblHostsCollection1OrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This TblMle (" + tblMle + ") cannot be destroyed since the TblHosts " + tblHostsCollection1OrphanCheckTblHosts + " in its tblHostsCollection1 field has a non-nullable biosMleId field.");
}
Collection<TblPcrManifest> tblPcrManifestCollectionOrphanCheck = tblMle.getTblPcrManifestCollection();
for (TblPcrManifest tblPcrManifestCollectionOrphanCheckTblPcrManifest : tblPcrManifestCollectionOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This TblMle (" + tblMle + ") cannot be destroyed since the TblPcrManifest " + tblPcrManifestCollectionOrphanCheckTblPcrManifest + " in its tblPcrManifestCollection field has a non-nullable mleId field.");
}
if (illegalOrphanMessages != null) {
throw new IllegalOrphanException(illegalOrphanMessages);
}
em.remove(tblMle);
em.getTransaction().commit();
} finally {
em.close();
}
}
Aggregations