use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class MwCertificateX509JpaController method edit.
public void edit(MwCertificateX509 mwCertificateX509) throws NonexistentEntityException, Exception {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
mwCertificateX509 = em.merge(mwCertificateX509);
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
Integer id = mwCertificateX509.getId();
if (findMwCertificateX509(id) == null) {
throw new NonexistentEntityException("The mwCertificateX509 with id " + id + " no longer exists.");
}
}
throw ex;
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class MwKeystoreJpaController method edit.
public void edit(MwKeystore mwKeystore) throws NonexistentEntityException, Exception {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
mwKeystore = em.merge(mwKeystore);
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
Integer id = mwKeystore.getId();
if (findMwKeystore(id) == null) {
throw new NonexistentEntityException("The mwKeystore with id " + id + " no longer exists.");
}
}
throw ex;
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class MwKeystoreJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
MwKeystore mwKeystore;
try {
mwKeystore = em.getReference(MwKeystore.class, id);
mwKeystore.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The mwKeystore with id " + id + " no longer exists.", enfe);
}
em.remove(mwKeystore);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException in project OpenAttestation by OpenAttestation.
the class TblModuleManifestLogJpaController method edit.
public void edit(TblModuleManifestLog tblModuleManifestLog) throws NonexistentEntityException, ASDataException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblModuleManifestLog persistentTblModuleManifestLog = em.find(TblModuleManifestLog.class, tblModuleManifestLog.getId());
TblTaLog taLogIdOld = persistentTblModuleManifestLog.getTaLogId();
TblTaLog taLogIdNew = tblModuleManifestLog.getTaLogId();
if (taLogIdNew != null) {
taLogIdNew = em.getReference(taLogIdNew.getClass(), taLogIdNew.getId());
tblModuleManifestLog.setTaLogId(taLogIdNew);
}
tblModuleManifestLog = em.merge(tblModuleManifestLog);
if (taLogIdOld != null && !taLogIdOld.equals(taLogIdNew)) {
taLogIdOld.getTblModuleManifestLogCollection().remove(tblModuleManifestLog);
taLogIdOld = em.merge(taLogIdOld);
}
if (taLogIdNew != null && !taLogIdNew.equals(taLogIdOld)) {
taLogIdNew.getTblModuleManifestLogCollection().add(tblModuleManifestLog);
em.merge(taLogIdNew);
}
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
Integer id = tblModuleManifestLog.getId();
if (findTblModuleManifestLog(id) == null) {
throw new NonexistentEntityException("The tblModuleManifestLog 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 TblOemJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblOem tblOem;
try {
tblOem = em.getReference(TblOem.class, id);
tblOem.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblOem with id " + id + " no longer exists.", enfe);
}
em.remove(tblOem);
em.getTransaction().commit();
} finally {
em.close();
}
}
Aggregations