Repository: airavata
Updated Branches:
  refs/heads/master 67ca5b199 -> 2e2868f73


http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
index 34aa67e..d0cb0c4 100644
--- 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
+++ 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
@@ -37,15 +37,34 @@ import org.slf4j.LoggerFactory;
 
 public class GatewayResource extends AbstractResource {
     private final static Logger logger = 
LoggerFactory.getLogger(GatewayResource.class);
+
+    private String gatewayId;
     private String gatewayName;
-    private String owner;
+    private String domain;
+    private String emailAddress;
+
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public String getEmailAddress() {
+        return emailAddress;
+    }
+
+    public void setEmailAddress(String emailAddress) {
+        this.emailAddress = emailAddress;
+    }
 
     /**
      *
-     * @param gatewayName gateway name
+     * @param gatewayId gateway name
      */
-    public GatewayResource(String gatewayName) {
-       setGatewayName(gatewayName);
+    public GatewayResource(String gatewayId) {
+       setGatewayId(gatewayId);
        }
 
     /**
@@ -72,20 +91,21 @@ public class GatewayResource extends AbstractResource {
 
     /**
      *
-     * @return owner of the gateway
+     * @return domain of the gateway
      */
-    public String getOwner() {
-        return owner;
+    public String getDomain() {
+        return domain;
     }
 
     /**
      *
-     * @param owner owner of the gateway
+     * @param domain domain of the gateway
      */
-    public void setOwner(String owner) {
-        this.owner = owner;
+    public void setDomain(String domain) {
+        this.domain = domain;
     }
 
+
     /**
      * Gateway is at the root level.  So it can populate his child resources.
      * Project, User, Published Workflows, User workflows, Host descriptors,
@@ -100,14 +120,6 @@ public class GatewayResource extends AbstractResource {
                 ProjectResource projectResource = new ProjectResource();
                 projectResource.setGateway(this);
                 return projectResource;
-            case PUBLISHED_WORKFLOW:
-                PublishWorkflowResource publishWorkflowResource = new 
PublishWorkflowResource();
-                publishWorkflowResource.setGateway(this);
-                return publishWorkflowResource;
-            case USER_WORKFLOW:
-                UserWorkflowResource userWorkflowResource = new 
UserWorkflowResource();
-                userWorkflowResource.setGateway(this);
-                return userWorkflowResource;
             case EXPERIMENT:
                 ExperimentResource experimentResource =new 
ExperimentResource();
                 experimentResource.setGateway(this);
@@ -141,13 +153,6 @@ public class GatewayResource extends AbstractResource {
                     q = generator.deleteQuery(em);
                     q.executeUpdate();
                     break;
-                case PUBLISHED_WORKFLOW:
-                    generator = new QueryGenerator(PUBLISHED_WORKFLOW);
-                    
generator.setParameter(PublishedWorkflowConstants.PUBLISH_WORKFLOW_NAME, name);
-                    
generator.setParameter(PublishedWorkflowConstants.GATEWAY_NAME, gatewayName);
-                    q = generator.deleteQuery(em);
-                    q.executeUpdate();
-                    break;
                 case EXPERIMENT:
                     generator = new QueryGenerator(EXPERIMENT);
                     generator.setParameter(ExperimentConstants.EXPERIMENT_ID, 
name);
@@ -190,7 +195,7 @@ public class GatewayResource extends AbstractResource {
                 case GATEWAY_WORKER:
                     generator = new QueryGenerator(GATEWAY_WORKER);
                     generator.setParameter(GatewayWorkerConstants.USERNAME, 
name);
-                    
generator.setParameter(GatewayWorkerConstants.GATEWAY_NAME, gatewayName);
+                    generator.setParameter(GatewayWorkerConstants.GATEWAY_ID, 
gatewayId);
                     q = generator.selectQuery(em);
                     Gateway_Worker worker = (Gateway_Worker) 
q.getSingleResult();
                     WorkerResource workerResource =
@@ -208,17 +213,6 @@ public class GatewayResource extends AbstractResource {
                     em.getTransaction().commit();
                     em.close();
                     return userResource;
-                case PUBLISHED_WORKFLOW:
-                    generator = new QueryGenerator(PUBLISHED_WORKFLOW);
-                    
generator.setParameter(PublishedWorkflowConstants.PUBLISH_WORKFLOW_NAME, name);
-                    
generator.setParameter(PublishedWorkflowConstants.GATEWAY_NAME, gatewayName);
-                    q = generator.selectQuery(em);
-                    Published_Workflow ePub_workflow = (Published_Workflow) 
q.getSingleResult();
-                    PublishWorkflowResource publishWorkflowResource =
-                            (PublishWorkflowResource) 
Utils.getResource(ResourceType.PUBLISHED_WORKFLOW, ePub_workflow);
-                    em.getTransaction().commit();
-                    em.close();
-                    return publishWorkflowResource;
                 case EXPERIMENT:
                     generator = new QueryGenerator(EXPERIMENT);
                     generator.setParameter(ExperimentConstants.EXPERIMENT_ID, 
name);
@@ -265,7 +259,7 @@ public class GatewayResource extends AbstractResource {
             switch (type) {
                 case PROJECT:
                     generator = new QueryGenerator(PROJECT);
-                    Gateway gatewayModel = em.find(Gateway.class, gatewayName);
+                    Gateway gatewayModel = em.find(Gateway.class, gatewayId);
                     generator.setParameter("gateway", gatewayModel);
                     q = generator.selectQuery(em);
                     results = q.getResultList();
@@ -280,7 +274,7 @@ public class GatewayResource extends AbstractResource {
                     break;
                 case GATEWAY_WORKER:
                     generator = new QueryGenerator(GATEWAY_WORKER);
-                    
generator.setParameter(GatewayWorkerConstants.GATEWAY_NAME, gatewayName);
+                    generator.setParameter(GatewayWorkerConstants.GATEWAY_ID, 
gatewayId);
                     q = generator.selectQuery(em);
                     results = q.getResultList();
                     if (results.size() != 0) {
@@ -292,23 +286,9 @@ public class GatewayResource extends AbstractResource {
                         }
                     }
                     break;
-                case PUBLISHED_WORKFLOW:
-                    generator = new QueryGenerator(PUBLISHED_WORKFLOW);
-                    
generator.setParameter(PublishedWorkflowConstants.GATEWAY_NAME, gatewayName);
-                    q = generator.selectQuery(em);
-                    results = q.getResultList();
-                    if (results.size() != 0) {
-                        for (Object result : results) {
-                            Published_Workflow publishedWorkflow = 
(Published_Workflow) result;
-                            PublishWorkflowResource publishWorkflowResource =
-                                    (PublishWorkflowResource) 
Utils.getResource(ResourceType.PUBLISHED_WORKFLOW, publishedWorkflow);
-                            resourceList.add(publishWorkflowResource);
-                        }
-                    }
-                    break;
                 case EXPERIMENT:
                     generator = new QueryGenerator(EXPERIMENT);
-                    generator.setParameter(ExperimentConstants.GATEWAY_NAME, 
gatewayName);
+                    generator.setParameter(ExperimentConstants.GATEWAY_ID, 
gatewayId);
                     q = generator.selectQuery(em);
                     results = q.getResultList();
                     if (results.size() != 0) {
@@ -359,16 +339,20 @@ public class GatewayResource extends AbstractResource {
         EntityManager em = null;
         try {
             em = ResourceUtils.getEntityManager();
-            Gateway existingGateway = em.find(Gateway.class, gatewayName);
+            Gateway existingGateway = em.find(Gateway.class, gatewayId);
             em.close();
 
             em = ResourceUtils.getEntityManager();
             em.getTransaction().begin();
             Gateway gateway = new Gateway();
             gateway.setGateway_name(gatewayName);
-            gateway.setOwner(owner);
+            gateway.setGateway_id(gatewayId);
+            gateway.setDomain(domain);
+            gateway.setEmailAddress(emailAddress);
             if (existingGateway != null) {
-                existingGateway.setOwner(owner);
+                existingGateway.setDomain(domain);
+                existingGateway.setGateway_name(gatewayName);
+                existingGateway.setEmailAddress(emailAddress);
                 gateway = em.merge(existingGateway);
             } else {
                 em.persist(gateway);
@@ -401,7 +385,7 @@ public class GatewayResource extends AbstractResource {
             switch (type) {
                 case GATEWAY_WORKER:
                     em = ResourceUtils.getEntityManager();
-                    Gateway_Worker existingWorker = 
em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayName, 
name.toString()));
+                    Gateway_Worker existingWorker = 
em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, 
name.toString()));
                     em.close();
                     return existingWorker != null;
                 case USER:
@@ -409,12 +393,6 @@ public class GatewayResource extends AbstractResource {
                     Users existingUser = em.find(Users.class, name);
                     em.close();
                     return existingUser != null;
-                case PUBLISHED_WORKFLOW:
-                    em = ResourceUtils.getEntityManager();
-                    Published_Workflow existingWf = 
em.find(Published_Workflow.class, new Published_Workflow_PK(gatewayName, 
name.toString()));
-                    em.close();
-                    boolean a = existingWf != null;
-                    return existingWf != null;
                 case EXPERIMENT:
                     em = ResourceUtils.getEntityManager();
                     Experiment existingExp = em.find(Experiment.class, 
name.toString());
@@ -437,59 +415,6 @@ public class GatewayResource extends AbstractResource {
         }
     }
 
-    /**
-     *
-     * @param workflowTemplateName published workflow template name
-     * @return boolean - whether workflow with the same name exists
-     */
-    public boolean isPublishedWorkflowExists(String workflowTemplateName) 
throws RegistryException{
-       return isExists(ResourceType.PUBLISHED_WORKFLOW, workflowTemplateName);
-    }
-
-    /**
-     *
-     * @param workflowTemplateName published workflow template name
-     * @return publish workflow resource
-     */
-    public PublishWorkflowResource createPublishedWorkflow(String 
workflowTemplateName) throws RegistryException{
-       PublishWorkflowResource publishedWorkflowResource =
-                
(PublishWorkflowResource)create(ResourceType.PUBLISHED_WORKFLOW);
-       publishedWorkflowResource.setName(workflowTemplateName);
-       publishedWorkflowResource.setPath("/");
-       publishedWorkflowResource.setVersion("1.0");
-       return publishedWorkflowResource;
-    }
-
-    /**
-     *
-     * @param workflowTemplateName published workflow template name
-     * @return publish workflow resource
-     */
-    public PublishWorkflowResource getPublishedWorkflow(String 
workflowTemplateName) throws RegistryException{
-       return 
(PublishWorkflowResource)get(ResourceType.PUBLISHED_WORKFLOW,workflowTemplateName);
-    }
-
-    /**
-     *
-     * @return list of publish workflows for the gateway
-     */
-    public List<PublishWorkflowResource> getPublishedWorkflows() throws 
RegistryException{
-       List<PublishWorkflowResource> result=new 
ArrayList<PublishWorkflowResource>();
-       List<Resource> list = get(ResourceType.PUBLISHED_WORKFLOW);
-       for (Resource resource : list) {
-                       result.add((PublishWorkflowResource) resource);
-               }
-       return result;
-    }
-
-    /**
-     *
-     * @param workflowTemplateName published workflow template name
-     */
-    public void removePublishedWorkflow(String workflowTemplateName) throws 
RegistryException{
-       remove(ResourceType.PUBLISHED_WORKFLOW, workflowTemplateName);
-    }
-    
     public ExperimentResource createExperiment (String experimentID) throws 
RegistryException{
         ExperimentResource metadataResource = 
(ExperimentResource)create(ResourceType.EXPERIMENT);
         metadataResource.setExpID(experimentID);

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
index 0643eb1..1926158 100644
--- 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
+++ 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
@@ -253,7 +253,7 @@ public class ProjectResource extends AbstractResource {
             Project project = new Project();
             project.setProject_id(id);
             project.setProject_name(name);
-            Gateway modelGateway = em.find(Gateway.class, 
gateway.getGatewayName());
+            Gateway modelGateway = em.find(Gateway.class, 
gateway.getGatewayId());
             project.setGateway(modelGateway);
             Users user = em.find(Users.class, worker.getUser());
             project.setUsers(user);

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
deleted file mode 100644
index 80df415..0000000
--- 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.persistance.registry.jpa.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Gateway;
-import org.apache.airavata.persistance.registry.jpa.model.Published_Workflow;
-import 
org.apache.airavata.persistance.registry.jpa.model.Published_Workflow_PK;
-import org.apache.airavata.persistance.registry.jpa.model.Users;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class PublishWorkflowResource extends AbstractResource {
-    private final static Logger logger = 
LoggerFactory.getLogger(PublishWorkflowResource.class);
-    private String name;
-    private String version;
-    private Timestamp publishedDate;
-    private String content;
-    private GatewayResource gateway;
-    private String createdUser;
-    private String path;
-
-    /**
-     *
-     */
-    public PublishWorkflowResource() {
-    }
-
-    /**
-     *
-     * @param gateway gateway resource
-     */
-    public PublishWorkflowResource(GatewayResource gateway) {
-        this.gateway = gateway;
-    }
-
-    /**
-     *
-     * @return created user
-     */
-    public String getCreatedUser() {
-        return createdUser;
-    }
-
-    /**
-     *
-     * @return path of the workflow
-     */
-    public String getPath() {
-        return path;
-    }
-
-    /**
-     *
-     * @param createdUser  created user
-     */
-    public void setCreatedUser(String createdUser) {
-        this.createdUser = createdUser;
-    }
-
-    /**
-     *
-     * @param path path of the workflow
-     */
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    /**
-     *
-     * @return name of the publish workflow
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     *
-     * @return version
-     */
-    public String getVersion() {
-        return version;
-    }
-
-    /**
-     *
-     * @return published date
-     */
-    public Timestamp getPublishedDate() {
-        return publishedDate;
-    }
-
-    /**
-     *
-     * @return content of the workflow
-     */
-    public String getContent() {
-        return content;
-    }
-
-    /**
-     *
-     * @param version version of the workflow
-     */
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
-    /**
-     *
-     * @param publishedDate published date of the workflow
-     */
-    public void setPublishedDate(Timestamp publishedDate) {
-        this.publishedDate = publishedDate;
-    }
-
-    /**
-     *
-     * @param content content of the workflow
-     */
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    /**
-     * Since published workflows are at the leaf level of the
-     * data structure, this method is not valid
-     * @param type type of the child resource
-     * @return UnsupportedOperationException
-     */
-    public Resource create(ResourceType type) throws RegistryException {
-        logger.error("Unsupported resource type for published workflow 
resource.", new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Since published workflows are at the leaf level of the
-     * data structure, this method is not valid
-     * @param type type of the child resource
-     * @param name name of the child resource
-     */
-    public void remove(ResourceType type, Object name) throws 
RegistryException{
-        logger.error("Unsupported resource type for published workflow 
resource.", new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Since published workflows are at the leaf level of the
-     * data structure, this method is not valid
-     * @param type type of the child resource
-     * @param name name of the child resource
-     * @return UnsupportedOperationException
-     */
-    public Resource get(ResourceType type, Object name) throws 
RegistryException{
-        logger.error("Unsupported resource type for published workflow 
resource.", new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * since published workflows are at the leaf level of the
-     * data structure, this method is not valid
-     * @param type type of the child resource
-     * @return UnsupportedOperationException
-     */
-    public List<Resource> get(ResourceType type) throws RegistryException{
-        logger.error("Unsupported resource type for published workflow 
resource.", new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * save published workflow to the database
-     */
-    public void save() throws RegistryException{
-        EntityManager em = null;
-        try {
-            em = ResourceUtils.getEntityManager();
-            Published_Workflow existingWF = em.find(Published_Workflow.class, 
new Published_Workflow_PK(gateway.getGatewayName(), name));
-            em.close();
-
-            em = ResourceUtils.getEntityManager();
-            em.getTransaction().begin();
-            Published_Workflow publishedWorkflow = new Published_Workflow();
-            publishedWorkflow.setPublish_workflow_name(getName());
-            publishedWorkflow.setPublished_date(publishedDate);
-            publishedWorkflow.setVersion(version);
-            byte[] bytes = content.getBytes();
-            publishedWorkflow.setWorkflow_content(bytes);
-            Gateway existingGateway = em.find(Gateway.class, 
gateway.getGatewayName());
-            publishedWorkflow.setGateway(existingGateway);
-            
publishedWorkflow.setGateway_name(existingGateway.getGateway_name());
-            Users user = em.find(Users.class, createdUser);
-            publishedWorkflow.setUser(user);
-            if (existingWF != null) {
-                existingWF.setUser(user);
-                existingWF.setGateway(existingGateway);
-                existingWF.setGateway_name(existingGateway.getGateway_name());
-                existingWF.setPublished_date(publishedDate);
-                existingWF.setWorkflow_content(bytes);
-                existingWF.setVersion(version);
-                existingWF.setPath(path);
-                publishedWorkflow = em.merge(existingWF);
-            } else {
-                em.merge(publishedWorkflow);
-            }
-
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new RegistryException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-
-    /**
-     * Since published workflows are at the leaf level of the
-     * data structure, this method is not valid
-     * @param type type of the child resource
-     * @param name name of the child resource
-     * @return UnsupportedOperationException
-     */
-    public boolean isExists(ResourceType type, Object name) throws 
RegistryException{
-        logger.error("Unsupported resource type for published workflow 
resource.", new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     *
-     * @return gateway resource
-     */
-    public GatewayResource getGateway() {
-               return gateway;
-       }
-
-    /**
-     *
-     * @param gateway gateway resource
-     */
-    public void setGateway(GatewayResource gateway) {
-               this.gateway = gateway;
-       }
-
-    /**
-     *
-     * @param name published workflow name
-     */
-    public void setName(String name) {
-               this.name = name;
-       }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
deleted file mode 100644
index 2b240a2..0000000
--- 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.persistance.registry.jpa.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.User_Workflow;
-import org.apache.airavata.persistance.registry.jpa.model.User_Workflow_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class UserWorkflowResource extends AbstractResource {
-    private final static Logger logger = 
LoggerFactory.getLogger(UserWorkflowResource.class);
-    private GatewayResource gateway;
-    private WorkerResource worker;
-    private String name;
-    private Timestamp lastUpdateDate;
-    private String content;
-    private String path;
-
-    public UserWorkflowResource() {
-    }
-
-    public UserWorkflowResource(GatewayResource gateway, WorkerResource 
worker, String name) {
-        this.setGateway(gateway);
-        this.setWorker(worker);
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setLastUpdateDate(Timestamp lastUpdateDate) {
-        this.lastUpdateDate = lastUpdateDate;
-    }
-
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    public Timestamp getLastUpdateDate() {
-        return lastUpdateDate;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    public Resource create(ResourceType type) throws RegistryException{
-        logger.error("Unsupported resource type for user workflow resource.", 
new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-    public void remove(ResourceType type, Object name) throws 
RegistryException{
-        logger.error("Unsupported resource type for user workflow resource.", 
new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-    public Resource get(ResourceType type, Object name) throws 
RegistryException{
-        logger.error("Unsupported resource type for user workflow resource.", 
new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-
-    public List<Resource> get(ResourceType type) throws RegistryException{
-        logger.error("Unsupported resource type for user workflow resource.", 
new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-    public void save() throws RegistryException {
-        EntityManager em = null;
-        try {
-            em = ResourceUtils.getEntityManager();
-            User_Workflow existingWF = em.find(User_Workflow.class, new 
User_Workflow_PK(name, worker.getUser(), gateway.getGatewayName()));
-            em.close();
-
-            em = ResourceUtils.getEntityManager();
-            em.getTransaction().begin();
-            User_Workflow userWorkflow = new User_Workflow();
-            userWorkflow.setTemplate_name(name);
-            if (lastUpdateDate == null) {
-                java.util.Date date = new java.util.Date();
-                lastUpdateDate = new Timestamp(date.getTime());
-            }
-            userWorkflow.setLast_updated_date(lastUpdateDate);
-            byte[] bytes = content.getBytes();
-            userWorkflow.setWorkflow_graph(bytes);
-            userWorkflow.setGateway_name(this.gateway.getGatewayName());
-            userWorkflow.setOwner(this.getWorker().getUser());
-            userWorkflow.setPath(path);
-            if (existingWF != null) {
-                existingWF.setGateway_name(this.gateway.getGatewayName());
-                existingWF.setOwner(this.getWorker().getUser());
-                existingWF.setTemplate_name(name);
-                existingWF.setLast_updated_date(lastUpdateDate);
-                existingWF.setPath(path);
-                existingWF.setWorkflow_graph(bytes);
-                userWorkflow = em.merge(existingWF);
-            } else {
-                em.persist(userWorkflow);
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new RegistryException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()){
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public boolean isExists(ResourceType type, Object name) throws 
RegistryException{
-        logger.error("Unsupported resource type for user workflow resource.", 
new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
-    }
-
-       public GatewayResource getGateway() {
-               return gateway;
-       }
-
-       public void setGateway(GatewayResource gateway) {
-               this.gateway = gateway;
-       }
-
-       public WorkerResource getWorker() {
-               return worker;
-       }
-
-       public void setWorker(WorkerResource worker) {
-               this.worker = worker;
-       }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
index 36a5e90..9add15b 100644
--- 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
+++ 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
@@ -191,20 +191,6 @@ public class Utils {
                     logger.error("Object should be a User.", new 
IllegalArgumentException());
                     throw new IllegalArgumentException("Object should be a 
User.");
                 }
-            case PUBLISHED_WORKFLOW:
-                if (o instanceof Published_Workflow){
-                    return createPublishWorkflow((Published_Workflow) o);
-                }else {
-                    logger.error("Object should be a Publish Workflow.", new 
IllegalArgumentException());
-                    throw new IllegalArgumentException("Object should be a 
Publish Workflow.");
-                }
-            case USER_WORKFLOW:
-                if (o instanceof User_Workflow){
-                    return createUserWorkflow((User_Workflow) o);
-                }else {
-                    logger.error("Object should be a User Workflow.", new 
IllegalArgumentException());
-                    throw new IllegalArgumentException("Object should be a 
User Workflow.");
-                }
             case GATEWAY_WORKER:
                 if (o instanceof Gateway_Worker){
                     return createGatewayWorker((Gateway_Worker)o);
@@ -359,6 +345,9 @@ public class Utils {
     private static Resource createGateway(Gateway o) {
         GatewayResource gatewayResource = new GatewayResource();
         gatewayResource.setGatewayName(o.getGateway_name());
+        gatewayResource.setGatewayId(o.getGateway_id());
+        gatewayResource.setDomain(o.getDomain());
+        gatewayResource.setEmailAddress(o.getEmailAddress());
         return gatewayResource;
     }
 
@@ -420,8 +409,10 @@ public class Utils {
      */
     private static Resource createGatewayWorker(Gateway_Worker o) {
         if (o != null){
-            GatewayResource gatewayResource = new 
GatewayResource(o.getGateway().getGateway_name());
-            gatewayResource.setOwner(o.getGateway().getOwner());
+            GatewayResource gatewayResource = new 
GatewayResource(o.getGateway().getGateway_id());
+            gatewayResource.setDomain(o.getGateway().getGateway_name());
+            gatewayResource.setDomain(o.getGateway().getDomain());
+            gatewayResource.setEmailAddress(o.getGateway().getEmailAddress());
             return new WorkerResource(o.getUser_name(), gatewayResource);
         }
         return null;
@@ -429,51 +420,6 @@ public class Utils {
 
     /**
      *
-     * @param o  Published_Workflow model object
-     * @return  Published Workflow resource object
-     */
-    private static Resource createPublishWorkflow(Published_Workflow o) {
-        PublishWorkflowResource publishWorkflowResource = new 
PublishWorkflowResource();
-        if (o != null){
-            GatewayResource gatewayResource = 
(GatewayResource)createGateway(o.getGateway());
-            publishWorkflowResource.setGateway(gatewayResource);
-            publishWorkflowResource.setCreatedUser(o.getUser().getUser_name());
-            publishWorkflowResource.setName(o.getPublish_workflow_name());
-            publishWorkflowResource.setContent(new 
String(o.getWorkflow_content()));
-            publishWorkflowResource.setPublishedDate(o.getPublished_date());
-            publishWorkflowResource.setVersion(o.getVersion());
-            publishWorkflowResource.setPath(o.getPath());
-        }
-
-        return publishWorkflowResource;
-    }
-
-    /**
-     *
-     * @param o User_Workflow model object
-     * @return User_Workflow resource object
-     */
-    private static Resource createUserWorkflow(User_Workflow o) {
-        UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
-        if (o != null){
-            userWorkflowResource.setName(o.getTemplate_name());
-            GatewayResource gatewayResource = 
(GatewayResource)createGateway(o.getGateway());
-            userWorkflowResource.setGateway(gatewayResource);
-            Gateway_Worker gateway_worker = new Gateway_Worker();
-            gateway_worker.setGateway(o.getGateway());
-            gateway_worker.setUser(o.getUser());
-            WorkerResource workerResource = (WorkerResource) 
createGatewayWorker(gateway_worker);
-            userWorkflowResource.setWorker(workerResource);
-            userWorkflowResource.setLastUpdateDate(o.getLast_updated_date());
-            userWorkflowResource.setContent(new String(o.getWorkflow_graph()));
-            userWorkflowResource.setPath(o.getPath());
-        }
-
-        return userWorkflowResource;
-    }
-
-    /**
-     *
      * @param o  Users model object
      * @return  UserResource object
      */

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
index 63939ca..e732566 100644
--- 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
+++ 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
@@ -74,12 +74,6 @@ public class WorkerResource extends AbstractResource {
                                projectResource.setGateway(gateway);
                                result=projectResource;
                                break;
-                       case USER_WORKFLOW:
-                               UserWorkflowResource userWorkflowResource = new 
UserWorkflowResource();
-                               userWorkflowResource.setWorker(this);
-                               userWorkflowResource.setGateway(gateway);
-                               result=userWorkflowResource;
-                break;
             case EXPERIMENT:
                 ExperimentResource experimentResource = new 
ExperimentResource();
                 experimentResource.setExecutionUser(user);
@@ -113,14 +107,6 @@ public class WorkerResource extends AbstractResource {
                     q = generator.deleteQuery(em);
                     q.executeUpdate();
                     break;
-                case USER_WORKFLOW:
-                    generator = new QueryGenerator(USER_WORKFLOW);
-                    generator.setParameter(UserWorkflowConstants.OWNER, 
getUser());
-                    
generator.setParameter(UserWorkflowConstants.TEMPLATE_NAME, name);
-                    generator.setParameter(UserWorkflowConstants.GATEWAY_NAME, 
gateway.getGatewayName());
-                    q = generator.deleteQuery(em);
-                    q.executeUpdate();
-                    break;
                 case EXPERIMENT:
                     generator = new QueryGenerator(EXPERIMENT);
                     generator.setParameter(ExperimentConstants.EXPERIMENT_ID, 
name);
@@ -168,15 +154,6 @@ public class WorkerResource extends AbstractResource {
                     Project project = (Project) q.getSingleResult();
                     result = Utils.getResource(ResourceType.PROJECT, project);
                     break;
-                case USER_WORKFLOW:
-                    generator = new QueryGenerator(USER_WORKFLOW);
-                    generator.setParameter(UserWorkflowConstants.OWNER, 
getUser());
-                    
generator.setParameter(UserWorkflowConstants.TEMPLATE_NAME, name);
-                    generator.setParameter(UserWorkflowConstants.GATEWAY_NAME, 
gateway.getGatewayName());
-                    q = generator.selectQuery(em);
-                    User_Workflow userWorkflow = (User_Workflow) 
q.getSingleResult();
-                    result = Utils.getResource(ResourceType.USER_WORKFLOW, 
userWorkflow);
-                    break;
                 case EXPERIMENT:
                     generator = new QueryGenerator(EXPERIMENT);
                     generator.setParameter(ExperimentConstants.EXPERIMENT_ID, 
name);
@@ -258,7 +235,7 @@ public class WorkerResource extends AbstractResource {
                 case PROJECT:
                     generator = new QueryGenerator(PROJECT);
                     Users users = em.find(Users.class, getUser());
-                    Gateway gatewayModel = em.find(Gateway.class, 
gateway.getGatewayName());
+                    Gateway gatewayModel = em.find(Gateway.class, 
gateway.getGatewayId());
                     generator.setParameter("users", users);
                     generator.setParameter("gateway", gatewayModel);
 //                generator.setParameter(ProjectConstants.USERNAME, getUser());
@@ -270,17 +247,6 @@ public class WorkerResource extends AbstractResource {
                         result.add(projectResource);
                     }
                     break;
-                case USER_WORKFLOW:
-                    generator = new QueryGenerator(USER_WORKFLOW);
-                    generator.setParameter(UserWorkflowConstants.OWNER, 
getUser());
-                    q = generator.selectQuery(em);
-//                 q.setParameter("usr_name", getUser());
-                    for (Object o : q.getResultList()) {
-                        User_Workflow userWorkflow = (User_Workflow) o;
-                        UserWorkflowResource userWorkflowResource = 
(UserWorkflowResource) Utils.getResource(ResourceType.USER_WORKFLOW, 
userWorkflow);
-                        result.add(userWorkflowResource);
-                    }
-                    break;
                 case EXPERIMENT:
                     generator = new QueryGenerator(EXPERIMENT);
                     generator.setParameter(ExperimentConstants.EXECUTION_USER, 
getUser());
@@ -318,7 +284,7 @@ public class WorkerResource extends AbstractResource {
         EntityManager em = null;
         try {
             em = ResourceUtils.getEntityManager();
-            Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new 
Gateway_Worker_PK(gateway.getGatewayName(), user));
+            Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new 
Gateway_Worker_PK(gateway.getGatewayId(), user));
             em.close();
 
             em = ResourceUtils.getEntityManager();
@@ -327,14 +293,14 @@ public class WorkerResource extends AbstractResource {
             Users existingUser = em.find(Users.class, this.user);
             gatewayWorker.setUser(existingUser);
             gatewayWorker.setUser_name(existingUser.getUser_name());
-            Gateway gatewaymodel = em.find(Gateway.class, 
gateway.getGatewayName());
+            Gateway gatewaymodel = em.find(Gateway.class, 
gateway.getGatewayId());
             gatewayWorker.setGateway(gatewaymodel);
-            gatewayWorker.setGateway_name(gatewaymodel.getGateway_name());
+            gatewayWorker.setGateway_id(gatewaymodel.getGateway_id());
             if (existingWorker != null) {
                 existingWorker.setUser_name(existingUser.getUser_name());
                 existingWorker.setUser(existingUser);
                 existingWorker.setGateway(gatewaymodel);
-                existingWorker.setGateway_name(gatewaymodel.getGateway_name());
+                existingWorker.setGateway_id(gatewaymodel.getGateway_id());
                 gatewayWorker = em.merge(existingWorker);
             } else {
                 em.persist(gatewayWorker);
@@ -443,56 +409,6 @@ public class WorkerResource extends AbstractResource {
 
     /**
      *
-     * @param templateName user workflow template
-     * @return whether the workflow is already exists under the given user
-     */
-       public boolean isWorkflowTemplateExists(String templateName) throws 
RegistryException{
-               return isExists(ResourceType.USER_WORKFLOW, templateName);
-       }
-
-    /**
-     *
-     * @param templateName user workflow template
-     * @return user workflow resource
-     */
-       public UserWorkflowResource createWorkflowTemplate(String templateName) 
throws RegistryException{
-               UserWorkflowResource 
workflow=(UserWorkflowResource)create(ResourceType.USER_WORKFLOW);
-               workflow.setName(templateName);
-               return workflow;
-       }
-
-    /**
-     *
-     * @param templateName user workflow template
-     * @return user workflow resource
-     */
-       public UserWorkflowResource getWorkflowTemplate(String templateName) 
throws RegistryException{
-               return (UserWorkflowResource)get(ResourceType.USER_WORKFLOW, 
templateName);
-       }
-
-    /**
-     *
-     * @param templateName user workflow template
-     */
-    public void removeWorkflowTemplate(String templateName) throws 
RegistryException{
-               remove(ResourceType.USER_WORKFLOW, templateName);
-       }
-
-    /**
-     *
-     * @return list of user workflows for the given user
-     */
-    public List<UserWorkflowResource> getWorkflowTemplates() throws 
RegistryException{
-               List<UserWorkflowResource> result=new 
ArrayList<UserWorkflowResource>();
-               List<Resource> list = get(ResourceType.USER_WORKFLOW);
-               for (Resource resource : list) {
-                       result.add((UserWorkflowResource) resource);
-               }
-               return result;
-       }
-
-    /**
-     *
      * @param name experiment name
      * @return whether experiment is already exist for the given user
      */

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
 
b/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
index a37b6ae..9055d3d 100644
--- 
a/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
+++ 
b/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
@@ -29,8 +29,6 @@
         
<class>org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker</class>
         
<class>org.apache.airavata.persistance.registry.jpa.model.Project</class>
         
<class>org.apache.airavata.persistance.registry.jpa.model.ProjectUser</class>
-        
<class>org.apache.airavata.persistance.registry.jpa.model.Published_Workflow</class>
-        
<class>org.apache.airavata.persistance.registry.jpa.model.User_Workflow</class>
         
<class>org.apache.airavata.persistance.registry.jpa.model.Experiment</class>
         
<class>org.apache.airavata.persistance.registry.jpa.model.Notification_Email</class>
         
<class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Input</class>

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql 
b/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
index c3d7b3a..9d02c3a 100644
--- 
a/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
+++ 
b/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
@@ -20,9 +20,11 @@
  */
 CREATE TABLE GATEWAY
 (
+        GATEWAY_ID VARCHAR (255),
         GATEWAY_NAME VARCHAR(255),
-             OWNER VARCHAR(255),
-        PRIMARY KEY (GATEWAY_NAME)
+             DOMAIN VARCHAR(255),
+             EMAIL_ADDRESS VARCHAR(255),
+        PRIMARY KEY (GATEWAY_ID)
 );
 
 CREATE TABLE CONFIGURATION
@@ -45,23 +47,23 @@ CREATE TABLE USERS
 
 CREATE TABLE GATEWAY_WORKER
 (
-        GATEWAY_NAME VARCHAR(255),
+        GATEWAY_ID VARCHAR(255),
         USER_NAME VARCHAR(255),
-        PRIMARY KEY (GATEWAY_NAME, USER_NAME),
-        FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+        PRIMARY KEY (GATEWAY_ID, USER_NAME),
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
         FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
 CREATE TABLE PROJECT
 (
-         GATEWAY_NAME VARCHAR(255),
+         GATEWAY_ID VARCHAR(255),
          USER_NAME VARCHAR(255) NOT NULL,
          PROJECT_ID VARCHAR(255),
          PROJECT_NAME VARCHAR(255) NOT NULL,
          DESCRIPTION VARCHAR(255),
          CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
          PRIMARY KEY (PROJECT_ID),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+         FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
          FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
@@ -74,37 +76,10 @@ CREATE TABLE PROJECT_USER
     FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
-CREATE TABLE PUBLISHED_WORKFLOW
-(
-         GATEWAY_NAME VARCHAR(255),
-         CREATED_USER VARCHAR(255),
-         PUBLISH_WORKFLOW_NAME VARCHAR(255),
-         VERSION VARCHAR(255),
-         PUBLISHED_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-         PATH VARCHAR (255),
-         WORKFLOW_CONTENT BLOB,
-         PRIMARY KEY(GATEWAY_NAME, PUBLISH_WORKFLOW_NAME),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
-         FOREIGN KEY (CREATED_USER) REFERENCES USERS(USER_NAME) ON DELETE 
CASCADE
-);
-
-CREATE TABLE USER_WORKFLOW
-(
-         GATEWAY_NAME VARCHAR(255),
-         OWNER VARCHAR(255),
-         TEMPLATE_NAME VARCHAR(255),
-         LAST_UPDATED_TIME TIMESTAMP DEFAULT CURRENT TIMESTAMP,
-         PATH VARCHAR (255),
-         WORKFLOW_GRAPH BLOB,
-         PRIMARY KEY(GATEWAY_NAME, OWNER, TEMPLATE_NAME),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
-         FOREIGN KEY (OWNER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
 CREATE TABLE EXPERIMENT
 (
         EXPERIMENT_ID VARCHAR(255),
-        GATEWAY_NAME VARCHAR(255),
+        GATEWAY_ID VARCHAR(255),
         EXECUTION_USER VARCHAR(255) NOT NULL,
         PROJECT_ID VARCHAR(255) NOT NULL,
         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
@@ -117,13 +92,11 @@ CREATE TABLE EXPERIMENT
         WORKFLOW_EXECUTION_ID VARCHAR(255),
         ALLOW_NOTIFICATION SMALLINT,
         PRIMARY KEY(EXPERIMENT_ID),
-        FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
         FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE 
CASCADE,
         FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE 
CASCADE
 );
 
-
-
 CREATE TABLE EXPERIMENT_INPUT
 (
         EXPERIMENT_ID VARCHAR(255),
@@ -392,11 +365,11 @@ CREATE TABLE QOS_PARAM
 
 CREATE TABLE COMMUNITY_USER
 (
-        GATEWAY_NAME VARCHAR(256) NOT NULL,
+        GATEWAY_ID VARCHAR(256) NOT NULL,
         COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
         TOKEN_ID VARCHAR(256) NOT NULL,
         COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
-        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
+        PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
 );
 
 CREATE TABLE CREDENTIALS

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql 
b/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
index 356c7d6..ec2fb42 100644
--- 
a/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
+++ 
b/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
@@ -20,9 +20,11 @@
  */
 CREATE TABLE GATEWAY
 (
+        GATEWAY_ID VARCHAR(255),
         GATEWAY_NAME VARCHAR(255),
-             OWNER VARCHAR(255),
-        PRIMARY KEY (GATEWAY_NAME)
+             DOMAIN VARCHAR(255),
+             EMAIL_ADDRESS VARCHAR(255),
+        PRIMARY KEY (GATEWAY_ID)
 );
 
 CREATE TABLE CONFIGURATION
@@ -45,23 +47,23 @@ CREATE TABLE USERS
 
 CREATE TABLE GATEWAY_WORKER
 (
-        GATEWAY_NAME VARCHAR(255),
+        GATEWAY_ID VARCHAR(255),
         USER_NAME VARCHAR(255),
-        PRIMARY KEY (GATEWAY_NAME, USER_NAME),
-        FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+        PRIMARY KEY (GATEWAY_ID, USER_NAME),
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
         FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
 CREATE TABLE PROJECT
 (
-         GATEWAY_NAME VARCHAR(255),
+         GATEWAY_ID VARCHAR(255),
          USER_NAME VARCHAR(255),
          PROJECT_NAME VARCHAR(255) NOT NULL,
          PROJECT_ID VARCHAR(255),
          DESCRIPTION VARCHAR(255),
          CREATION_TIME TIMESTAMP DEFAULT NOW(),
          PRIMARY KEY (PROJECT_ID),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+         FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
          FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
@@ -74,37 +76,10 @@ CREATE TABLE PROJECT_USER
     FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
-CREATE TABLE PUBLISHED_WORKFLOW
-(
-         GATEWAY_NAME VARCHAR(255),
-         CREATED_USER VARCHAR(255),
-         PUBLISH_WORKFLOW_NAME VARCHAR(255),
-         VERSION VARCHAR(255),
-         PUBLISHED_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-         PATH VARCHAR (255),
-         WORKFLOW_CONTENT BLOB,
-         PRIMARY KEY(GATEWAY_NAME, PUBLISH_WORKFLOW_NAME),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
-         FOREIGN KEY (CREATED_USER) REFERENCES USERS(USER_NAME) ON DELETE 
CASCADE
-);
-
-CREATE TABLE USER_WORKFLOW
-(
-         GATEWAY_NAME VARCHAR(255),
-         OWNER VARCHAR(255),
-         TEMPLATE_NAME VARCHAR(255),
-         LAST_UPDATED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
-         PATH VARCHAR (255),
-         WORKFLOW_GRAPH BLOB,
-         PRIMARY KEY(GATEWAY_NAME, OWNER, TEMPLATE_NAME),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
-         FOREIGN KEY (OWNER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
 CREATE TABLE EXPERIMENT
 (
         EXPERIMENT_ID VARCHAR(255),
-        GATEWAY_NAME VARCHAR(255),
+        GATEWAY_ID VARCHAR(255),
         EXECUTION_USER VARCHAR(255) NOT NULL,
         PROJECT_ID VARCHAR(255) NOT NULL,
         CREATION_TIME TIMESTAMP DEFAULT NOW(),
@@ -117,7 +92,7 @@ CREATE TABLE EXPERIMENT
         WORKFLOW_EXECUTION_ID VARCHAR(255),
         ALLOW_NOTIFICATION SMALLINT,
         PRIMARY KEY(EXPERIMENT_ID),
-        FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
         FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE 
CASCADE,
         FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE 
CASCADE
 );
@@ -391,11 +366,11 @@ CREATE TABLE QOS_PARAM
 
 CREATE TABLE COMMUNITY_USER
 (
-        GATEWAY_NAME VARCHAR(256) NOT NULL,
+        GATEWAY_ID VARCHAR(256) NOT NULL,
         COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
         TOKEN_ID VARCHAR(256) NOT NULL,
         COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
-        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
+        PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
 );
 
 CREATE TABLE CREDENTIALS

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
 
b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
index 0779418..33bb01d 100644
--- 
a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
+++ 
b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
@@ -36,8 +36,6 @@ public class GatewayResourceTest extends AbstractResourceTest 
{
     private ProjectResource projectResource;
     private UserResource userResource;
     private WorkerResource workerResource;
-    private PublishWorkflowResource publishWorkflowResource;
-    private UserWorkflowResource userWorkflowResource;
     private ExperimentResource experimentResource;
 
 
@@ -58,22 +56,8 @@ public class GatewayResourceTest extends 
AbstractResourceTest {
         projectResource.setWorker(workerResource);
         projectResource.save();
 
-        publishWorkflowResource = (PublishWorkflowResource) 
gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
-        userWorkflowResource = (UserWorkflowResource) 
gatewayResource.create(ResourceType.USER_WORKFLOW);
         experimentResource = (ExperimentResource) 
gatewayResource.create(ResourceType.EXPERIMENT);
 
-        userWorkflowResource.setName("workflow1");
-        userWorkflowResource.setLastUpdateDate(currentDate);
-        userWorkflowResource.setWorker(workerResource);
-        userWorkflowResource.setContent("testContent");
-        userWorkflowResource.save();
-
-        publishWorkflowResource.setName("pubworkflow1");
-        publishWorkflowResource.setCreatedUser("admin");
-        publishWorkflowResource.setContent("testContent");
-        publishWorkflowResource.setPublishedDate(currentDate);
-        publishWorkflowResource.save();
-
         experimentResource.setExpID("testExpID");
         experimentResource.setExecutionUser(getWorkerResource().getUser());
         experimentResource.setProject(getProjectResource());
@@ -86,7 +70,7 @@ public class GatewayResourceTest extends AbstractResourceTest 
{
     }
     @Test
     public void testSave() throws Exception {
-        gatewayResource.setOwner("owner1");
+        gatewayResource.setDomain("owner1");
         gatewayResource.save();
 
         boolean gatewayExist = ResourceUtils.isGatewayExist("default");
@@ -99,22 +83,18 @@ public class GatewayResourceTest extends 
AbstractResourceTest {
         assertNotNull("project resource cannot be null", projectResource);
         assertNotNull("user resource cannot be null", userResource);
         assertNotNull("worker resource cannot be null", workerResource);
-        assertNotNull("publish workflow resource cannot be null", 
publishWorkflowResource);
-        assertNotNull("user workflow resource cannot be null", 
userWorkflowResource);
         assertNotNull("experiment resource cannot be null", 
experimentResource);
     }
     
     @Test
     public void testIsExists() throws Exception {
         assertTrue(gatewayResource.isExists(ResourceType.GATEWAY_WORKER, 
"admin"));
-        assertTrue(gatewayResource.isExists(ResourceType.PUBLISHED_WORKFLOW, 
"pubworkflow1"));
         assertTrue(gatewayResource.isExists(ResourceType.EXPERIMENT, 
"testExpID"));
     }
 
     @Test
     public void testGet() throws Exception {
         assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER, 
"admin"));
-        assertNotNull(gatewayResource.get(ResourceType.PUBLISHED_WORKFLOW, 
"pubworkflow1"));
         assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT, 
"testExpID"));
     }
 
@@ -122,16 +102,12 @@ public class GatewayResourceTest extends 
AbstractResourceTest {
     public void testGetList() throws Exception {
         assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER));
         assertNotNull(gatewayResource.get(ResourceType.PROJECT));
-        assertNotNull(gatewayResource.get(ResourceType.PUBLISHED_WORKFLOW));
         assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT));
     }
     
     @Test
     public void testRemove() throws Exception {
 
-        gatewayResource.remove(ResourceType.PUBLISHED_WORKFLOW, 
"pubworkflow1");
-        assertFalse(gatewayResource.isExists(ResourceType.PUBLISHED_WORKFLOW, 
"pubworkflow1"));
-
         gatewayResource.remove(ResourceType.EXPERIMENT, "testExpID");
         assertFalse(gatewayResource.isExists(ResourceType.EXPERIMENT, 
"testExpID"));
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java
 
b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java
deleted file mode 100644
index 67142e4..0000000
--- 
a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/PublishWorkflowResourceTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-package org.apache.airavata.persistance.registry.jpa;
-
-import static org.junit.Assert.*;
-
-import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import 
org.apache.airavata.persistance.registry.jpa.resources.PublishWorkflowResource;
-import org.junit.After;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-public class PublishWorkflowResourceTest extends AbstractResourceTest {
-    private GatewayResource gatewayResource;
-    private PublishWorkflowResource publishWorkflowResource;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        gatewayResource = super.getGatewayResource();
-        publishWorkflowResource = 
gatewayResource.createPublishedWorkflow("workflow1");
-        publishWorkflowResource.setCreatedUser("admin");
-        publishWorkflowResource.setContent("testContent");
-        Calendar calender = Calendar.getInstance();
-        java.util.Date d = calender.getTime();
-        Timestamp currentTime = new Timestamp(d.getTime());
-        publishWorkflowResource.setPublishedDate(currentTime);
-    }
-
-    @Test
-    public void testSave() throws Exception {
-        publishWorkflowResource.save();
-        assertTrue("published workflow saved successfully", 
gatewayResource.isPublishedWorkflowExists("workflow1"));
-        //remove workflow
-        gatewayResource.removePublishedWorkflow("workflow1");
-    }
-
-    @After
-    public void tearDown() throws Exception {
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java
 
b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java
deleted file mode 100644
index d55e96b..0000000
--- 
a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-package org.apache.airavata.persistance.registry.jpa;
-
-import static org.junit.Assert.*;
-
-import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import 
org.apache.airavata.persistance.registry.jpa.resources.UserWorkflowResource;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
-import org.junit.After;
-import org.junit.Test;
-
-import java.sql.Date;
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-public class UserWorkflowResourceTest extends AbstractResourceTest {
-    private WorkerResource workerResource;
-    private UserWorkflowResource userWorkflowResource;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        GatewayResource gatewayResource = super.getGatewayResource();
-        workerResource = super.getWorkerResource();
-
-        userWorkflowResource = 
workerResource.createWorkflowTemplate("workflow1");
-        userWorkflowResource.setGateway(gatewayResource);
-        userWorkflowResource.setContent("testContent");
-        Calendar calender = Calendar.getInstance();
-        java.util.Date d = calender.getTime();
-        Timestamp currentTime = new Timestamp(d.getTime());
-        userWorkflowResource.setLastUpdateDate(currentTime);
-    }
-
-    @Test
-    public void testSave() throws Exception {
-        userWorkflowResource.save();
-        assertTrue("user workflow saved successfully", 
workerResource.isWorkflowTemplateExists("workflow1"));
-        //remove user workflow
-        workerResource.removeWorkflowTemplate("workflow1");
-    }
-
-    @After
-    public void tearDown() throws Exception {
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
 
b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
index 84eae9d..3dcc0c2 100644
--- 
a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
+++ 
b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
@@ -143,8 +143,10 @@ public class Initialize {
 
         try{
             GatewayResource gatewayResource = new GatewayResource();
+            
gatewayResource.setGatewayId(RegistrySettings.getSetting("default.registry.gateway"));
             
gatewayResource.setGatewayName(RegistrySettings.getSetting("default.registry.gateway"));
-            
gatewayResource.setOwner(RegistrySettings.getSetting("default.registry.gateway"));
+            gatewayResource.setDomain("test-domain");
+            gatewayResource.setEmailAddress("test-email");
             gatewayResource.save();
             
             UserResource userResource = new UserResource();

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e2868f7/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql 
b/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
index c3d7b3a..9d02c3a 100644
--- 
a/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
+++ 
b/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
@@ -20,9 +20,11 @@
  */
 CREATE TABLE GATEWAY
 (
+        GATEWAY_ID VARCHAR (255),
         GATEWAY_NAME VARCHAR(255),
-             OWNER VARCHAR(255),
-        PRIMARY KEY (GATEWAY_NAME)
+             DOMAIN VARCHAR(255),
+             EMAIL_ADDRESS VARCHAR(255),
+        PRIMARY KEY (GATEWAY_ID)
 );
 
 CREATE TABLE CONFIGURATION
@@ -45,23 +47,23 @@ CREATE TABLE USERS
 
 CREATE TABLE GATEWAY_WORKER
 (
-        GATEWAY_NAME VARCHAR(255),
+        GATEWAY_ID VARCHAR(255),
         USER_NAME VARCHAR(255),
-        PRIMARY KEY (GATEWAY_NAME, USER_NAME),
-        FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+        PRIMARY KEY (GATEWAY_ID, USER_NAME),
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
         FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
 CREATE TABLE PROJECT
 (
-         GATEWAY_NAME VARCHAR(255),
+         GATEWAY_ID VARCHAR(255),
          USER_NAME VARCHAR(255) NOT NULL,
          PROJECT_ID VARCHAR(255),
          PROJECT_NAME VARCHAR(255) NOT NULL,
          DESCRIPTION VARCHAR(255),
          CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
          PRIMARY KEY (PROJECT_ID),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+         FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
          FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
@@ -74,37 +76,10 @@ CREATE TABLE PROJECT_USER
     FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
 );
 
-CREATE TABLE PUBLISHED_WORKFLOW
-(
-         GATEWAY_NAME VARCHAR(255),
-         CREATED_USER VARCHAR(255),
-         PUBLISH_WORKFLOW_NAME VARCHAR(255),
-         VERSION VARCHAR(255),
-         PUBLISHED_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-         PATH VARCHAR (255),
-         WORKFLOW_CONTENT BLOB,
-         PRIMARY KEY(GATEWAY_NAME, PUBLISH_WORKFLOW_NAME),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
-         FOREIGN KEY (CREATED_USER) REFERENCES USERS(USER_NAME) ON DELETE 
CASCADE
-);
-
-CREATE TABLE USER_WORKFLOW
-(
-         GATEWAY_NAME VARCHAR(255),
-         OWNER VARCHAR(255),
-         TEMPLATE_NAME VARCHAR(255),
-         LAST_UPDATED_TIME TIMESTAMP DEFAULT CURRENT TIMESTAMP,
-         PATH VARCHAR (255),
-         WORKFLOW_GRAPH BLOB,
-         PRIMARY KEY(GATEWAY_NAME, OWNER, TEMPLATE_NAME),
-         FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
-         FOREIGN KEY (OWNER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
 CREATE TABLE EXPERIMENT
 (
         EXPERIMENT_ID VARCHAR(255),
-        GATEWAY_NAME VARCHAR(255),
+        GATEWAY_ID VARCHAR(255),
         EXECUTION_USER VARCHAR(255) NOT NULL,
         PROJECT_ID VARCHAR(255) NOT NULL,
         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
@@ -117,13 +92,11 @@ CREATE TABLE EXPERIMENT
         WORKFLOW_EXECUTION_ID VARCHAR(255),
         ALLOW_NOTIFICATION SMALLINT,
         PRIMARY KEY(EXPERIMENT_ID),
-        FOREIGN KEY (GATEWAY_NAME) REFERENCES GATEWAY(GATEWAY_NAME) ON DELETE 
CASCADE,
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE 
CASCADE,
         FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE 
CASCADE,
         FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE 
CASCADE
 );
 
-
-
 CREATE TABLE EXPERIMENT_INPUT
 (
         EXPERIMENT_ID VARCHAR(255),
@@ -392,11 +365,11 @@ CREATE TABLE QOS_PARAM
 
 CREATE TABLE COMMUNITY_USER
 (
-        GATEWAY_NAME VARCHAR(256) NOT NULL,
+        GATEWAY_ID VARCHAR(256) NOT NULL,
         COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
         TOKEN_ID VARCHAR(256) NOT NULL,
         COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
-        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
+        PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
 );
 
 CREATE TABLE CREDENTIALS

Reply via email to