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

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


            em.getTransaction().begin();
            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
            generator.setParameter(HostIPAddressConstants.RESOURCE_ID, ids.get(HostIPAddressConstants.RESOURCE_ID));
            generator.setParameter(HostIPAddressConstants.IP_ADDRESS, ids.get(HostIPAddressConstants.IP_ADDRESS));
            Query q = generator.selectQuery(em);
            HostIPAddress hostIPAddress = (HostIPAddress) q.getSingleResult();
            HostIPAddressResource hostIPAddressResource =
                    (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
            em.getTransaction().commit();
            em.close();
            return hostIPAddressResource;
View Full Code Here


                generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        HostIPAddress hostIPAddress = (HostIPAddress) result;
                        HostIPAddressResource hostIPAddressResource =
                                (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
                        hostIPAddressResources.add(hostIPAddressResource);
                    }
                }
            } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
                generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        HostIPAddress hostIPAddress = (HostIPAddress) result;
                        HostIPAddressResource hostIPAddressResource =
                                (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
                        hostIPAddressResources.add(hostIPAddressResource);
                    }
                }
View Full Code Here

                generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        HostIPAddress hostIPAddress = (HostIPAddress) result;
                        hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
                    }
                }
            } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
                generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        HostIPAddress hostIPAddress = (HostIPAddress) result;
                        hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
                    }
                }
            } else {
                em.getTransaction().commit();
                em.close();
View Full Code Here

    public void save() throws AppCatalogException {
        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            HostIPAddress existingHostIP = em.find(HostIPAddress.class, new HostIPAddressPK(resourceID,ipaddress));
            em.close();

            em = AppCatalogJPAUtils.getEntityManager();
            em.getTransaction().begin();
            ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
            if (existingHostIP !=  null){
                existingHostIP.setIpaddress(ipaddress);
                existingHostIP.setResourceID(resourceID);
                existingHostIP.setComputeResource(computeResource);
                em.merge(existingHostIP);
            }else {
                HostIPAddress hostIPAddress = new HostIPAddress();
                hostIPAddress.setIpaddress(ipaddress);
                hostIPAddress.setResourceID(resourceID);
                hostIPAddress.setComputeResource(computeResource);
                em.persist(hostIPAddress);
            }
            em.getTransaction().commit();
            em.close();
        } catch (Exception e) {
View Full Code Here

        }

        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            HostIPAddress hostIPAddress = em.find(HostIPAddress.class, new HostIPAddressPK(ids.get(HostIPAddressConstants.RESOURCE_ID),
                    ids.get(HostIPAddressConstants.IP_ADDRESS)));

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

TOP

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

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.