use of com.intel.mtwilson.as.data.TblModuleManifestLog 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();
}
}
use of com.intel.mtwilson.as.data.TblModuleManifestLog in project OpenAttestation by OpenAttestation.
the class TblModuleManifestLogJpaController method getTblModuleManifestLogCount.
public int getTblModuleManifestLogCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<TblModuleManifestLog> rt = cq.from(TblModuleManifestLog.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.data.TblModuleManifestLog 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.data.TblModuleManifestLog in project OpenAttestation by OpenAttestation.
the class TblModuleManifestLogJpaController method findTblModuleManifestLogEntities.
private List<TblModuleManifestLog> findTblModuleManifestLogEntities(boolean all, int maxResults, int firstResult) {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(TblModuleManifestLog.class));
Query q = em.createQuery(cq);
if (!all) {
q.setMaxResults(maxResults);
q.setFirstResult(firstResult);
}
return q.getResultList();
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.data.TblModuleManifestLog in project OpenAttestation by OpenAttestation.
the class TblModuleManifestLogJpaController method findByTaLogIdAndName.
public TblModuleManifestLog findByTaLogIdAndName(TblTaLog tblTaLog, String componentName) {
EntityManager em = getEntityManager();
try {
Query query = em.createNamedQuery("TblModuleManifestLog.findByTaLogIdAndName");
query.setParameter("taLogId", tblTaLog);
query.setParameter("name", componentName);
TblModuleManifestLog singleResult = (TblModuleManifestLog) query.getSingleResult();
return singleResult;
} catch (NoResultException e) {
return null;
} finally {
em.close();
}
}
Aggregations