airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: adding implementation to get experiment list - AIRAVATA-991
Date Mon, 10 Mar 2014 16:10:48 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 5920f22d3 -> 78365f46a


adding implementation to get experiment list - AIRAVATA-991


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

Branch: refs/heads/master
Commit: 78365f46a86b1308532f78de1aa6cf350836d5e5
Parents: 5920f22
Author: chathuri <chathuri@apache.org>
Authored: Mon Mar 10 12:10:43 2014 -0400
Committer: chathuri <chathuri@apache.org>
Committed: Mon Mar 10 12:10:43 2014 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   | 31 ++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/78365f46/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 e01f153..1002f91 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
@@ -41,6 +41,7 @@ import org.apache.thrift.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -110,7 +111,20 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public List<Experiment> getAllExperimentsInProject(String projectId) throws InvalidRequestException,
AiravataClientException, AiravataSystemException, TException {
-        return null;
+        try {
+            List<Experiment> experiments = new ArrayList<Experiment>();
+            registry = RegistryFactory.getDefaultRegistry();
+            List<Object> list = registry.get(DataType.EXPERIMENT, Constants.FieldConstants.ExperimentConstants.PROJECT_NAME,
projectId);
+            if (list != null && !list.isEmpty()){
+                for (Object o : list){
+                    experiments.add((Experiment)o);
+                }
+            }
+            return experiments;
+        } catch (Exception e) {
+            logger.error("Error while retrieving the experiments", e);
+            throw new AiravataSystemException();
+        }
     }
 
     /**
@@ -120,7 +134,20 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public List<Experiment> getAllUserExperiments(String userName) throws InvalidRequestException,
AiravataClientException, AiravataSystemException, TException {
-        return null;
+        try {
+            List<Experiment> experiments = new ArrayList<Experiment>();
+            registry = RegistryFactory.getDefaultRegistry();
+            List<Object> list = registry.get(DataType.EXPERIMENT, Constants.FieldConstants.ExperimentConstants.USER_NAME,
userName);
+            if (list != null && !list.isEmpty()){
+                for (Object o : list){
+                    experiments.add((Experiment)o);
+                }
+            }
+            return experiments;
+        } catch (Exception e) {
+            logger.error("Error while retrieving the experiments", e);
+            throw new AiravataSystemException();
+        }
     }
 
     /**


Mime
View raw message