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

Examples of org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator


        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            em.getTransaction().begin();
            Query q;
            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
            List results;
            if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
                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 =
View Full Code Here


        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            em.getTransaction().begin();
            Query q;
            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
            List results;
            if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
                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());
View Full Code Here

    }
    EntityManager em = null;
    try {
      em = AppCatalogJPAUtils.getEntityManager();
      em.getTransaction().begin();
      AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
      generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
      generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
      Query q = generator.deleteQuery(em);
      q.executeUpdate();
      em.getTransaction().commit();
      em.close();
    } catch (ApplicationSettingsException e) {
      logger.error(e.getMessage(), e);
View Full Code Here

    }
    EntityManager em = null;
    try {
      em = AppCatalogJPAUtils.getEntityManager();
      em.getTransaction().begin();
      AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
      generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
      generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
      Query q = generator.selectQuery(em);
      ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) q.getSingleResult();
      ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
      em.getTransaction().commit();
      em.close();
      return computeResourceFileSystemResource;
View Full Code Here

    List<Resource> computeResourceFileSystemResources = new ArrayList<Resource>();
    EntityManager em = null;
    try {
      em = AppCatalogJPAUtils.getEntityManager();
      em.getTransaction().begin();
      AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
      Query q;
      if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
        generator.setParameter(fieldName, value);
        q = generator.selectQuery(em);
        List<?> results = q.getResultList();
        for (Object result : results) {
          ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
          ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
          computeResourceFileSystemResources.add(computeResourceFileSystemResource);
View Full Code Here

    List<String> computeResourceFileSystemResourceIDs = new ArrayList<String>();
    EntityManager em = null;
    try {
      em = AppCatalogJPAUtils.getEntityManager();
      em.getTransaction().begin();
      AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
      Query q;
      if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
        generator.setParameter(fieldName, value);
        q = generator.selectQuery(em);
        List<?> results = q.getResultList();
        for (Object result : results) {
          ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
          ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
          computeResourceFileSystemResourceIDs.add(computeResourceFileSystemResource.getComputeResourceId());
View Full Code Here

    public void remove(Object identifier) throws AppCatalogException {
        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            em.getTransaction().begin();
            AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
            generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
            Query q = generator.deleteQuery(em);
            q.executeUpdate();
            em.getTransaction().commit();
            em.close();
        } catch (ApplicationSettingsException e) {
            logger.error(e.getMessage(), e);
View Full Code Here

    public Resource get(Object identifier) throws AppCatalogException {
        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            em.getTransaction().begin();
            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
            generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
            Query q = generator.selectQuery(em);
            ApplicationInterface applicationInterface = (ApplicationInterface) q.getSingleResult();
            AppInterfaceResource resource =
                    (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, applicationInterface);
            em.getTransaction().commit();
            em.close();
View Full Code Here

        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            em.getTransaction().begin();
            Query q;
            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
            List results;
            if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
                generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
                q = generator.selectQuery(em);
                results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        ApplicationInterface appInterface = (ApplicationInterface) result;
                        AppInterfaceResource resource =
View Full Code Here

        List<Resource> resourceList = new ArrayList<Resource>();
        EntityManager em = null;
        try {
            em = AppCatalogJPAUtils.getEntityManager();
            em.getTransaction().begin();
            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
            Query   q = generator.selectQuery(em);
            List results = q.getResultList();
                if (results.size() != 0) {
                    for (Object result : results) {
                        ApplicationInterface appInterface = (ApplicationInterface) result;
                        AppInterfaceResource resource =
View Full Code Here

TOP

Related Classes of org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator

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.