use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblModuleManifestJpaController method destroy.
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblModuleManifest tblModuleManifest;
try {
tblModuleManifest = em.getReference(TblModuleManifest.class, id);
tblModuleManifest.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblModuleManifest with id " + id + " no longer exists.", enfe);
}
List<String> illegalOrphanMessages = null;
Collection<TblHostSpecificManifest> tblHostSpecificManifestCollectionOrphanCheck = tblModuleManifest.getTblHostSpecificManifestCollection();
for (TblHostSpecificManifest tblHostSpecificManifestCollectionOrphanCheckTblHostSpecificManifest : tblHostSpecificManifestCollectionOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This TblModuleManifest (" + tblModuleManifest + ") cannot be destroyed since the TblHostSpecificManifest " + tblHostSpecificManifestCollectionOrphanCheckTblHostSpecificManifest + " in its tblHostSpecificManifestCollection field has a non-nullable moduleManifestID field.");
}
if (illegalOrphanMessages != null) {
throw new IllegalOrphanException(illegalOrphanMessages);
}
// @since 1.1 we are relying on the audit log for "created on", "created by", etc. type information
/*
TblDbPortalUser updatedBy = tblModuleManifest.getUpdatedBy();
if (updatedBy != null) {
updatedBy.getTblModuleManifestCollection().remove(tblModuleManifest);
em.merge(updatedBy);
}
TblDbPortalUser createdBy = tblModuleManifest.getCreatedBy();
if (createdBy != null) {
createdBy.getTblModuleManifestCollection().remove(tblModuleManifest);
em.merge(createdBy);
}
*/
TblMle mleId = tblModuleManifest.getMleId();
if (mleId != null) {
mleId.getTblModuleManifestCollection().remove(tblModuleManifest);
em.merge(mleId);
}
TblEventType eventID = tblModuleManifest.getEventID();
if (eventID != null) {
eventID.getTblModuleManifestCollection().remove(tblModuleManifest);
em.merge(eventID);
}
TblPackageNamespace nameSpaceID = tblModuleManifest.getNameSpaceID();
if (nameSpaceID != null) {
nameSpaceID.getTblModuleManifestCollection().remove(tblModuleManifest);
em.merge(nameSpaceID);
}
em.remove(tblModuleManifest);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblOsJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblOs tblOs;
try {
tblOs = em.getReference(TblOs.class, id);
tblOs.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblOs with id " + id + " no longer exists.", enfe);
}
em.remove(tblOs);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblPackageNamespaceJpaController method destroy.
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblPackageNamespace tblPackageNamespace;
try {
tblPackageNamespace = em.getReference(TblPackageNamespace.class, id);
tblPackageNamespace.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblPackageNamespace with id " + id + " no longer exists.", enfe);
}
List<String> illegalOrphanMessages = null;
Collection<TblModuleManifest> tblModuleManifestCollectionOrphanCheck = tblPackageNamespace.getTblModuleManifestCollection();
for (TblModuleManifest tblModuleManifestCollectionOrphanCheckTblModuleManifest : tblModuleManifestCollectionOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This TblPackageNamespace (" + tblPackageNamespace + ") cannot be destroyed since the TblModuleManifest " + tblModuleManifestCollectionOrphanCheckTblModuleManifest + " in its tblModuleManifestCollection field has a non-nullable nameSpaceID field.");
}
if (illegalOrphanMessages != null) {
throw new IllegalOrphanException(illegalOrphanMessages);
}
em.remove(tblPackageNamespace);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblPcrManifestJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblPcrManifest tblPcrManifest;
try {
tblPcrManifest = em.getReference(TblPcrManifest.class, id);
tblPcrManifest.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblPcrManifest with id " + id + " no longer exists.", enfe);
}
// @since 1.1 we are relying on the audit log for "created on", "created by", etc. type information
/*
TblDbPortalUser updatedBy = tblPcrManifest.getUpdatedBy();
if (updatedBy != null) {
updatedBy.getTblPcrManifestCollection().remove(tblPcrManifest);
em.merge(updatedBy);
}
TblDbPortalUser createdBy = tblPcrManifest.getCreatedBy();
if (createdBy != null) {
createdBy.getTblPcrManifestCollection().remove(tblPcrManifest);
em.merge(createdBy);
}
*/
TblMle mleId = tblPcrManifest.getMleId();
if (mleId != null) {
mleId.getTblPcrManifestCollection().remove(tblPcrManifest);
em.merge(mleId);
}
em.remove(tblPcrManifest);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblModuleManifestLogJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblModuleManifestLog tblModuleManifestLog;
try {
tblModuleManifestLog = em.getReference(TblModuleManifestLog.class, id);
tblModuleManifestLog.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblModuleManifestLog with id " + id + " no longer exists.", enfe);
}
TblTaLog taLogId = tblModuleManifestLog.getTaLogId();
if (taLogId != null) {
taLogId.getTblModuleManifestLogCollection().remove(tblModuleManifestLog);
em.merge(taLogId);
}
em.remove(tblModuleManifestLog);
em.getTransaction().commit();
} finally {
em.close();
}
}
Aggregations