airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1381765 - in /incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa: impl/AiravataJPARegistry.java resources/PublishWorkflowResource.java
Date Thu, 06 Sep 2012 21:25:03 GMT
Author: lahiru
Date: Thu Sep  6 21:25:02 2012
New Revision: 1381765

URL: http://svn.apache.org/viewvc?rev=1381765&view=rev
Log:
more methods  implementations.

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/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java

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=1381765&r1=1381764&r2=1381765&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
Thu Sep  6 21:25:02 2012
@@ -394,23 +394,57 @@ public class AiravataJPARegistry extends
     }
 
     public List<AiravataExperiment> getExperiments(Date from, Date to) {
-        return null;  //To change body of implemented methods use File | Settings | File
Templates.
+        List<AiravataExperiment> experiments = getExperiments();
+        List<AiravataExperiment> newExperiments = new ArrayList<AiravataExperiment>();
+        for(AiravataExperiment exp:experiments){
+            Date submittedDate = exp.getSubmittedDate();
+            if(submittedDate.after(from) && submittedDate.before(to)) {
+                newExperiments.add(exp);
+            }
+        }
+        return newExperiments;  //To change body of implemented methods use File | Settings
| File Templates.
     }
 
     public List<AiravataExperiment> getExperiments(String projectName, Date from, Date
to) {
-        return null;  //To change body of implemented methods use File | Settings | File
Templates.
+        List<AiravataExperiment> experiments = getExperiments(projectName);
+        List<AiravataExperiment> newExperiments = new ArrayList<AiravataExperiment>();
+        for (AiravataExperiment exp : experiments) {
+            Date submittedDate = exp.getSubmittedDate();
+            if (submittedDate.after(from) && submittedDate.before(to)) {
+                newExperiments.add(exp);
+            }
+        }
+        return newExperiments;
     }
 
     public void publishWorkflow(String workflowName, String publishWorkflowName) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        UserResource userResource = new UserResource();
+        userResource.setUserName(getUser().getUserName());
+        UserWorkflowResource resource = (UserWorkflowResource)userResource.get(ResourceType.USER_WORKFLOW,
workflowName);
+        GatewayResource gatewayResource = new GatewayResource();
+        PublishWorkflowResource resource1 = (PublishWorkflowResource)gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
+        resource1.setContent(resource.getContent());
+        resource1.setPublishedDate(new java.sql.Date(Calendar.getInstance().getTime().getTime()));
+        resource1.setName(publishWorkflowName);
+        //todo have to set version
     }
 
     public void publishWorkflow(String workflowName) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        UserResource userResource = new UserResource();
+        userResource.setUserName(getUser().getUserName());
+        UserWorkflowResource resource = (UserWorkflowResource)userResource.get(ResourceType.USER_WORKFLOW,
workflowName);
+        GatewayResource gatewayResource = new GatewayResource();
+        PublishWorkflowResource resource1 = (PublishWorkflowResource)gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
+        resource1.setContent(resource.getContent());
+        resource1.setPublishedDate(new java.sql.Date(Calendar.getInstance().getTime().getTime()));
+        //todo is this right ????
+        resource1.setName(workflowName);
     }
 
     public String getPublishedWorkflowGraphXML(String workflowName) {
-        return null;  //To change body of implemented methods use File | Settings | File
Templates.
+        GatewayResource gatewayResource = new GatewayResource();
+        PublishWorkflowResource resource1 = (PublishWorkflowResource) gatewayResource.get(ResourceType.PUBLISHED_WORKFLOW,
workflowName);
+        return resource1.getContent();
     }
 
     public ResourceMetadata getPublishedWorkflowMetadata(String workflowName) {
@@ -418,7 +452,8 @@ public class AiravataJPARegistry extends
     }
 
     public void removePublishedWorkflow(String workflowName) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        GatewayResource gatewayResource = new GatewayResource();
+        gatewayResource.remove(ResourceType.PUBLISHED_WORKFLOW, workflowName);
     }
 
     public void addWorkflow(String workflowName, String workflowGraphXml) {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java?rev=1381765&r1=1381764&r2=1381765&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
Thu Sep  6 21:25:02 2012
@@ -108,6 +108,10 @@ public class PublishWorkflowResource ext
         end();
     }
 
+    public void setName(String name) {
+        this.name = name;
+    }
+
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }



Mime
View raw message