airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: AIRAVATA-1264
Date Fri, 23 May 2014 15:47:02 GMT
Repository: airavata
Updated Branches:
  refs/heads/master baa69e894 -> 124e286d0


AIRAVATA-1264


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

Branch: refs/heads/master
Commit: 124e286d0c244b1a539acff727fe2e8675271369
Parents: baa69e8
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Fri May 23 11:46:55 2014 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Fri May 23 11:46:55 2014 -0400

----------------------------------------------------------------------
 .../persistance/registry/jpa/impl/ProjectRegistry.java   | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/124e286d/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
index dda08e6..f288b85 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
@@ -44,9 +44,8 @@ public class ProjectRegistry {
         }else {
             this.gatewayResource = (GatewayResource)ResourceUtils.getGateway(gatewayResource.getGatewayName());
         }
-        if (!ResourceUtils.isUserExist(user.getUserName())){
-            workerResource = new WorkerResource(user.getUserName(), gatewayResource);
-            workerResource.save();
+        if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
+            workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);
         }else {
             workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(),
user.getUserName());
         }
@@ -108,7 +107,11 @@ public class ProjectRegistry {
             existingProject.setCreationTime(AiravataUtils.getTime(project.getCreationTime()));
             existingProject.setGateway(gatewayResource);
             UserResource user = (UserResource)ResourceUtils.getUser(project.getOwner());
-            ResourceUtils.addGatewayWorker(gatewayResource, user);
+            if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
+                workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);
+            }else {
+                workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(),
user.getUserName());
+            }
             WorkerResource worker = new WorkerResource(project.getOwner(), gatewayResource);
             existingProject.setWorker(worker);
             existingProject.save();


Mime
View raw message