You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2014/08/19 16:43:43 UTC

[4/4] git commit: fixing AIRAVATA-1361

fixing AIRAVATA-1361


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

Branch: refs/heads/master
Commit: 9c1f44d04b768f4f9d360d71e19aeaaf7c25a218
Parents: 414f2b9
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Tue Aug 19 10:43:34 2014 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Tue Aug 19 10:43:34 2014 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |   37 +
 .../java/org/apache/airavata/api/Airavata.java  | 6908 +++++++++++-------
 .../main/resources/lib/airavata/Airavata.cpp    |  963 ++-
 .../src/main/resources/lib/airavata/Airavata.h  |  167 +
 .../lib/airavata/Airavata_server.skeleton.cpp   |    5 +
 .../resources/lib/Airavata/API/Airavata.php     |  657 +-
 .../samples/TestCreateLaunchExperiment.java     |   26 +-
 .../airavataAPI.thrift                          |   11 +-
 .../registry/jpa/impl/ExperimentRegistry.java   |   27 +
 .../registry/jpa/resources/WorkerResource.java  |   33 +
 .../airavata/registry/cpi/utils/Constants.java  |    2 +
 11 files changed, 5667 insertions(+), 3169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/9c1f44d0/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 32800cd..4e4bab9 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
@@ -538,6 +538,43 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
         }
     }
 
+    @Override
+    public List<ExperimentSummary> searchExperimentsByCreationTime(String userName, long fromTime, long toTime) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
+        if (!validateString(userName)){
+            logger.error("Username cannot be empty. Please provide a valid user..");
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Username cannot be empty. Please provide a valid user..");
+            throw exception;
+        }
+        try {
+            if (!ResourceUtils.isUserExist(userName)){
+                logger.error("User does not exist in the system. Please provide a valid user..");
+                AiravataSystemException exception = new AiravataSystemException();
+                exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+                exception.setMessage("User does not exist in the system. Please provide a valid user..");
+                throw exception;
+            }
+            List<ExperimentSummary> summaries = new ArrayList<ExperimentSummary>();
+            registry = RegistryFactory.getDefaultRegistry();
+            Map<String, String> filters = new HashMap<String, String>();
+            filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName);
+            filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, String.valueOf(fromTime));
+            filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, String.valueOf(toTime));
+            List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters);
+            for (Object object : results) {
+                summaries.add((ExperimentSummary) object);
+            }
+            return summaries;
+        }catch (Exception e) {
+            logger.error("Error while retrieving experiments", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage());
+            throw exception;
+        }
+    }
+
     /**
      * Get all Experiments within a Project
      *