Package com.intel.mtwilson.as.data

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


         * @param osName
         * @param osVersion
         * @return
         */
  private TblOs getTblOs(String osName, String osVersion) {
    TblOs tblOs = new TblOsJpaController(getEntityManagerFactory())
        .findTblOsByNameVersion(osName, osVersion);

    if (tblOs == null)
      throw new ASException(ErrorCode.WS_OS_DOES_NOT_EXIST, osName, osVersion);

View Full Code Here


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

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

          
            TblOs tblOs = (TblOs) query.getSingleResult();
            return tblOs;

        } catch(NoResultException e){
            return null;
        }finally {
View Full Code Here

     * @return
     */
    public String updateOs(OsData osData) {

        try {
            TblOs tblOs = tblOsJpaController.findTblOsByNameVersion(osData.getName(), osData.getVersion());

            if (tblOs == null) {
                throw new ASException(ErrorCode.WS_OS_DOES_NOT_EXIST, osData.getName(), osData.getVersion());
            }

            tblOs.setDescription(osData.getDescription());

            tblOsJpaController.edit(tblOs);

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

     * @param osData
     * @return
     */
    public String createOs(OsData osData) {
        try {
            TblOs tblOs = tblOsJpaController.findTblOsByNameVersion(osData.getName(), osData.getVersion());

            if (tblOs != null) {
                throw new ASException(ErrorCode.WS_OS_ALREADY_EXISTS, osData.getName(), osData.getVersion());
            }

            tblOs = new TblOs();
            tblOs.setName(osData.getName());
            tblOs.setVersion(osData.getVersion());
            tblOs.setDescription(osData.getDescription());

            tblOsJpaController.create(tblOs);

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

     * @param osVersion
     * @return
     */
    public String deleteOs(String osName, String osVersion) {
        try {
            TblOs tblOs = tblOsJpaController.findTblOsByNameVersion(osName, osVersion);

            if (tblOs == null) {
                throw new ASException(ErrorCode.WS_OS_DOES_NOT_EXIST,osName, osVersion);               
            }
           
            Collection<TblMle> tblMleCollection = tblOs.getTblMleCollection();
            if( tblMleCollection != null ) {
                log.info("OS is currently associated with # MLEs: " + tblMleCollection.size());
           
                if(!tblMleCollection.isEmpty()){
                      throw new ASException(ErrorCode.WS_OS_ASSOCIATION_EXISTS, osName, osVersion, tblMleCollection.size());
                }
            }
            tblOsJpaController.destroy(tblOs.getId());
           
        } catch (ASException ase) {
            throw ase;
        } catch (Exception e) {
            throw new ASException(e);
View Full Code Here

TOP

Related Classes of com.intel.mtwilson.as.data.TblOs

Copyright © 2018 www.massapicom. 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.