Examples of TblMle


Examples of com.intel.mtwilson.as.data.TblMle

    public void edit(TblMle tblMle) throws IllegalOrphanException, NonexistentEntityException, ASDataException {
        EntityManager em = getEntityManager();
        try {
            em.getTransaction().begin();
            TblMle persistentTblMle = em.find(TblMle.class, tblMle.getId());
            Collection<TblHosts> tblHostsCollectionOld = persistentTblMle.getTblHostsCollection();
            Collection<TblHosts> tblHostsCollectionNew = tblMle.getTblHostsCollection();
            Collection<TblHosts> tblHostsCollection1Old = persistentTblMle.getTblHostsCollection1();
            Collection<TblHosts> tblHostsCollection1New = tblMle.getTblHostsCollection1();
            Collection<TblPcrManifest> tblPcrManifestCollectionOld = persistentTblMle.getTblPcrManifestCollection();
            Collection<TblPcrManifest> tblPcrManifestCollectionNew = tblMle.getTblPcrManifestCollection();
            List<String> illegalOrphanMessages = null;
            for (TblHosts tblHostsCollectionOldTblHosts : tblHostsCollectionOld) {
                if (!tblHostsCollectionNew.contains(tblHostsCollectionOldTblHosts)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain TblHosts " + tblHostsCollectionOldTblHosts + " since its vmmMleId field is not nullable.");
                }
            }
            for (TblHosts tblHostsCollection1OldTblHosts : tblHostsCollection1Old) {
                if (!tblHostsCollection1New.contains(tblHostsCollection1OldTblHosts)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain TblHosts " + tblHostsCollection1OldTblHosts + " since its biosMleId field is not nullable.");
                }
            }
            for (TblPcrManifest tblPcrManifestCollectionOldTblPcrManifest : tblPcrManifestCollectionOld) {
                if (!tblPcrManifestCollectionNew.contains(tblPcrManifestCollectionOldTblPcrManifest)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain TblPcrManifest " + tblPcrManifestCollectionOldTblPcrManifest + " since its mleId field is not nullable.");
                }
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            Collection<TblHosts> attachedTblHostsCollectionNew = new ArrayList<TblHosts>();
            for (TblHosts tblHostsCollectionNewTblHostsToAttach : tblHostsCollectionNew) {
                tblHostsCollectionNewTblHostsToAttach = em.getReference(tblHostsCollectionNewTblHostsToAttach.getClass(), tblHostsCollectionNewTblHostsToAttach.getId());
                attachedTblHostsCollectionNew.add(tblHostsCollectionNewTblHostsToAttach);
            }
            tblHostsCollectionNew = attachedTblHostsCollectionNew;
            tblMle.setTblHostsCollection(tblHostsCollectionNew);
            Collection<TblHosts> attachedTblHostsCollection1New = new ArrayList<TblHosts>();
            for (TblHosts tblHostsCollection1NewTblHostsToAttach : tblHostsCollection1New) {
                tblHostsCollection1NewTblHostsToAttach = em.getReference(tblHostsCollection1NewTblHostsToAttach.getClass(), tblHostsCollection1NewTblHostsToAttach.getId());
                attachedTblHostsCollection1New.add(tblHostsCollection1NewTblHostsToAttach);
            }
            tblHostsCollection1New = attachedTblHostsCollection1New;
            tblMle.setTblHostsCollection1(tblHostsCollection1New);
            Collection<TblPcrManifest> attachedTblPcrManifestCollectionNew = new ArrayList<TblPcrManifest>();
            for (TblPcrManifest tblPcrManifestCollectionNewTblPcrManifestToAttach : tblPcrManifestCollectionNew) {
                tblPcrManifestCollectionNewTblPcrManifestToAttach = em.getReference(tblPcrManifestCollectionNewTblPcrManifestToAttach.getClass(), tblPcrManifestCollectionNewTblPcrManifestToAttach.getId());
                attachedTblPcrManifestCollectionNew.add(tblPcrManifestCollectionNewTblPcrManifestToAttach);
            }
            tblPcrManifestCollectionNew = attachedTblPcrManifestCollectionNew;
            tblMle.setTblPcrManifestCollection(tblPcrManifestCollectionNew);
            tblMle = em.merge(tblMle);
            for (TblHosts tblHostsCollectionNewTblHosts : tblHostsCollectionNew) {
                if (!tblHostsCollectionOld.contains(tblHostsCollectionNewTblHosts)) {
                    TblMle oldVmmMleIdOfTblHostsCollectionNewTblHosts = tblHostsCollectionNewTblHosts.getVmmMleId();
                    tblHostsCollectionNewTblHosts.setVmmMleId(tblMle);
                    tblHostsCollectionNewTblHosts = em.merge(tblHostsCollectionNewTblHosts);
                    if (oldVmmMleIdOfTblHostsCollectionNewTblHosts != null && !oldVmmMleIdOfTblHostsCollectionNewTblHosts.equals(tblMle)) {
                        oldVmmMleIdOfTblHostsCollectionNewTblHosts.getTblHostsCollection().remove(tblHostsCollectionNewTblHosts);
                        em.merge(oldVmmMleIdOfTblHostsCollectionNewTblHosts);
                    }
                }
            }
            for (TblHosts tblHostsCollection1NewTblHosts : tblHostsCollection1New) {
                if (!tblHostsCollection1Old.contains(tblHostsCollection1NewTblHosts)) {
                    TblMle oldBiosMleIdOfTblHostsCollection1NewTblHosts = tblHostsCollection1NewTblHosts.getBiosMleId();
                    tblHostsCollection1NewTblHosts.setBiosMleId(tblMle);
                    tblHostsCollection1NewTblHosts = em.merge(tblHostsCollection1NewTblHosts);
                    if (oldBiosMleIdOfTblHostsCollection1NewTblHosts != null && !oldBiosMleIdOfTblHostsCollection1NewTblHosts.equals(tblMle)) {
                        oldBiosMleIdOfTblHostsCollection1NewTblHosts.getTblHostsCollection1().remove(tblHostsCollection1NewTblHosts);
                        em.merge(oldBiosMleIdOfTblHostsCollection1NewTblHosts);
                    }
                }
            }
            for (TblPcrManifest tblPcrManifestCollectionNewTblPcrManifest : tblPcrManifestCollectionNew) {
                if (!tblPcrManifestCollectionOld.contains(tblPcrManifestCollectionNewTblPcrManifest)) {
                    TblMle oldMleIdOfTblPcrManifestCollectionNewTblPcrManifest = tblPcrManifestCollectionNewTblPcrManifest.getMleId();
                    tblPcrManifestCollectionNewTblPcrManifest.setMleId(tblMle);
                    tblPcrManifestCollectionNewTblPcrManifest = em.merge(tblPcrManifestCollectionNewTblPcrManifest);
                    if (oldMleIdOfTblPcrManifestCollectionNewTblPcrManifest != null && !oldMleIdOfTblPcrManifestCollectionNewTblPcrManifest.equals(tblMle)) {
                        oldMleIdOfTblPcrManifestCollectionNewTblPcrManifest.getTblPcrManifestCollection().remove(tblPcrManifestCollectionNewTblPcrManifest);
                        em.merge(oldMleIdOfTblPcrManifestCollectionNewTblPcrManifest);
                    }
                }
            }
            em.getTransaction().commit();
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

    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.");
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

        }
    }

    public TblMle findMleByNameAndVersion(String name, String version, String mleType) {

        TblMle mle = null;
        EntityManager em = getEntityManager();
        try {        
            Query query = em.createNamedQuery("TblMle.findByNameAndVersion");

            query.setParameter("name", name);
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

        return mle;
    }
   
    public TblMle findMleByNameAndVersion(String name, String version) {

        TblMle mle = null;
        EntityManager em = getEntityManager();
        try {          
            Query query = em.createNamedQuery("TblMle.findByNameAndVersionNoType");

            query.setParameter("name", name);
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

            query.setParameter("id", id);
           
            query.setHint(QueryHints.REFRESH, HintValues.TRUE);
            query.setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache);
           
            TblMle mle= (TblMle) query.getSingleResult();
            return mle;

        } finally {
            em.close();
        }
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

            query.setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache);
           
           
            try {
             
              TblMle mle = (TblMle) query.getSingleResult();
              return mle;
            } catch (NoResultException e) {
                log.info( "NoResultException: BIOS MLE does not exist Name {} Version {} Oem Name {} ",
                        new String[]{mleName, mleVersion, oemName});
                return null;
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

            query.setHint(QueryHints.REFRESH, HintValues.TRUE);
            query.setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache);

           
            try {
              TblMle mle = (TblMle) query.getSingleResult();
                return mle;

            } catch (NoResultException e) {
                log.info( "NoResultException: VMM MLE does not exist Name {} Version {} Os Name {} Os Version {}",
                        new String[]{mleName, mleVersion, osName, osVersion});
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

            TblDbPortalUser createdBy = tblPcrManifest.getCreatedBy();
            if (createdBy != null) {
                createdBy = em.getReference(createdBy.getClass(), createdBy.getId());
                tblPcrManifest.setCreatedBy(createdBy);
            }*/
            TblMle mleId = tblPcrManifest.getMleId();
            if (mleId != null) {
                mleId = em.getReference(mleId.getClass(), mleId.getId());
                tblPcrManifest.setMleId(mleId);
            }
            em.persist(tblPcrManifest);
            // @since 1.1 we are relying on the audit log for "created on", "created by", etc. type information
            /*
            if (updatedBy != null) {
                updatedBy.getTblPcrManifestCollection().add(tblPcrManifest);
                em.merge(updatedBy);
            }
            if (createdBy != null) {
                createdBy.getTblPcrManifestCollection().add(tblPcrManifest);
                em.merge(createdBy);
            }*/
            if (mleId != null) {
                mleId.getTblPcrManifestCollection().add(tblPcrManifest);
                em.merge(mleId);
            }
            em.getTransaction().commit();
        } finally {
                em.close();
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

            TblDbPortalUser updatedByOld = persistentTblPcrManifest.getUpdatedBy();
            TblDbPortalUser updatedByNew = tblPcrManifest.getUpdatedBy();
            TblDbPortalUser createdByOld = persistentTblPcrManifest.getCreatedBy();
            TblDbPortalUser createdByNew = tblPcrManifest.getCreatedBy();
            */
            TblMle mleIdOld = persistentTblPcrManifest.getMleId();
            TblMle mleIdNew = tblPcrManifest.getMleId();
            // @since 1.1 we are relying on the audit log for "created on", "created by", etc. type information
            /*
            if (updatedByNew != null) {
                updatedByNew = em.getReference(updatedByNew.getClass(), updatedByNew.getId());
                tblPcrManifest.setUpdatedBy(updatedByNew);
            }
            if (createdByNew != null) {
                createdByNew = em.getReference(createdByNew.getClass(), createdByNew.getId());
                tblPcrManifest.setCreatedBy(createdByNew);
            }*/
            if (mleIdNew != null) {
                mleIdNew = em.getReference(mleIdNew.getClass(), mleIdNew.getId());
                tblPcrManifest.setMleId(mleIdNew);
            }
            tblPcrManifest = em.merge(tblPcrManifest);
            // @since 1.1 we are relying on the audit log for "created on", "created by", etc. type information
            /*
            if (updatedByOld != null && !updatedByOld.equals(updatedByNew)) {
                updatedByOld.getTblPcrManifestCollection().remove(tblPcrManifest);
                updatedByOld = em.merge(updatedByOld);
            }
            if (updatedByNew != null && !updatedByNew.equals(updatedByOld)) {
                updatedByNew.getTblPcrManifestCollection().add(tblPcrManifest);
                em.merge(updatedByNew);
            }
            if (createdByOld != null && !createdByOld.equals(createdByNew)) {
                createdByOld.getTblPcrManifestCollection().remove(tblPcrManifest);
                createdByOld = em.merge(createdByOld);
            }
            if (createdByNew != null && !createdByNew.equals(createdByOld)) {
                createdByNew.getTblPcrManifestCollection().add(tblPcrManifest);
                em.merge(createdByNew);
            }
            */
            if (mleIdOld != null && !mleIdOld.equals(mleIdNew)) {
                mleIdOld.getTblPcrManifestCollection().remove(tblPcrManifest);
                mleIdOld = em.merge(mleIdOld);
            }
            if (mleIdNew != null && !mleIdNew.equals(mleIdOld)) {
                mleIdNew.getTblPcrManifestCollection().add(tblPcrManifest);
                em.merge(mleIdNew);
            }
            em.getTransaction().commit();
        } catch (Exception ex) {
            String msg = ex.getLocalizedMessage();
View Full Code Here

Examples of com.intel.mtwilson.as.data.TblMle

            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();
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.