airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [54/57] airavata git commit: creating project in grouper if not it exists
Date Thu, 28 Jul 2016 17:46:08 GMT
creating project in grouper if not it exists


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

Branch: refs/heads/develop
Commit: 971947c16435b269b927129a73d3edcb4f4703a1
Parents: defc75b
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Fri Jul 15 10:37:48 2016 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Fri Jul 15 10:37:48 2016 -0400

----------------------------------------------------------------------
 .../api/server/handler/AiravataServerHandler.java        | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/971947c1/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 9c2877b..a7efbf5 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
@@ -1966,9 +1966,20 @@ public class AiravataServerHandler implements Airavata.Iface {
             existingExperiment.setUserName(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME));
             String expId = (String) experimentCatalog.add(ExpCatParentDataType.EXPERIMENT,
existingExperiment, gatewayId);
             GroupManagerCPI groupManagerCPI = GroupManagerFactory.getGroupManager();
+
+            String projectId = existingExperiment.getProjectId();
+            if(!groupManagerCPI.isResourceRegistered(projectId, org.apache.airavata.grouper.resource.ResourceType.PROJECT)){
+                Project project = (Project)experimentCatalog.get(ExperimentCatalogModelType.PROJECT,
projectId);
+                Resource projectResource = new Resource(projectId, org.apache.airavata.grouper.resource.ResourceType.PROJECT);
+                projectResource.setName(project.getName());
+                projectResource.setDescription(project.getDescription());
+                projectResource.setOwnerId(project.getOwner()+"@"+project.getGatewayId());
+            }
+
             Resource expResource = new Resource(expId, org.apache.airavata.grouper.resource.ResourceType.EXPERIMENT);
             expResource.setParentResourceId(existingExperiment.getProjectId());
             expResource.setName(existingExperiment.getExperimentName());
+            expResource.setOwnerId(existingExperiment.getUserName()+"@"+existingExperiment.getGatewayId());
             expResource.setDescription(existingExperiment.getDescription());
             groupManagerCPI.createResource(expResource);
 


Mime
View raw message