airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [18/57] airavata git commit: bug fix in search experiments and projects
Date Thu, 28 Jul 2016 17:45:32 GMT
bug fix in search experiments and projects


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/c3ea76ed
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/c3ea76ed
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/c3ea76ed

Branch: refs/heads/develop
Commit: c3ea76ed8ee74e1bf3059ddee0fbcb9185c29290
Parents: 89e0fdc
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Thu Jul 7 12:55:23 2016 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Thu Jul 7 12:55:23 2016 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/c3ea76ed/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index e43ff4a..2e2c7a9d 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -871,10 +871,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                 accessibleProjIds.addAll(getAllAccessibleResourcesForUser(userName+"@"+gatewayId,
ResourceType.PROJECT, ResourcePermissionType.READ));
             }catch (Exception ex){
                 logger.error(ex.getMessage(), ex);
-                List<Object> allUserProjects = experimentCatalog.search(ExperimentCatalogModelType.PROJECT,
temp, -1,
-                        0, Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
-                allUserProjects.stream().forEach(e->accessibleProjIds.add(((Project) e).getProjectID()));
             }
+            List<Object> allUserProjects = experimentCatalog.search(ExperimentCatalogModelType.PROJECT,
temp, -1,
+                    0, Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
+            allUserProjects.stream().forEach(e->accessibleProjIds.add(((Project) e).getProjectID()));
+            Set<String> hs = new HashSet<>();
+            hs.addAll(accessibleProjIds);
+            accessibleProjIds.clear();
+            accessibleProjIds.addAll(hs);
 
             List<Object> results = experimentCatalog.searchAllAccessible(ExperimentCatalogModelType.PROJECT,
accessibleProjIds,
                     regFilters, limit, offset, Constants.FieldConstants.ProjectConstants.CREATION_TIME,
ResultOrderType.DESC);
@@ -964,10 +968,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                 accessibleExpIds.addAll(getAllAccessibleResourcesForUser(userName + "@" +
gatewayId, ResourceType.EXPERIMENT, ResourcePermissionType.READ));
             }catch (Exception ex){
                 logger.error(ex.getMessage(), ex);
-                List<Object> allUserExperiments = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT,
temp, -1,
-                        0, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
-                allUserExperiments.stream().forEach(e->accessibleExpIds.add(((ExperimentSummaryModel)
e).getExperimentId()));
             }
+            List<Object> allUserExperiments = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT,
temp, -1,
+                    0, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
+            allUserExperiments.stream().forEach(e->accessibleExpIds.add(((ExperimentSummaryModel)
e).getExperimentId()));
+            Set<String> hs = new HashSet<>();
+            hs.addAll(accessibleExpIds);
+            accessibleExpIds.clear();
+            accessibleExpIds.addAll(hs);
 
             List<Object> results = experimentCatalog.searchAllAccessible(ExperimentCatalogModelType.EXPERIMENT,
                     accessibleExpIds, regFilters, limit,


Mime
View raw message