Examples of MwMleSource


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

                                    MwMleSourceJpaController mleSourceJpaController = new MwMleSourceJpaController(getEntityManagerFactory());

                                    // Let us check if there is a mapping entry already for this MLE. If it does, then we need to return
                                    // back appropriate error.
                                    MwMleSource mleSourceCurrentObj = mleSourceJpaController.findByMleId(tblMle.getId());

                                    if (mleSourceCurrentObj != null) {
                                        log.error("White List host is already mapped to the MLE - " + tblMle.getName());
                                        throw new ASException(ErrorCode.WS_MLE_SOURCE_MAPPING_ALREADY_EXISTS, mleData.getName());
                                    }

                                    // Else create a new entry in the DB.
                                    MwMleSource mleSourceData = new MwMleSource();
                                    mleSourceData.setMleId(tblMle);
                                    mleSourceData.setHostName(mleSourceObj.getHostName());       

                                    mleSourceJpaController.create(mleSourceData);

                                } catch (ASException ase) {
                                        throw ase;
View Full Code Here

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

                    throw new ASException(nre,ErrorCode.WS_MLE_DOES_NOT_EXIST, mleData.getName(), mleData.getVersion());
                }
                               
                MwMleSourceJpaController mleSourceJpaController = new MwMleSourceJpaController(getEntityManagerFactory());
                // If the mapping does not exist already in the db, then we need to return back error.
                MwMleSource mwMleSource = mleSourceJpaController.findByMleId(tblMle.getId());
                if (mwMleSource == null) {
                    throw new ASException(ErrorCode.WS_MLE_SOURCE_MAPPING_DOES_NOT_EXIST, mleData.getName());
                }
               
                mwMleSource.setHostName(mleSourceObj.getHostName());       
                mleSourceJpaController.edit(mwMleSource);
               
            } catch (ASException ase) {
                    throw ase;
            } catch (Exception e) {
View Full Code Here

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

                } catch (NoResultException nre){
                    throw new ASException(nre,ErrorCode.WS_MLE_DOES_NOT_EXIST, mleName, mleVersion);
                }
                               
                MwMleSourceJpaController mleSourceJpaController = new MwMleSourceJpaController(getEntityManagerFactory());
                MwMleSource mwMleSource = mleSourceJpaController.findByMleId(tblMle.getId());
                // If the mapping does not exist, it is ok. We don't need to worry. Actually for MLES
                // configured manully, this entry does not exist.
                if  (mwMleSource != null)                               
                    mleSourceJpaController.destroy(mwMleSource.getId());
               
            } catch (ASException ase) {
                    throw ase;
            } catch (Exception e) {
                throw new ASException(e);
View Full Code Here

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

                } catch (NoResultException nre){
                    throw new ASException(nre,ErrorCode.WS_MLE_DOES_NOT_EXIST, mleName, mleVersion);
                }
                               
                MwMleSourceJpaController mleSourceJpaController = new MwMleSourceJpaController(getEntityManagerFactory());
                MwMleSource mwMleSource = mleSourceJpaController.findByMleId(tblMle.getId());
               
                // Now check if the data exists in the MLE Source table. If there is no corresponding entry, then we know that
                // the MLE was configured manually.
                if (mwMleSource == null) {
                    hostName = "Manually configured white list";
                }
                else {
                    hostName = mwMleSource.getHostName();
                }
               
                return hostName;
               
            } catch (ASException ase) {
View Full Code Here

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

    public void edit(MwMleSource mwMleSource) throws NonexistentEntityException, Exception {
        EntityManager em = getEntityManager();
        try {
           
            em.getTransaction().begin();
            MwMleSource persistentMwMleSource = em.find(MwMleSource.class, mwMleSource.getId());
            TblMle mleIdOld = persistentMwMleSource.getMleId();
            TblMle mleIdNew = mwMleSource.getMleId();
            if (mleIdNew != null) {
                mleIdNew = em.getReference(mleIdNew.getClass(), mleIdNew.getId());
                mwMleSource.setMleId(mleIdNew);
            }
View Full Code Here

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

    public void destroy(Integer id) throws NonexistentEntityException {
        EntityManager em = getEntityManager();
        try {
           
            em.getTransaction().begin();
            MwMleSource mwMleSource;
            try {
                mwMleSource = em.getReference(MwMleSource.class, id);
                mwMleSource.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The mwMleSource with id " + id + " no longer exists.", enfe);
            }
            TblMle mleId = mwMleSource.getMleId();
            if (mleId != null) {
                mleId.getMwMleSourceCollection().remove(mwMleSource);
                em.merge(mleId);
            }
            em.remove(mwMleSource);
View Full Code Here

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

            query.setParameter("mleId", id);

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

            MwMleSource mleSourceObj = (MwMleSource) query.getSingleResult();
            return mleSourceObj;

        } catch(NoResultException e){
          log.error(String.format("MLE information with identity %d not found in the DB.", id));
          return null;
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.