Package org.apache.aiaravata.application.catalog.data.model

Examples of org.apache.aiaravata.application.catalog.data.model.HostAlias


            em.getTransaction().begin();
            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
            generator.setParameter(HostAliasConstants.RESOURCE_ID, ids.get(HostAliasConstants.RESOURCE_ID));
            generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
            Query q = generator.selectQuery(em);
            HostAlias hostAlias = (HostAlias) q.getSingleResult();
            HostAliasResource hostAliasResource =
                    (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
            em.getTransaction().commit();
            em.close();
            return hostAliasResource;
View Full Code Here


                generator.setParameter(HostAliasConstants.ALIAS, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        HostAlias hostAlias = (HostAlias) result;
                        HostAliasResource hostAliasResource =
                                (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
                        hostAliasResources.add(hostAliasResource);
                    }
                }
            } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
                generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        HostAlias hostAlias = (HostAlias) result;
                        HostAliasResource hostAliasResource =
                                (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
                        hostAliasResources.add(hostAliasResource);
                    }
                }
View Full Code Here

                generator.setParameter(HostAliasConstants.ALIAS, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        HostAlias hostAlias = (HostAlias) result;
                        hostAliasResourceIDs.add(hostAlias.getResourceID());
                    }
                }
            } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
                generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        HostAlias hostAlias = (HostAlias) result;
                        hostAliasResourceIDs.add(hostAlias.getResourceID());
                    }
                }
            } else {
                em.getTransaction().commit();
                em.close();
View Full Code Here

    public void save() throws AppCatalogException {
        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            HostAlias existingHostAlias = em.find(HostAlias.class, new HostAliasPK(resourceID, alias));
            em.close();

            em = AppCatalogJPAUtils.getEntityManager();
            em.getTransaction().begin();
            ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
            if (existingHostAlias !=  null){
                existingHostAlias.setAlias(alias);
                existingHostAlias.setComputeResource(computeResource);
                existingHostAlias.setResourceID(resourceID);
                em.merge(existingHostAlias);
            }else {
                HostAlias hostAlias = new HostAlias();
                hostAlias.setAlias(alias);
                hostAlias.setResourceID(resourceID);
                hostAlias.setComputeResource(computeResource);

                em.persist(hostAlias);
            }
            em.getTransaction().commit();
            em.close();
View Full Code Here

        }

        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            HostAlias hostAlias = em.find(HostAlias.class, new HostAliasPK(ids.get(HostAliasConstants.RESOURCE_ID),
                    ids.get(HostAliasConstants.ALIAS)));

            em.close();
            return hostAlias != null;
        } catch (ApplicationSettingsException e) {
View Full Code Here

TOP

Related Classes of org.apache.aiaravata.application.catalog.data.model.HostAlias

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.