Package com.intel.mtwilson.as.data

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


         *
         * @param oemName
         * @return
         */
  private TblOem getTblOem(String oemName) {
    TblOem tblOem = new TblOemJpaController(getEntityManagerFactory())
        .findTblOemByName(oemName);

    if (tblOem == null)
      throw new ASException(ErrorCode.WS_OEM_DOES_NOT_EXIST, oemName);

View Full Code Here


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

    public TblOem findTblOemByName(String name) {
        EntityManager em = getEntityManager();
        try {
            Query query = em.createNamedQuery("TblOem.findByName");
            query.setParameter("name", name);
            TblOem tblOem = (TblOem) query.getSingleResult();
            return tblOem;

        } catch(NoResultException e){
            log.info( "NoResultException : OEM [{}] not found", name);
            return null;
View Full Code Here

     * @return
     */
    public String updateOem(OemData oemData) {

        try {
            TblOem tblOem = tblOemJpaController.findTblOemByName(oemData.getName());
           
            if(tblOem == null)
                throw new ASException(ErrorCode.WS_OEM_DOES_NOT_EXIST, oemData.getName());
           
            tblOem.setDescription(oemData.getDescription());
           
            tblOemJpaController.edit(tblOem);
           
        } catch(ASException ase){
            throw ase;
View Full Code Here

     * @param oemData
     * @return
     */
    public String createOem(OemData oemData) {
        try {
            TblOem tblOem = tblOemJpaController.findTblOemByName(oemData.getName());
           
            if(tblOem != null)
                throw new ASException(ErrorCode.WS_OEM_ALREADY_EXISTS, oemData.getName());
           
            tblOem = new TblOem();
            tblOem.setName(oemData.getName());
            tblOem.setDescription(oemData.getDescription());
           
            tblOemJpaController.create(tblOem);
           
        } catch(ASException ase){
            throw ase;
View Full Code Here

     * @param osName
     * @return
     */
    public String deleteOem(String osName) {
        try{
            TblOem tblOem = tblOemJpaController.findTblOemByName(osName);
           
            if(tblOem == null){
                throw new ASException(ErrorCode.WS_OEM_DOES_NOT_EXIST, osName);
            }
           
            Collection<TblMle> tblMleCollection = tblOem.getTblMleCollection();
            if( tblMleCollection != null ) {
                log.info("OEM is currently associated with # MLEs: " + tblMleCollection.size());
           
                if(!tblMleCollection.isEmpty()){
                    throw new ASException(ErrorCode.WS_OEM_ASSOCIATION_EXISTS, osName, tblMleCollection.size());
                }
            }
           
            tblOemJpaController.destroy(tblOem.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.TblOem

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.