airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1381763 [1/2] - in /incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main: java/org/apache/airavata/persistance/registry/jpa/ java/org/apache/airavata/persistance/registry/jpa/model/ java/org/apache/airavata/persistance/...
Date Thu, 06 Sep 2012 21:23:59 GMT
Author: lahiru
Date: Thu Sep  6 21:23:58 2012
New Revision: 1381763

URL: http://svn.apache.org/viewvc?rev=1381763&view=rev
Log:
applying a patch from Chathuri for AIRAVATA-562

Modified:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ServiceDescriptorResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.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/ResourceUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java Thu Sep  6 21:23:58 2012
@@ -20,27 +20,99 @@
 */
 package org.apache.airavata.persistance.registry.jpa;
 
+import org.apache.airavata.persistance.registry.jpa.model.Gateway;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker;
+import org.apache.airavata.persistance.registry.jpa.model.Users;
 import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
 import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
 
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+
 public class ResourceUtils {
-    public static Resource createGateway() {
+    private static final String PERSISTENCE_UNIT_NAME = "airavata_data";
+    protected static EntityManagerFactory factory;
+    protected static EntityManager em;
+
+    public static Resource createGateway(String gatewayName) {
+        if(!isGatewayExist(gatewayName)){
+            GatewayResource gatewayResource = new GatewayResource();
+            gatewayResource.setGatewayName(gatewayName);
+            return gatewayResource;
+        }
         return null;
+
     }
 
     public static boolean isGatewayExist(String gatewayName) {
-        return true;
+        factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+        em = factory.createEntityManager();
+        em.getTransaction().begin();
+        Query q = em.createQuery("SELECT p FROM Gateway p WHERE p.gateway_name =:gate_name");
+        q.setParameter("gate_name", gatewayName);
+        Gateway gateway = (Gateway) q.getSingleResult();
+        em.getTransaction().commit();
+        em.close();
+        return gateway != null;
     }
 
-    public static boolean removeGateway() {
-        return true;
+    public static boolean removeGateway(String gatewayName) {
+        try {
+            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+            em = factory.createEntityManager();
+            em.getTransaction().begin();
+            Query q = em.createQuery("Delete p FROM Gateway p WHERE p.gateway_name =:gate_name");
+            q.setParameter("gate_name", gatewayName);
+            q.executeUpdate();
+            em.getTransaction().commit();
+            em.close();
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+
+
     }
 
     public static void addGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
+          try{
+              factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+              em = factory.createEntityManager();
+              em.getTransaction().begin();
+              Gateway gateway = new Gateway();
+              gateway.setGateway_name(gatewayResource.getGatewayName());
+              Users user = new Users();
+              user.setUser_name(userResource.getUserName());
+              Gateway_Worker gatewayWorker = new Gateway_Worker();
+              gatewayWorker.setGateway(gateway);
+              gatewayWorker.setUser(user);
+              em.persist(gatewayWorker);
+              em.getTransaction().commit();
+              em.close();
+          }   catch (Exception e){
+                e.printStackTrace();
+          }
 
     }
 
-    public static void removeGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
+    public static boolean removeGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
+        try{
+            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+            em = factory.createEntityManager();
+            em.getTransaction().begin();
+            Query q = em.createQuery("Delete p FROM Gateway_Worker p WHERE p.gateway_name =:gate_name and p.user_name =:usr_name");
+            q.setParameter("gate_name", gatewayResource.getGatewayName());
+            q.setParameter("usr_name", userResource.getUserName());
+            q.executeUpdate();
+            em.close();
+            return true;
+        }   catch (Exception e){
+            e.printStackTrace();
+            return false;
+        }
 
     }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java Thu Sep  6 21:23:58 2012
@@ -30,7 +30,7 @@ public class Application_Descriptor {
     private String application_descriptor_xml;
 
     @ManyToOne
-    @JoinColumn(name = "gateway_ID")
+    @JoinColumn(name = "gateway_name")
     private Gateway gateway;
 
     @OneToOne
@@ -42,7 +42,7 @@ public class Application_Descriptor {
     private Host_Descriptor host_descriptor;
 
     @ManyToOne
-    @JoinColumn(name = "user_ID")
+    @JoinColumn(name = "user_name")
     private Users user;
 
     public String getApplication_descriptor_ID() {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java Thu Sep  6 21:23:58 2012
@@ -35,7 +35,7 @@ public class Experiment {
     private Date submitted_date;
 
     @ManyToOne
-    @JoinColumn(name = "user_ID")
+    @JoinColumn(name = "user_name")
     private Users user;
 
     @ManyToOne

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java Thu Sep  6 21:23:58 2012
@@ -26,17 +26,8 @@ import javax.persistence.Id;
 @Entity
 public class Gateway {
     @Id
-    private int gateway_ID;
     private String gateway_name;
 
-    public int getGateway_ID() {
-        return gateway_ID;
-    }
-
-    public void setGateway_ID(int gateway_ID) {
-        this.gateway_ID = gateway_ID;
-    }
-
     public String getGateway_name() {
         return gateway_name;
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java Thu Sep  6 21:23:58 2012
@@ -30,30 +30,26 @@ import javax.persistence.ManyToOne;
 @IdClass(Gateway_Worker_PK.class)
 public class Gateway_Worker {
     @Id
-    private int gateway_ID;
+    private String gateway_name;
 
     @Id
-    private int user_ID;
+    private String user_name;
 
     @ManyToOne
-    @JoinColumn(name = "gateway_ID")
+    @JoinColumn(name = "gateway_name")
     private Gateway gateway;
 
 
     @ManyToOne
-    @JoinColumn(name = "user_ID")
+    @JoinColumn(name = "user_name")
     private Users user;
 
-    public int getUser_ID() {
-        return user_ID;
+    public String getUser_name() {
+        return user_name;
     }
 
-    public void setUser_ID(int user_ID) {
-        this.user_ID = user_ID;
-    }
-
-    public int getGateway_ID() {
-        return gateway_ID;
+    public void setUser_name(String user_name) {
+        this.user_name = user_name;
     }
 
     public void setGateway(Gateway gateway) {
@@ -68,18 +64,22 @@ public class Gateway_Worker {
         return user;
     }
 
-    public void setGateway_ID(int gateway_ID) {
-        this.gateway_ID = gateway_ID;
-    }
-
     public void setUser(Users user) {
         this.user = user;
     }
+
+    public String getGateway_name() {
+        return gateway_name;
+    }
+
+    public void setGateway_name(String gateway_name) {
+        this.gateway_name = gateway_name;
+    }
 }
 
 class Gateway_Worker_PK {
-    private int gateway_ID;
-    private int user_ID;
+    private String gateway_name;
+    private String user_name;
 
     public Gateway_Worker_PK() {
         ;
@@ -95,19 +95,19 @@ class Gateway_Worker_PK {
 		return 1;
 	}
 
-    public int getGateway_ID() {
-        return gateway_ID;
+    public String getUser_name() {
+        return user_name;
     }
 
-    public int getUser_ID() {
-        return user_ID;
+    public void setUser_name(String user_name) {
+        this.user_name = user_name;
     }
 
-    public void setGateway_ID(int gateway_ID) {
-        this.gateway_ID = gateway_ID;
+    public String getGateway_name() {
+        return gateway_name;
     }
 
-    public void setUser_ID(int user_ID) {
-        this.user_ID = user_ID;
+    public void setGateway_name(String gateway_name) {
+        this.gateway_name = gateway_name;
     }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java Thu Sep  6 21:23:58 2012
@@ -29,11 +29,11 @@ public class Host_Descriptor {
     private String host_descriptor_xml;
 
     @ManyToOne
-    @JoinColumn(name = "gateway_ID")
+    @JoinColumn(name = "gateway_name")
     private Gateway gateway;
 
     @ManyToOne
-    @JoinColumn(name = "user_ID")
+    @JoinColumn(name = "user_name")
     private Users user;
 
     public String getHost_descriptor_ID() {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java Thu Sep  6 21:23:58 2012
@@ -29,11 +29,11 @@ public class Project {
     private String project_name;
 
     @ManyToOne
-    @JoinColumn(name = "gateway_ID")
+    @JoinColumn(name = "gateway_name")
     private Gateway gateway;
 
     @ManyToOne
-    @JoinColumn(name = "user_ID")
+    @JoinColumn(name = "user_name")
     private Users users;
 
     public int getProject_ID() {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java Thu Sep  6 21:23:58 2012
@@ -39,7 +39,7 @@ public class Published_Workflow {
     private String workflow_content;
 
     @Id
-    private int gateway_ID;
+    private String gateway_name;
 
 //    @Id
 //    @ManyToOne
@@ -82,12 +82,12 @@ public class Published_Workflow {
         this.workflow_content = workflow_content;
     }
 
-    public int getGateway_ID() {
-        return gateway_ID;
+    public String getGateway_name() {
+        return gateway_name;
     }
 
-    public void setGateway_ID(int gateway_ID) {
-        this.gateway_ID = gateway_ID;
+    public void setGateway_name(String gateway_name) {
+        this.gateway_name = gateway_name;
     }
 
     //    public void setGateway(Gateway gateway) {
@@ -96,7 +96,7 @@ public class Published_Workflow {
 }
 
 class Published_Workflow_PK {
-    private int gateway_ID;
+    private String gateway_name;
     private String publish_workflow_name;
 
     public Published_Workflow_PK() {
@@ -113,22 +113,20 @@ class Published_Workflow_PK {
 		return 1;
 	}
 
-
-    public int getGateway_ID() {
-        return gateway_ID;
-    }
-
     public String getPublish_workflow_name() {
         return publish_workflow_name;
     }
 
-    public void setGateway_ID(int gateway_ID) {
-        this.gateway_ID = gateway_ID;
-    }
-
     public void setPublish_workflow_name(String publish_workflow_name) {
         this.publish_workflow_name = publish_workflow_name;
     }
 
+    public String getGateway_name() {
+        return gateway_name;
+    }
+
+    public void setGateway_name(String gateway_name) {
+        this.gateway_name = gateway_name;
+    }
 }
 

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java Thu Sep  6 21:23:58 2012
@@ -29,11 +29,11 @@ public class Service_Descriptor {
     private String service_descriptor_xml;
 
     @ManyToOne
-    @JoinColumn(name = "gateway_ID")
+    @JoinColumn(name = "gateway_name")
     private Gateway gateway;
 
     @ManyToOne
-    @JoinColumn(name = "user_ID")
+    @JoinColumn(name = "user_name")
     private Users user;
 
     public String getService_descriptor_ID() {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java Thu Sep  6 21:23:58 2012
@@ -39,7 +39,7 @@ public class User_Workflow {
     private int project_ID;
 
     @Id
-    private int user_ID;
+    private String user_name;
 
 //    @Id
 //    @ManyToOne
@@ -91,16 +91,17 @@ public class User_Workflow {
         return project_ID;
     }
 
-    public int getUser_ID() {
-        return user_ID;
-    }
 
     public void setProject_ID(int project_ID) {
         this.project_ID = project_ID;
     }
 
-    public void setUser_ID(int user_ID) {
-        this.user_ID = user_ID;
+    public String getUser_name() {
+        return user_name;
+    }
+
+    public void setUser_name(String user_name) {
+        this.user_name = user_name;
     }
 
     public void setLast_update_date(Date last_update_date) {
@@ -115,7 +116,7 @@ public class User_Workflow {
 class User_Workflow_PK {
     private String user_workflow_name;
     private int project_ID;
-    private int user_ID;
+    private String user_name;
 
     public User_Workflow_PK() {
         ;
@@ -139,8 +140,12 @@ class User_Workflow_PK {
         return project_ID;
     }
 
-    public int getUser_ID() {
-        return user_ID;
+    public String getUser_name() {
+        return user_name;
+    }
+
+    public void setUser_name(String user_name) {
+        this.user_name = user_name;
     }
 
     public void setUser_workflow_name(String user_workflow_name) {
@@ -151,7 +156,5 @@ class User_Workflow_PK {
         this.project_ID = project_ID;
     }
 
-    public void setUser_ID(int user_ID) {
-        this.user_ID = user_ID;
-    }
+
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java Thu Sep  6 21:23:58 2012
@@ -31,23 +31,14 @@ import javax.persistence.OneToMany;
 public class Users {
 
     @Id
-    private int user_ID;
-    private String password;
     private String user_name;
+    private String password;
 
-    public int getUser_ID() {
-        return user_ID;
-    }
 
     public String getUser_name() {
         return user_name;
     }
 
-
-    public void setUser_ID(int user_ID) {
-        this.user_ID = user_ID;
-    }
-
     public void setUser_name(String user_name) {
         this.user_name = user_name;
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.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/ApplicationDescriptorResource.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java Thu Sep  6 21:23:58 2012
@@ -31,8 +31,8 @@ import java.util.List;
 
 public class ApplicationDescriptorResource extends AbstractResource {
     private String name;
-    private int gatewayID;
-    private int userID;
+    private String gatewayName;
+    private String userName;
     private String content;
     private String hostDescName;
     private String serviceDescName;
@@ -42,23 +42,26 @@ public class ApplicationDescriptorResour
     }
 
     public ApplicationDescriptorResource() {
+    }
 
+    public String getGatewayName() {
+        return gatewayName;
     }
 
-    public int getUserID() {
-        return userID;
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
     }
 
-    public void setUserID(int userID) {
-        this.userID = userID;
+    public String getUserName() {
+        return userName;
     }
 
-    public String getName() {
-        return name;
+    public void setUserName(String userName) {
+        this.userName = userName;
     }
 
-    public int getGatewayID() {
-        return gatewayID;
+    public String getName() {
+        return name;
     }
 
     public String getContent() {
@@ -73,10 +76,6 @@ public class ApplicationDescriptorResour
         return serviceDescName;
     }
 
-    public void setGatewayID(int gatewayID) {
-        this.gatewayID = gatewayID;
-    }
-
     public void setContent(String content) {
         this.content = content;
     }
@@ -110,7 +109,7 @@ public class ApplicationDescriptorResour
         Application_Descriptor applicationDescriptor = new Application_Descriptor();
         applicationDescriptor.setApplication_descriptor_ID(name);
         Gateway gateway = new Gateway();
-        gateway.setGateway_ID(gatewayID);
+        gateway.setGateway_name(gatewayName);
         applicationDescriptor.setGateway(gateway);
         Host_Descriptor hostDescriptor = new Host_Descriptor();
         hostDescriptor.setHost_descriptor_ID(hostDescName);

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.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/ExperimentResource.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java Thu Sep  6 21:23:58 2012
@@ -31,7 +31,7 @@ import java.util.List;
 
 public class ExperimentResource extends AbstractResource {
     private int projectID;
-    private int userID;
+    private String userName;
     private String expID;
     private Date submittedDate;
 
@@ -46,10 +46,6 @@ public class ExperimentResource extends 
         return projectID;
     }
 
-    public int getUserID() {
-        return userID;
-    }
-
     public String getExpID() {
         return expID;
     }
@@ -62,8 +58,12 @@ public class ExperimentResource extends 
         this.projectID = projectID;
     }
 
-    public void setUserID(int userID) {
-        this.userID = userID;
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
     }
 
     public void setSubmittedDate(Date submittedDate) {
@@ -94,7 +94,7 @@ public class ExperimentResource extends 
         project.setProject_ID(projectID);
         experiment.setProject(project);
         Users user = new Users();
-        user.setUser_ID(userID);
+        user.setUser_name(userName);
         experiment.setUser(user);
         experiment.setSubmitted_date(submittedDate);
         em.persist(experiment);

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.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/GatewayResource.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java Thu Sep  6 21:23:58 2012
@@ -35,33 +35,41 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class GatewayResource extends AbstractResource {
-    private int gatewayID = -1;
+    private String gatewayName;
     private String name;
 
+    public String getGatewayName() {
+        return gatewayName;
+    }
+
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
+    }
+
     public Resource create(ResourceType type) {
         if (type == ResourceType.PROJECT) {
             ProjectResource projectResource = new ProjectResource();
-            projectResource.setGatewayID(gatewayID);
+            projectResource.setGatewayName(gatewayName);
             return projectResource;
         } else if (type == ResourceType.USER) {
             UserResource userResource = new UserResource();
-            userResource.setGatewayID(gatewayID);
+            userResource.setGatewayName(gatewayName);
             return userResource;
         } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
             PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource();
-            publishWorkflowResource.setGatewayID(gatewayID);
+            publishWorkflowResource.setGatewayName(gatewayName);
             return publishWorkflowResource;
         } else if (type == ResourceType.HOST_DESCRIPTOR) {
             HostDescriptorResource hostDescriptorResource = new HostDescriptorResource();
-            hostDescriptorResource.setGatewayID(gatewayID);
+            hostDescriptorResource.setGatewayName(gatewayName);
             return hostDescriptorResource;
         } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
             ServiceDescriptorResource serviceDescriptorResource = new ServiceDescriptorResource();
-            serviceDescriptorResource.setGatewayID(gatewayID);
+            serviceDescriptorResource.setGatewayName(gatewayName);
             return serviceDescriptorResource;
         } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
-            applicationDescriptorResource.setGatewayID(gatewayID);
+            applicationDescriptorResource.setGatewayName(gatewayName);
             return applicationDescriptorResource;
         } else {
             return null;
@@ -71,36 +79,36 @@ public class GatewayResource extends Abs
     public void remove(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.PROJECT) {
-            Query q = em.createQuery("Delete p FROM Project p WHERE p.project_name = :proj_name and p.gateway_ID = :gate_ID");
+            Query q = em.createQuery("Delete p FROM Project p WHERE p.project_name = :proj_name and p.gateway_name = :gate_name");
             q.setParameter("proj_name", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             q.executeUpdate();
         } else if (type == ResourceType.USER) {
-            Query q = em.createQuery("Delete p FROM Users p WHERE p.user_name = :usr_name and p.gateway_ID = :gate_ID");
+            Query q = em.createQuery("Delete p FROM Users p WHERE p.user_name = :usr_name and p.gateway_name = :gate_name");
             q.setParameter("usr_name", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             q.executeUpdate();
         } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
-            Query q = em.createQuery("Delete p FROM Published_Workflow p WHERE p.publish_workflow_name = :pub_workflow_id and p.gateway_ID = :gate_ID");
+            Query q = em.createQuery("Delete p FROM Published_Workflow p WHERE p.publish_workflow_name = :pub_workflow_id and p.gateway_name = :gate_name");
             q.setParameter("pub_workflow_id", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             q.executeUpdate();
             end();
         } else if (type == ResourceType.HOST_DESCRIPTOR) {
             begin();
-            Query q = em.createQuery("Delete p FROM Host_Descriptor p WHERE p.host_descriptor_ID = :host_desc_id and p.gateway_ID = :gate_ID");
+            Query q = em.createQuery("Delete p FROM Host_Descriptor p WHERE p.host_descriptor_ID = :host_desc_id and p.gateway_name = :gate_name");
             q.setParameter("host_desc_id", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             q.executeUpdate();
         } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
-            Query q = em.createQuery("Delete p FROM Service_Descriptor p WHERE p.service_descriptor_ID = :service_desc_id and p.gateway_ID = :gate_ID");
+            Query q = em.createQuery("Delete p FROM Service_Descriptor p WHERE p.service_descriptor_ID = :service_desc_id and p.gateway_name = :gate_name");
             q.setParameter("service_desc_id", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             q.executeUpdate();
         } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
-            Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.gateway_ID = :gate_ID");
+            Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.gateway_name = :gate_name");
             q.setParameter("app_desc_id", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             q.executeUpdate();
         }
         end();
@@ -111,28 +119,28 @@ public class GatewayResource extends Abs
     public Resource get(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.PROJECT) {
-            Query q = em.createQuery("SELECT p FROM Project p WHERE p.project_name = :proj_name and p.gateway_ID =:gate_ID");
+            Query q = em.createQuery("SELECT p FROM Project p WHERE p.project_name = :proj_name and p.gateway_name =:gate_name");
             q.setParameter("proj_name", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             Project eproject = (Project) q.getSingleResult();
             ProjectResource projectResource = new ProjectResource(eproject.getProject_ID());
             projectResource.setName(eproject.getProject_name());
             end();
             return projectResource;
         } else if (type == ResourceType.USER) {
-            Query q = em.createQuery("SELECT p FROM Users p WHERE p.user_name = :username and p.gateway_ID =:gate_ID");
+            Query q = em.createQuery("SELECT p FROM Users p WHERE p.user_name = :username and p.gateway_name =:gate_name");
             q.setParameter("username", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             Users eUser = (Users) q.getSingleResult();
-            UserResource userResource = new UserResource(eUser.getUser_ID());
+            UserResource userResource = new UserResource();
             userResource.setUserName(eUser.getUser_name());
-            userResource.setGatewayID(gatewayID);
+            userResource.setGatewayName(gatewayName);
             end();
             return userResource;
         } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
-            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.publish_workflow_name = :pub_workflow_name and p.gateway_ID =:gate_ID");
+            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.publish_workflow_name = :pub_workflow_name and p.gateway_name =:gate_name");
             q.setParameter("pub_workflow_name", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             Published_Workflow ePub_workflow = (Published_Workflow) q.getSingleResult();
             PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource(ePub_workflow.getPublish_workflow_name());
             publishWorkflowResource.setContent(ePub_workflow.getWorkflow_content());
@@ -141,32 +149,32 @@ public class GatewayResource extends Abs
             end();
             return publishWorkflowResource;
         } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.service_descriptor_ID = :service_desc_id and p.gateway_ID =:gate_ID");
+            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.service_descriptor_ID = :service_desc_id and p.gateway_name =:gate_name");
             q.setParameter("service_desc_id", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             Service_Descriptor eServiceDesc = (Service_Descriptor) q.getSingleResult();
             ServiceDescriptorResource serviceDescriptorResource = new ServiceDescriptorResource(eServiceDesc.getService_descriptor_ID());
-            serviceDescriptorResource.setGatewayID(eServiceDesc.getGateway().getGateway_ID());
+            serviceDescriptorResource.setGatewayName(eServiceDesc.getGateway().getGateway_name());
             serviceDescriptorResource.setContent(eServiceDesc.getService_descriptor_xml());
             end();
             return serviceDescriptorResource;
         } else if (type == ResourceType.HOST_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.host_descriptor_ID = :host_desc_id and p.gateway_ID =:gate_ID");
+            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.host_descriptor_ID = :host_desc_id and p.gateway_name =:gate_name");
             q.setParameter("host_desc_id", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             Host_Descriptor eHostDesc = (Host_Descriptor) q.getSingleResult();
             HostDescriptorResource hostDescriptorResource = new HostDescriptorResource(eHostDesc.getHost_descriptor_ID());
-            hostDescriptorResource.setGatewayID(eHostDesc.getGateway().getGateway_ID());
+            hostDescriptorResource.setGatewayName(eHostDesc.getGateway().getGateway_name());
             hostDescriptorResource.setContent(eHostDesc.getHost_descriptor_ID());
             end();
             return hostDescriptorResource;
         } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.gateway_ID =:gate_ID");
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.gateway_name =:gate_name");
             q.setParameter("app_desc_id", name);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             Application_Descriptor eappDesc = (Application_Descriptor) q.getSingleResult();
             ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID());
-            applicationDescriptorResource.setGatewayID(eappDesc.getGateway().getGateway_ID());
+            applicationDescriptorResource.setGatewayName(eappDesc.getGateway().getGateway_name());
             applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
             applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor().getHost_descriptor_ID());
             applicationDescriptorResource.setServiceDescName(eappDesc.getService_descriptor().getService_descriptor_ID());
@@ -182,40 +190,40 @@ public class GatewayResource extends Abs
         List<Resource> resourceList = new ArrayList<Resource>();
         begin();
         if (type == ResourceType.PROJECT) {
-            Query q = em.createQuery("SELECT p FROM Project p WHERE p.gateway_ID =:gate_ID");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Project p WHERE p.gateway_name =:gate_name");
+            q.setParameter("gate_name", gatewayName);
             List results = q.getResultList();
             if (results.size() != 0) {
                 for (Object result : results) {
                     Project project = (Project) result;
                     ProjectResource projectResource = new ProjectResource(project.getProject_ID());
-                    projectResource.setGatewayID(gatewayID);
+                    projectResource.setGatewayName(gatewayName);
                     projectResource.setName(project.getProject_name());
                     resourceList.add(projectResource);
                 }
             }
         } else if (type == ResourceType.USER) {
-            Query q = em.createQuery("SELECT p FROM Users p WHERE p.gateway_ID =:gate_ID");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Users p WHERE p.gateway_name =:gate_name");
+            q.setParameter("gate_name", gatewayName);
             List results = q.getResultList();
             if (results.size() != 0) {
                 for (Object result : results) {
                     Users user = (Users) result;
-                    UserResource userResource = new UserResource(user.getUser_ID());
-                    userResource.setGatewayID(gatewayID);
+                    UserResource userResource = new UserResource();
+                    userResource.setGatewayName(gatewayName);
                     userResource.setUserName(user.getUser_name());
                     resourceList.add(userResource);
                 }
             }
         } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
-            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_ID =:gate_ID");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_name =:gate_name");
+            q.setParameter("gate_name", gatewayName);
             List results = q.getResultList();
             if (results.size() != 0) {
                 for (Object result : results) {
                     Published_Workflow publishedWorkflow = (Published_Workflow) result;
                     PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource(publishedWorkflow.getPublish_workflow_name());
-                    publishWorkflowResource.setGatewayID(gatewayID);
+                    publishWorkflowResource.setGatewayName(gatewayName);
                     publishWorkflowResource.setContent(publishedWorkflow.getWorkflow_content());
                     publishWorkflowResource.setPublishedDate(publishedWorkflow.getPublished_date());
                     publishWorkflowResource.setVersion(publishedWorkflow.getVersion());
@@ -223,40 +231,40 @@ public class GatewayResource extends Abs
                 }
             }
         } else if (type == ResourceType.HOST_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.gateway_ID =:gate_ID");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.gateway_name =:gate_name");
+            q.setParameter("gate_name", gatewayName);
             List results = q.getResultList();
             if (results.size() != 0) {
                 for (Object result : results) {
                     Host_Descriptor hostDescriptor = (Host_Descriptor) result;
                     HostDescriptorResource hostDescriptorResource = new HostDescriptorResource(hostDescriptor.getHost_descriptor_ID());
-                    hostDescriptorResource.setGatewayID(gatewayID);
+                    hostDescriptorResource.setGatewayName(gatewayName);
                     hostDescriptorResource.setContent(hostDescriptor.getHost_descriptor_xml());
                     resourceList.add(hostDescriptorResource);
                 }
             }
         } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.gateway_ID =:gate_ID");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.gateway_name =:gate_name");
+            q.setParameter("gate_name", gatewayName);
             List results = q.getResultList();
             if (results.size() != 0) {
                 for (Object result : results) {
                     Service_Descriptor serviceDescriptor = (Service_Descriptor) result;
                     ServiceDescriptorResource serviceDescriptorResource = new ServiceDescriptorResource(serviceDescriptor.getService_descriptor_ID());
-                    serviceDescriptorResource.setGatewayID(gatewayID);
+                    serviceDescriptorResource.setGatewayName(gatewayName);
                     serviceDescriptorResource.setContent(serviceDescriptor.getService_descriptor_xml());
                     resourceList.add(serviceDescriptorResource);
                 }
             }
         } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_ID =:gate_ID");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_name =:gate_name");
+            q.setParameter("gate_name", gatewayName);
             List results = q.getResultList();
             if (results.size() != 0) {
                 for (Object result : results) {
                     Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
                     ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID());
-                    applicationDescriptorResource.setGatewayID(gatewayID);
+                    applicationDescriptorResource.setGatewayName(gatewayName);
                     applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
                     applicationDescriptorResource.setHostDescName(applicationDescriptor.getHost_descriptor().getHost_descriptor_ID());
                     applicationDescriptorResource.setServiceDescName(applicationDescriptor.getService_descriptor().getService_descriptor_ID());
@@ -273,11 +281,7 @@ public class GatewayResource extends Abs
         begin();
         Gateway gateway = new Gateway();
         gateway.setGateway_name(name);
-        if (gatewayID != -1) {
-            gateway.setGateway_ID(gatewayID);
-        }
         em.persist(gateway);
-
         System.out.println(gateway);
         end();
     }
@@ -285,38 +289,38 @@ public class GatewayResource extends Abs
     public boolean isExists(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.PROJECT) {
-            Query q = em.createQuery("SELECT p FROM Project p WHERE p.gateway_ID =:gate_ID and p.project_name =:proj_name");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Project p WHERE p.gateway_name =:gate_name and p.project_name =:proj_name");
+            q.setParameter("gate_name", gatewayName);
             q.setParameter("proj_name", name);
             Project project = (Project) q.getSingleResult();
             return project != null;
         } else if (type == ResourceType.USER) {
-            Query q = em.createQuery("SELECT p FROM Users p WHERE p.gateway_ID =:gate_ID and p.user_name =:usr_name");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Users p WHERE p.gateway_name =:gate_name and p.user_name =:usr_name");
+            q.setParameter("gate_name", gatewayName);
             q.setParameter("usr_name", name);
             Users users = (Users) q.getSingleResult();
             return users != null;
         } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
-            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_ID =:gate_ID and p.Published_Workflow =:pub_wf_name");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_name =:gate_name and p.Published_Workflow =:pub_wf_name");
+            q.setParameter("gate_name", gatewayName);
             q.setParameter("pub_wf_name", name);
             Published_Workflow publishedWrkflow = (Published_Workflow) q.getSingleResult();
             return publishedWrkflow != null;
         } else if (type == ResourceType.HOST_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.gateway_ID =:gate_ID and p.host_descriptor_ID =:host_desc_name");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.gateway_name =:gate_name and p.host_descriptor_ID =:host_desc_name");
+            q.setParameter("gate_name", gatewayName);
             q.setParameter("host_desc_name", name);
             Host_Descriptor hostDescriptor = (Host_Descriptor) q.getSingleResult();
             return hostDescriptor != null;
         } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.gateway_ID =:gate_ID and p.service_descriptor_ID =:service_desc_name");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.gateway_name =:gate_name and p.service_descriptor_ID =:service_desc_name");
+            q.setParameter("gate_name", gatewayName);
             q.setParameter("service_desc_name", name);
             Service_Descriptor serviceDescriptor = (Service_Descriptor) q.getSingleResult();
             return serviceDescriptor != null;
         } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
-            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_ID =:gate_ID and p.application_descriptor_ID =:app_desc_name");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_name =:gate_name and p.application_descriptor_ID =:app_desc_name");
+            q.setParameter("gate_name", gatewayName);
             q.setParameter("app_desc_name", name);
             Application_Descriptor applicationDescriptor = (Application_Descriptor) q.getSingleResult();
             return applicationDescriptor != null;
@@ -333,11 +337,4 @@ public class GatewayResource extends Abs
         this.name = name;
     }
 
-    public int getGatewayID() {
-        return gatewayID;
-    }
-
-    public void setGatewayID(int gatewayID) {
-        this.gatewayID = gatewayID;
-    }
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.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/HostDescriptorResource.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java Thu Sep  6 21:23:58 2012
@@ -32,7 +32,7 @@ import java.util.List;
 
 public class HostDescriptorResource extends AbstractResource {
     private String hostDescName;
-    private int gatewayID;
+    private String gatewayName;
     private int userID;
     private String content;
 
@@ -55,16 +55,16 @@ public class HostDescriptorResource exte
         return hostDescName;
     }
 
-    public int getGatewayID() {
-        return gatewayID;
+    public String getGatewayName() {
+        return gatewayName;
     }
 
     public String getContent() {
         return content;
     }
 
-    public void setGatewayID(int gatewayID) {
-        this.gatewayID = gatewayID;
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
     }
 
     public void setContent(String content) {
@@ -74,7 +74,7 @@ public class HostDescriptorResource exte
     public Resource create(ResourceType type) {
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
-            applicationDescriptorResource.setGatewayID(gatewayID);
+            applicationDescriptorResource.setGatewayName(gatewayName);
             applicationDescriptorResource.setHostDescName(hostDescName);
             return applicationDescriptorResource;
         }
@@ -84,10 +84,10 @@ public class HostDescriptorResource exte
     public void remove(ResourceType type, Object name) {
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             begin();
-            Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.host_descriptor_ID = :host_desc_name and p.gateway_ID = :gate_ID");
+            Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.host_descriptor_ID = :host_desc_name and p.gateway_name =:gate_name");
             q.setParameter("app_desc_id", name);
             q.setParameter("host_desc_name", hostDescName);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             q.executeUpdate();
             end();
         }
@@ -96,13 +96,13 @@ public class HostDescriptorResource exte
     public Resource get(ResourceType type, Object name) {
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             begin();
-            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.host_descriptor_ID =:host_desc_name and p.gateway_ID =:gate_ID");
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.host_descriptor_ID =:host_desc_name and p.gateway_name =:gate_name");
             q.setParameter("app_desc_id", name);
             q.setParameter("host_desc_name", hostDescName);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             Application_Descriptor eappDesc = (Application_Descriptor) q.getSingleResult();
             ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID());
-            applicationDescriptorResource.setGatewayID(eappDesc.getGateway().getGateway_ID());
+            applicationDescriptorResource.setGatewayName(eappDesc.getGateway().getGateway_name());
             applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
             applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor().getHost_descriptor_ID());
             applicationDescriptorResource.setServiceDescName(hostDescName);
@@ -116,15 +116,15 @@ public class HostDescriptorResource exte
         List<Resource> resourceList = new ArrayList<Resource>();
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             begin();
-            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_ID =:gate_ID and p.host_descriptor_ID =:host_desc_id");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_name =:gate_name and p.host_descriptor_ID =:host_desc_id");
+            q.setParameter("gate_name", gatewayName);
             q.setParameter("host_desc_id", hostDescName);
             List results = q.getResultList();
             if (results.size() != 0) {
                 for (Object result : results) {
                     Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
                     ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID());
-                    applicationDescriptorResource.setGatewayID(gatewayID);
+                    applicationDescriptorResource.setGatewayName(gatewayName);
                     applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
                     applicationDescriptorResource.setHostDescName(hostDescName);
                     applicationDescriptorResource.setServiceDescName(applicationDescriptor.getService_descriptor().getService_descriptor_ID());
@@ -141,7 +141,7 @@ public class HostDescriptorResource exte
         Host_Descriptor hostDescriptor = new Host_Descriptor();
         hostDescriptor.setHost_descriptor_ID(hostDescName);
         Gateway gateway = new Gateway();
-        gateway.setGateway_ID(gatewayID);
+        gateway.setGateway_name(gatewayName);
         hostDescriptor.setGateway(gateway);
         hostDescriptor.setHost_descriptor_xml(content);
         em.persist(hostDescriptor);

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.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/ProjectResource.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java Thu Sep  6 21:23:58 2012
@@ -35,8 +35,8 @@ public class ProjectResource extends Abs
 
     private String name;
     private int id = -1;
-    private int gatewayID;
-    private int userID;
+    private String gatewayName;
+    private String userName;
     private UserResource userResource;
     private Gateway gateway;
 
@@ -47,30 +47,38 @@ public class ProjectResource extends Abs
         this.id = id;
     }
 
-    public int getUserID() {
-        return userID;
+    public ProjectResource(UserResource userResource, String gateway, int id) {
+        this.userResource = userResource;
+        this.gatewayName = gateway;
+        this.id = id;
     }
 
-    public void setUserID(int userID) {
-        this.userID = userID;
+    public String getGatewayName() {
+        return gatewayName;
     }
 
-    public ProjectResource(UserResource userResource, int gatewayID, int id) {
-        this.userResource = userResource;
-        this.gatewayID = gatewayID;
-        this.id = id;
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
     }
 
     public Resource create(ResourceType type) {
         if (type == ResourceType.USER_WORKFLOW) {
             UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
             userWorkflowResource.setProjectID(id);
-            userWorkflowResource.setUserID(userResource.getId());
+            userWorkflowResource.setUserName(userWorkflowResource.getUserName());
             return userWorkflowResource;
         } else if (type == ResourceType.EXPERIMENT) {
             ExperimentResource experimentResource = new ExperimentResource();
             experimentResource.setProjectID(id);
-            experimentResource.setUserID(userResource.getId());
+            experimentResource.setUserName(userResource.getUserName());
             return experimentResource;
         } else {
             return null;
@@ -80,15 +88,15 @@ public class ProjectResource extends Abs
     public void remove(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.USER_WORKFLOW) {
-            Query q = em.createQuery("Delete p FROM User_Workflow p WHERE p.project_ID = :proj_id and p.user_ID = :user_id and p.user_workflow_name = :usrwf_name");
+            Query q = em.createQuery("Delete p FROM User_Workflow p WHERE p.project_ID = :proj_id and p.user_name = :usr_name and p.user_workflow_name = :usrwf_name");
             q.setParameter("proj_id", id);
-            q.setParameter("user_id", userResource.getId());
+            q.setParameter("usr_name", userResource.getUserName());
             q.setParameter("usrwf_name", name);
             q.executeUpdate();
         } else if (type == ResourceType.EXPERIMENT) {
-            Query q = em.createQuery("Delete p FROM Experiment p WHERE p.project_ID = :proj_id and p.user_ID = :user_id and p.experiment_ID = :ex_name");
+            Query q = em.createQuery("Delete p FROM Experiment p WHERE p.project_ID = :proj_id and p.user_name = :usr_name and p.experiment_ID = :ex_name");
             q.setParameter("proj_id", id);
-            q.setParameter("user_id", userResource.getId());
+            q.setParameter("usr_name", userResource.getUserName());
             q.setParameter("ex_name", name);
             q.executeUpdate();
         }
@@ -98,20 +106,20 @@ public class ProjectResource extends Abs
     public Resource get(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.USER_WORKFLOW) {
-            Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.project_ID = :proj_id and p.user_ID = :user_id and p.user_workflow_name = :usrwf_name");
+            Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.project_ID = :proj_id and p.user_name = :usr_name and p.user_workflow_name = :usrwf_name");
             q.setParameter("proj_id", id);
-            q.setParameter("user_id", userResource.getId());
+            q.setParameter("usr_name", userResource.getUserName());
             q.setParameter("usrwf_name", name);
             User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
-            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(id, userResource.getId(), userWorkflow.getUser_workflow_name());
+            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(id, userResource.getUserName(), userWorkflow.getUser_workflow_name());
             userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
             userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
             end();
             return userWorkflowResource;
         } else if (type == ResourceType.EXPERIMENT) {
-            Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.project_ID = :proj_id and p.user_ID = :user_id and p.experiment_ID = :ex_name");
+            Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.project_ID = :proj_id and p.user_name = :usr_name and p.experiment_ID = :ex_name");
             q.setParameter("proj_id", id);
-            q.setParameter("user_id", userResource.getId());
+            q.setParameter("usr_name", userResource.getUserName());
             q.setParameter("ex_name", name);
             Experiment experiment = (Experiment) q.getSingleResult();
             ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
@@ -134,7 +142,7 @@ public class ProjectResource extends Abs
             if (results.size() != 0) {
                 for (Object result : results) {
                     User_Workflow userWorkflow = (User_Workflow) result;
-                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject_ID(), userWorkflow.getUser_ID(), userWorkflow.getUser_workflow_name());
+                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject_ID(), userWorkflow.getUser_name(), userWorkflow.getUser_workflow_name());
                     userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
                     userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
                     resourceList.add(userWorkflowResource);
@@ -149,7 +157,7 @@ public class ProjectResource extends Abs
                     Experiment experiment = (Experiment) result;
                     ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
                     experimentResource.setProjectID(experiment.getProject().getProject_ID());
-                    experimentResource.setUserID(experiment.getUser().getUser_ID());
+                    experimentResource.setUserName(experiment.getUser().getUser_name());
                     experimentResource.setSubmittedDate(experiment.getSubmitted_date());
                     resourceList.add(experimentResource);
                 }
@@ -164,7 +172,7 @@ public class ProjectResource extends Abs
         Project project = new Project();
         project.setProject_name(name);
         Gateway gateway = new Gateway();
-        gateway.setGateway_ID(gatewayID);
+        gateway.setGateway_name(gatewayName);
         project.setGateway(gateway);
 
         if (id != -1) {
@@ -181,9 +189,9 @@ public class ProjectResource extends Abs
     public boolean isExists(ResourceType type, Object name) {
         begin();
         if (type == ResourceType.USER_WORKFLOW) {
-            Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.gateway_ID =:gate_ID and p.user_ID =:userID and p.project_ID =:projectID");
-            q.setParameter("gate_ID", gatewayID);
-            q.setParameter("userID", userResource.getId());
+            Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.gateway_name =:gate_name and p.user_name = :usr_name and p.project_ID =:projectID");
+            q.setParameter("gate_name", gatewayName);
+            q.setParameter("usr_name", userResource.getUserName());
             q.setParameter("projectID", id);
             User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
             if (userWorkflow != null) {
@@ -192,9 +200,9 @@ public class ProjectResource extends Abs
                 return false;
             }
         } else if (type == ResourceType.EXPERIMENT) {
-            Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.gateway_ID =:gate_ID and p.user_ID =:userID and p.project_ID =:projectID");
-            q.setParameter("gate_ID", gatewayID);
-            q.setParameter("userID", userResource.getId());
+            Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.gateway_name =:gate_name and p.user_name = :usr_name and p.project_ID =:projectID");
+            q.setParameter("gate_name", gatewayName);
+            q.setParameter("usr_name", userResource.getUserName());
             q.setParameter("projectID", id);
             Experiment experiment = (Experiment) q.getSingleResult();
             if (experiment != null) {
@@ -219,7 +227,5 @@ public class ProjectResource extends Abs
         return id;
     }
 
-    void setGatewayID(int gatewayID) {
-        this.gatewayID = gatewayID;
-    }
+
 }

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=1381763&r1=1381762&r2=1381763&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:23:58 2012
@@ -33,7 +33,7 @@ public class PublishWorkflowResource ext
     private String version;
     private Date publishedDate;
     private String content;
-    private int gatewayID;
+    private String gatewayName;
 
     public PublishWorkflowResource() {
     }
@@ -70,12 +70,12 @@ public class PublishWorkflowResource ext
         this.content = content;
     }
 
-    public int getGatewayID() {
-        return gatewayID;
+    public String getGatewayName() {
+        return gatewayName;
     }
 
-    public void setGatewayID(int gatewayID) {
-        this.gatewayID = gatewayID;
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
     }
 
     public Resource create(ResourceType type) {
@@ -102,8 +102,8 @@ public class PublishWorkflowResource ext
         publishedWorkflow.setVersion(version);
         publishedWorkflow.setWorkflow_content(content);
         Gateway gateway = new Gateway();
-        gateway.setGateway_ID(gatewayID);
-        publishedWorkflow.setGateway_ID(gatewayID);
+        gateway.setGateway_name(gatewayName);
+        publishedWorkflow.setGateway_name(gatewayName);
         em.persist(gateway);
         end();
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ServiceDescriptorResource.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/ServiceDescriptorResource.java?rev=1381763&r1=1381762&r2=1381763&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ServiceDescriptorResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ServiceDescriptorResource.java Thu Sep  6 21:23:58 2012
@@ -32,8 +32,8 @@ import java.util.List;
 
 public class ServiceDescriptorResource extends AbstractResource {
     private String serviceDescName;
-    private int gatewayID;
-    private int userID;
+    private String gatewayName;
+    private String userName;
     private String content;
 
 
@@ -45,28 +45,28 @@ public class ServiceDescriptorResource e
 
     }
 
-    public String getServiceDescName() {
-        return serviceDescName;
+    public String getGatewayName() {
+        return gatewayName;
     }
 
-    public int getUserID() {
-        return userID;
+    public String getUserName() {
+        return userName;
     }
 
-    public void setUserID(int userID) {
-        this.userID = userID;
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
     }
 
-    public int getGatewayID() {
-        return gatewayID;
+    public void setUserName(String userName) {
+        this.userName = userName;
     }
 
-    public String getContent() {
-        return content;
+    public String getServiceDescName() {
+        return serviceDescName;
     }
 
-    public void setGatewayID(int gatewayID) {
-        this.gatewayID = gatewayID;
+    public String getContent() {
+        return content;
     }
 
     public void setContent(String content) {
@@ -76,7 +76,7 @@ public class ServiceDescriptorResource e
     public Resource create(ResourceType type) {
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
-            applicationDescriptorResource.setGatewayID(gatewayID);
+            applicationDescriptorResource.setGatewayName(gatewayName);
             applicationDescriptorResource.setHostDescName(serviceDescName);
             return applicationDescriptorResource;
         }
@@ -86,10 +86,10 @@ public class ServiceDescriptorResource e
     public void remove(ResourceType type, Object name) {
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             begin();
-            Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.service_descriptor_ID = :service_desc_name and p.gateway_ID = :gate_ID");
+            Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.service_descriptor_ID = :service_desc_name and p.gateway_name =:gate_name");
             q.setParameter("app_desc_id", name);
             q.setParameter("service_desc_name", serviceDescName);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             q.executeUpdate();
             end();
         }
@@ -99,13 +99,13 @@ public class ServiceDescriptorResource e
     public Resource get(ResourceType type, Object name) {
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             begin();
-            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.service_descriptor_ID = :service_desc_name and p.gateway_ID =:gate_ID");
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.service_descriptor_ID = :service_desc_name and p.gateway_name =:gate_name");
             q.setParameter("app_desc_id", name);
             q.setParameter("service_desc_name", serviceDescName);
-            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("gate_name", gatewayName);
             Application_Descriptor eappDesc = (Application_Descriptor) q.getSingleResult();
             ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID());
-            applicationDescriptorResource.setGatewayID(eappDesc.getGateway().getGateway_ID());
+            applicationDescriptorResource.setGatewayName(eappDesc.getGateway().getGateway_name());
             applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
             applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor().getHost_descriptor_ID());
             applicationDescriptorResource.setServiceDescName(serviceDescName);
@@ -119,15 +119,15 @@ public class ServiceDescriptorResource e
         List<Resource> resourceList = new ArrayList<Resource>();
         if (type == ResourceType.APPLICATION_DESCRIPTOR) {
             begin();
-            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_ID =:gate_ID and p.service_descriptor_ID = :service_desc_name");
-            q.setParameter("gate_ID", gatewayID);
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_name =:gate_name and p.service_descriptor_ID = :service_desc_name");
+            q.setParameter("gate_name", gatewayName);
             q.setParameter("service_desc_name", serviceDescName);
             List results = q.getResultList();
             if (results.size() != 0) {
                 for (Object result : results) {
                     Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
                     ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID());
-                    applicationDescriptorResource.setGatewayID(gatewayID);
+                    applicationDescriptorResource.setGatewayName(gatewayName);
                     applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
                     applicationDescriptorResource.setHostDescName(applicationDescriptor.getHost_descriptor().getHost_descriptor_ID());
                     applicationDescriptorResource.setServiceDescName(serviceDescName);
@@ -144,7 +144,7 @@ public class ServiceDescriptorResource e
         Service_Descriptor serviceDescriptor = new Service_Descriptor();
         serviceDescriptor.setService_descriptor_ID(serviceDescName);
         Gateway gateway = new Gateway();
-        gateway.setGateway_ID(gatewayID);
+        gateway.setGateway_name(gatewayName);
         serviceDescriptor.setGateway(gateway);
         serviceDescriptor.setService_descriptor_xml(content);
         em.persist(serviceDescriptor);



Mime
View raw message