airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1181796 - in /incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api: Registry.java impl/JCRRegistry.java
Date Tue, 11 Oct 2011 14:12:21 GMT
Author: lahiru
Date: Tue Oct 11 14:12:21 2011
New Revision: 1181796

URL: http://svn.apache.org/viewvc?rev=1181796&view=rev
Log:
fixing https://issues.apache.org/jira/browse/AIRAVATA-136.

Modified:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Registry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Registry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Registry.java?rev=1181796&r1=1181795&r2=1181796&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Registry.java
(original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Registry.java
Tue Oct 11 14:12:21 2011
@@ -149,4 +149,6 @@ public interface Registry {
 
     public Node getWorkflow(QName templateID,String userName);
 
+    public boolean deleteWorkflow(QName resourceID,String userName);
+
 }

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java?rev=1181796&r1=1181795&r2=1181796&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
(original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
Tue Oct 11 14:12:21 2011
@@ -614,34 +614,53 @@ public class JCRRegistry implements Axis
         } catch (Exception e) {
             e.printStackTrace();
         }
-            return result;
+        return result;
+    }
+
+    public boolean saveWorkflow(QName ResourceID, String workflowName, String resourceDesc,
String workflowAsaString, String owner, boolean isMakePublic) {
+        Session session = null;
+        try {
+            session = getSession();
+            Node workflowListNode = getOrAddNode(session.getRootNode(), WORKFLOWS);
+            Node workflowNode = null;
+            if (isMakePublic) {
+                workflowNode = getOrAddNode(getOrAddNode(workflowListNode, PUBLIC), workflowName);
+            } else {
+                workflowNode = getOrAddNode(getOrAddNode(workflowListNode, owner), workflowName);
+            }
+            workflowNode.setProperty("workflow", workflowAsaString);
+            workflowNode.setProperty("Prefix", ResourceID.getPrefix());
+            workflowNode.setProperty("LocalPart", ResourceID.getLocalPart());
+            workflowNode.setProperty("NamespaceURI", ResourceID.getNamespaceURI());
+            workflowNode.setProperty("public", isMakePublic);
+            workflowNode.setProperty("Description", resourceDesc);
+            workflowNode.setProperty("Type", REGISTRY_TYPE_WORKFLOW);
+            session.save();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (session != null && session.isLive()) {
+                session.logout();
+            }
+            return true;
+        }
+    }
+
+    public boolean deleteWorkflow(QName resourceID, String userName) {
+         Session session = null;
+        try {
+            session = getSession();
+            Node workflowListNode = getOrAddNode(getOrAddNode(session.getRootNode(), WORKFLOWS),
userName);
+            Node result = getOrAddNode(workflowListNode, resourceID.getLocalPart());
+            result.remove();
+            session.save();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally {
+            if(session.isLive() || session != null){
+                session.logout();
+            }
+        }
+        return false;  //To change body of implemented methods use File | Settings | File
Templates.
     }
-        public boolean saveWorkflow(QName ResourceID, String workflowName, String resourceDesc,
String workflowAsaString, String owner, boolean isMakePublic) {
-              Session session = null;
-              try {
-                  session = getSession();
-                  Node workflowListNode = getOrAddNode(session.getRootNode(), WORKFLOWS);
-                  Node workflowNode = null;
-                  if(isMakePublic){
-                       workflowNode = getOrAddNode(getOrAddNode(workflowListNode, PUBLIC),
workflowName);
-                  }else{
-                       workflowNode = getOrAddNode(getOrAddNode(workflowListNode, owner),workflowName);
-                  }
-                  workflowNode.setProperty("workflow",workflowAsaString);
-                  workflowNode.setProperty("Prefix",ResourceID.getPrefix());
-                  workflowNode.setProperty("LocalPart",ResourceID.getLocalPart());
-                  workflowNode.setProperty("NamespaceURI",ResourceID.getNamespaceURI());
-                  workflowNode.setProperty("public",isMakePublic);
-                  workflowNode.setProperty("Description",resourceDesc);
-                  workflowNode.setProperty("Type",REGISTRY_TYPE_WORKFLOW);
-                  session.save();
-              } catch (Exception e) {
-                  e.printStackTrace();
-              } finally {
-                  if (session != null && session.isLive()) {
-                      session.logout();
-                  }
-                  return true;
-              }
-          }
 }



Mime
View raw message