airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata] branch develop updated: Fix bug when passing empty list to SQL IN clause
Date Sun, 22 Jul 2018 17:36:57 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/develop by this push:
     new f4269d6  Fix bug when passing empty list to SQL IN clause
f4269d6 is described below

commit f4269d61d25660e482707b0d62431f100074ad26
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Sun Jul 22 13:27:55 2018 -0400

    Fix bug when passing empty list to SQL IN clause
---
 .../appcatalog/ApplicationDeploymentRepository.java         | 11 +++++++----
 .../appcatalog/ApplicationInterfaceRepository.java          | 13 +++++++++----
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationDeploymentRepository.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationDeploymentRepository.java
index d797d3c..d85e5cd 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationDeploymentRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationDeploymentRepository.java
@@ -31,10 +31,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 public class ApplicationDeploymentRepository extends AppCatAbstractRepository<ApplicationDeploymentDescription,
ApplicationDeploymentEntity, String> implements ApplicationDeployment {
     private final static Logger logger = LoggerFactory.getLogger(ApplicationDeploymentRepository.class);
@@ -187,6 +184,9 @@ public class ApplicationDeploymentRepository extends AppCatAbstractRepository<Ap
 
     @Override
     public List<ApplicationDeploymentDescription> getAccessibleApplicationDeployments(String
gatewayId, List<String> accessibleAppIds, List<String> accessibleCompHostIds)
throws AppCatalogException {
+        if (accessibleAppIds.isEmpty() || accessibleCompHostIds.isEmpty()) {
+            return Collections.emptyList();
+        }
         Map<String, Object> queryParameters = new HashMap<>();
         queryParameters.put(DBConstants.ApplicationDeployment.GATEWAY_ID, gatewayId);
         queryParameters.put(DBConstants.ApplicationDeployment.ACCESSIBLE_APPLICATION_DEPLOYMENT_IDS,
accessibleAppIds);
@@ -198,6 +198,9 @@ public class ApplicationDeploymentRepository extends AppCatAbstractRepository<Ap
 
     @Override
     public List<ApplicationDeploymentDescription> getAccessibleApplicationDeployments(String
gatewayId, String appModuleId, List<String> accessibleAppIds, List<String> accessibleComputeResourceIds)
throws AppCatalogException {
+        if (accessibleAppIds.isEmpty() || accessibleComputeResourceIds.isEmpty()) {
+            return Collections.emptyList();
+        }
         Map<String, Object> queryParameters = new HashMap<>();
         queryParameters.put(DBConstants.ApplicationDeployment.GATEWAY_ID, gatewayId);
         queryParameters.put(DBConstants.ApplicationDeployment.APPLICATION_MODULE_ID, appModuleId);
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepository.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepository.java
index 2bad1bf..080fdd0 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepository.java
@@ -19,16 +19,19 @@
  */
 package org.apache.airavata.registry.core.repositories.appcatalog;
 
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
 import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
 import org.apache.airavata.model.appcatalog.appinterface.application_interface_modelConstants;
 import org.apache.airavata.model.application.io.InputDataObjectType;
 import org.apache.airavata.model.application.io.OutputDataObjectType;
-import org.apache.airavata.registry.core.utils.*;
+import org.apache.airavata.registry.core.entities.appcatalog.AppModuleMappingEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.ApplicationInterfaceEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.ApplicationModuleEntity;
+import org.apache.airavata.registry.core.utils.DBConstants;
+import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.apache.airavata.registry.core.utils.QueryConstants;
 import org.apache.airavata.registry.cpi.AppCatalogException;
 import org.apache.airavata.registry.cpi.ApplicationInterface;
-import org.apache.airavata.registry.core.entities.appcatalog.*;
 import org.dozer.Mapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -216,8 +219,10 @@ public class ApplicationInterfaceRepository extends AppCatAbstractRepository<App
 
     @Override
     public List<ApplicationModule> getAccessibleApplicationModules(String gatewayId,
List<String> accessibleAppIds, List<String> accessibleCompHostIds) throws AppCatalogException
{
+        if (accessibleAppIds.isEmpty() || accessibleCompHostIds.isEmpty()) {
+            return Collections.emptyList();
+        }
         ApplicationModuleRepository applicationModuleRepository = new ApplicationModuleRepository();
-        ApplicationDeploymentRepository deploymentRepository = new ApplicationDeploymentRepository();
         Map<String, Object> queryParameters = new HashMap<>();
         queryParameters.put(DBConstants.ApplicationModule.GATEWAY_ID, gatewayId);
         queryParameters.put(DBConstants.ApplicationDeployment.ACCESSIBLE_APPLICATION_DEPLOYMENT_IDS,
accessibleAppIds);


Mime
View raw message