You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2012/09/07 17:41:38 UTC

svn commit: r1382069 - in /incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main: java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java resources/data.sql

Author: lahiru
Date: Fri Sep  7 15:41:37 2012
New Revision: 1382069

URL: http://svn.apache.org/viewvc?rev=1382069&view=rev
Log:
More implemetnation methods.

Modified:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1382069&r1=1382068&r2=1382069&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java Fri Sep  7 15:41:37 2012
@@ -457,15 +457,23 @@ public class AiravataJPARegistry extends
     }
 
     public void addWorkflow(String workflowName, String workflowGraphXml) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        ProjectResource projectResource = new ProjectResource();
+        UserWorkflowResource resource = (UserWorkflowResource)projectResource.create(ResourceType.USER_WORKFLOW);
+        resource.setName(workflowName);
+        resource.setContent(workflowGraphXml);
+        resource.setLastUpdateDate(new java.sql.Date(Calendar.getInstance().getTime().getTime()));
+        resource.save();
     }
 
     public void updateWorkflow(String workflowName, String workflowGraphXml) {
-        //To change body of implemented methods use File | Settings | File Templates.
+         addWorkflow(workflowName,workflowGraphXml);
     }
 
     public String getWorkflowGraphXML(String workflowName) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        GatewayResource gatewayResource = new GatewayResource();
+        UserResource resource = (UserResource)gatewayResource.get(ResourceType.USER_WORKFLOW, getUser().getUserName());
+        UserWorkflowResource resource1 = (UserWorkflowResource) resource.get(ResourceType.USER_WORKFLOW, workflowName);
+        return resource1.getContent();
     }
 
     public ResourceMetadata getWorkflowMetadata(String workflowName) {
@@ -473,7 +481,9 @@ public class AiravataJPARegistry extends
     }
 
     public void removeWorkflow(String workflowName) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        GatewayResource gatewayResource = new GatewayResource();
+        UserResource resource = (UserResource)gatewayResource.get(ResourceType.USER_WORKFLOW, getUser().getUserName());
+        resource.remove(ResourceType.USER_WORKFLOW, workflowName);
     }
 
     public void setAiravataRegistry(AiravataRegistry2 registry) {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql?rev=1382069&r1=1382068&r2=1382069&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql Fri Sep  7 15:41:37 2012
@@ -54,7 +54,7 @@ create table Published_Workflow
 
 create table User_Workflow
 (
-       project_ID int(11),
+       gateway_name varchar(255),
        user_name varchar(255),
        user_workflow_name varchar(255),
        last_update_date DATE,