airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [1/3] airavata git commit: Fixing pagination issue in worker resource
Date Tue, 02 Jun 2015 20:53:05 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 22bcbb40c -> 22a76f8af


Fixing  pagination issue in worker resource


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

Branch: refs/heads/master
Commit: f515c35790d46c073968ab9ab04ea81f6a2f73f5
Parents: 512fa7e
Author: Supun Nakandala <scnakandala@apache.org>
Authored: Wed Jun 3 01:42:39 2015 +0530
Committer: Supun Nakandala <scnakandala@apache.org>
Committed: Wed Jun 3 01:42:39 2015 +0530

----------------------------------------------------------------------
 .../registry/jpa/resources/WorkerResource.java        | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/f515c357/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
index a9f0b38..c4f158e 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
@@ -608,16 +608,12 @@ public class WorkerResource extends AbstractResource {
         List<ExperimentSummaryResource> result = new ArrayList();
         EntityManager em = null;
         try {
-            String query;
+            String query = "SELECT e, s FROM Experiment e " +
+                    ",Status s WHERE e.expId=s.expId AND " +
+                    "s.statusType='" + StatusType.EXPERIMENT + "' AND ";
             if(filters.get(StatusConstants.STATE) != null) {
-                query = "SELECT DISTINCT (e) FROM Experiment e " +
-                        "JOIN e.statuses s LEFT JOIN FETCH e.statuses WHERE " +
-                        "s.statusType='" + StatusType.EXPERIMENT + "' AND ";
                 String experimentState = ExperimentState.valueOf(filters.get(StatusConstants.STATE)).toString();
                 query += "s.state='" + experimentState + "' AND ";
-            }else{
-                query = "SELECT e FROM Experiment e " +
-                        "LEFT JOIN FETCH e.statuses WHERE ";
             }
 
             if(toTime != null && fromTime != null && toTime.after(fromTime)){
@@ -667,7 +663,9 @@ public class WorkerResource extends AbstractResource {
 
             List resultList = q.getResultList();
             for (Object o : resultList) {
-                Experiment experiment = (Experiment) o;
+                Experiment experiment = (Experiment) ((Object[])o)[0];
+                Status experimentStatus = (Status) ((Object[])o)[1];
+                experiment.setExperimentStatus(experimentStatus);
                 ExperimentSummaryResource experimentSummaryResource =
                         (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY,
experiment);
                 result.add(experimentSummaryResource);


Mime
View raw message