You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/06/05 18:26:05 UTC

[15/30] airavata git commit: registry refactoring changes

http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
new file mode 100644
index 0000000..f5b9760
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
@@ -0,0 +1,328 @@
+/*
+ *
+ * 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.registry.core.app.catalog.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.registry.core.app.catalog.model.GlobusJobSubmission;
+import org.apache.airavata.registry.core.app.catalog.model.UnicoreJobSubmission;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UnicoreJobSubmissionResource extends AppCatAbstractResource {
+	
+	private final static Logger logger = LoggerFactory.getLogger(UnicoreJobSubmissionResource.class);
+	
+	private String jobSubmissionInterfaceId;
+	private String securityProtocol;
+	private String unicoreEndpointUrl;
+
+	public void remove(Object identifier) throws AppCatalogException {
+	        EntityManager em = null;
+	        try {
+	            em = AppCatalogJPAUtils.getEntityManager();
+	            em.getTransaction().begin();
+	            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+	            generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
+	            Query q = generator.deleteQuery(em);
+	            q.executeUpdate();
+	            em.getTransaction().commit();
+	            em.close();
+	        } catch (ApplicationSettingsException e) {
+	            logger.error(e.getMessage(), e);
+	            throw new AppCatalogException(e);
+	        } finally {
+	            if (em != null && em.isOpen()) {
+	                if (em.getTransaction().isActive()) {
+	                    em.getTransaction().rollback();
+	                }
+	                em.close();
+	            }
+	        }
+	    }
+
+	 public AppCatalogResource get(Object identifier) throws AppCatalogException {
+		 HashMap<String, String> ids;
+		 EntityManager em = null;
+	        try {
+	            em = AppCatalogJPAUtils.getEntityManager();
+	            em.getTransaction().begin();
+	            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+	            generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
+	            Query q = generator.selectQuery(em);
+	            UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) q.getSingleResult();
+	            UnicoreJobSubmissionResource unicoreSubmissionResource =
+	            			(UnicoreJobSubmissionResource) AppCatalogJPAUtils
+	            			.getResource(AppCatalogResourceType.UNICORE_JOB_SUBMISSION,
+							unicoreJobSubmission);
+	            em.getTransaction().commit();
+	            em.close();
+	            return unicoreSubmissionResource;
+	        } catch (ApplicationSettingsException e) {
+	            logger.error(e.getMessage(), e);
+	            throw new AppCatalogException(e);
+	        } finally {
+	            if (em != null && em.isOpen()) {
+	                if (em.getTransaction().isActive()) {
+	                    em.getTransaction().rollback();
+	                }
+	                em.close();
+	            }
+	        }
+	    }
+	 
+
+	    public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+	        List<AppCatalogResource> unicoreSubmissionResourceList = new ArrayList<AppCatalogResource>();
+	        EntityManager em = null;
+	        try {
+	            em = AppCatalogJPAUtils.getEntityManager();
+	            em.getTransaction().begin();
+	            Query q;
+	            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
+	            List results;
+	            if (fieldName.equals(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL)) {
+	                generator.setParameter(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL, value);
+	                q = generator.selectQuery(em);
+	                results = q.getResultList();
+	                if (results.size() != 0) {
+	                    for (Object result : results) {
+	                        UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
+	                        UnicoreJobSubmissionResource unicoreJobSubmissionResource =
+	                                (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
+	                                        AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
+	                        unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
+	                    }
+	                }
+	            } else if (fieldName.equals(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL)) {
+	                generator.setParameter(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL, value);
+	                q = generator.selectQuery(em);
+	                results = q.getResultList();
+	                if (results.size() != 0) {
+	                    for (Object result : results) {
+	                        UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
+	                        UnicoreJobSubmissionResource unicoreJobSubmissionResource =
+	                                (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
+	                                        AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
+	                        unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
+	                    }
+	                }
+	            }        
+	            else {
+	                em.getTransaction().commit();
+	                em.close();
+	                logger.error("Unsupported field name for Unicore submission resource.", new IllegalArgumentException());
+	                throw new IllegalArgumentException("Unsupported field name for Unicore Submission resource.");
+	            }
+	            em.getTransaction().commit();
+	            em.close();
+	        } catch (Exception e) {
+	            logger.error(e.getMessage(), e);
+	            throw new AppCatalogException(e);
+	        } finally {
+	            if (em != null && em.isOpen()) {
+	                if (em.getTransaction().isActive()) {
+	                    em.getTransaction().rollback();
+	                }
+	                em.close();
+	            }
+	        }
+	        return unicoreSubmissionResourceList;
+	    }
+
+	@Override
+	public List<AppCatalogResource> getAll() throws AppCatalogException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<String> getAllIds() throws AppCatalogException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+        List<String> globusSubmissionResourceIDs = new ArrayList<String>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            Query q;
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
+            List results;
+            if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
+                generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+                        globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+                    }
+                }
+            } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
+                generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+                        globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+                    }
+                }
+            }
+            else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
+                generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+                        globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+                    }
+                }
+            } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
+                generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
+                        globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
+                    }
+                }
+            } else {
+                em.getTransaction().commit();
+                em.close();
+                logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported field name for Globus Submission resource.");
+            }
+            em.getTransaction().commit();
+            em.close();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return globusSubmissionResourceIDs;
+    }
+
+    public void save() throws AppCatalogException {
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            UnicoreJobSubmission existingUnicoreSubmission = em.find(UnicoreJobSubmission.class, jobSubmissionInterfaceId);
+            em.close();
+
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            if (existingUnicoreSubmission != null) {
+                existingUnicoreSubmission.setSubmissionID(jobSubmissionInterfaceId);;
+                existingUnicoreSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
+                existingUnicoreSubmission.setSecurityProtocol(securityProtocol);
+
+                em.merge(existingUnicoreSubmission);
+            } else {
+            	UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
+                unicoreJobSubmission.setSubmissionID(jobSubmissionInterfaceId);
+                unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
+                unicoreJobSubmission.setSecurityProtocol(securityProtocol);
+                em.persist(unicoreJobSubmission);
+            }
+            em.getTransaction().commit();
+            em.close();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    public boolean isExists(Object identifier) throws AppCatalogException {
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            UnicoreJobSubmission unicoreJobSubmission = em.find(UnicoreJobSubmission.class, identifier);
+            em.close();
+            return unicoreJobSubmission != null;
+        } catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+
+	public String getjobSubmissionInterfaceId() {
+		return jobSubmissionInterfaceId;
+	}
+
+	public void setjobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
+		this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
+	}
+
+	public String getSecurityProtocol() {
+		return securityProtocol;
+	}
+
+	public void setSecurityProtocol(String securityProtocol) {
+		this.securityProtocol = securityProtocol;
+	}
+
+	public String getUnicoreEndpointUrl() {
+		return unicoreEndpointUrl;
+	}
+
+	public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
+		this.unicoreEndpointUrl = unicoreEndpointUrl;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowAppCatalogResourceAppCat.java
deleted file mode 100644
index ffc0fff..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowAppCatalogResourceAppCat.java
+++ /dev/null
@@ -1,382 +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.registry.core.app.catalog.resources;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.registry.core.app.catalog.model.Workflow;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType;
-import org.apache.airavata.registry.cpi.AppCatalogException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WorkflowAppCatalogResourceAppCat extends AppCatAbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(WorkflowAppCatalogResourceAppCat.class);
-    private String wfName;
-    private String createdUser;
-    private String graph;
-    private String wfTemplateId;
-    private Timestamp createdTime;
-    private Timestamp updatedTime;
-    private String image;
-    private String gatewayId;
-
-    public Timestamp getCreatedTime() {
-        return createdTime;
-    }
-
-    public void setCreatedTime(Timestamp createdTime) {
-        this.createdTime = createdTime;
-    }
-
-    public Timestamp getUpdatedTime() {
-        return updatedTime;
-    }
-
-    public void setUpdatedTime(Timestamp updatedTime) {
-        this.updatedTime = updatedTime;
-    }
-
-    public String getImage() {
-        return image;
-    }
-
-    public void setImage(String image) {
-        this.image = image;
-    }
-
-    public String getGatewayId() {
-        return gatewayId;
-    }
-
-    public void setGatewayId(String gatewayId) {
-        this.gatewayId = gatewayId;
-    }
-
-    @Override
-    public void remove(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
-            generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
-            Query q = generator.deleteQuery(em);
-            q.executeUpdate();
-            em.getTransaction().commit();
-            em.close();
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    @Override
-    public AppCatalogResource get(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
-            generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
-            Query q = generator.selectQuery(em);
-            Workflow workflow = (Workflow) q.getSingleResult();
-            WorkflowAppCatalogResourceAppCat workflowResource = (WorkflowAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
-            em.getTransaction().commit();
-            em.close();
-            return workflowResource;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    @Override
-    public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
-        List<AppCatalogResource> workflowResources = new ArrayList<AppCatalogResource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
-            Query q;
-            if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
-                generator.setParameter(fieldName, value);
-                q = generator.selectQuery(em);
-                List<?> results = q.getResultList();
-                for (Object result : results) {
-                    Workflow workflow = (Workflow) result;
-                    WorkflowAppCatalogResourceAppCat workflowResource = (WorkflowAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
-                    workflowResources.add(workflowResource);
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return workflowResources;
-    }
-
-    @Override
-    public List<AppCatalogResource> getAll() throws AppCatalogException {
-        List<AppCatalogResource> workflows = new ArrayList<AppCatalogResource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
-            generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
-            Query q = generator.selectQuery(em);
-            List results = q.getResultList();
-            if (results.size() != 0) {
-                for (Object result : results) {
-                    Workflow workflow = (Workflow) result;
-                    WorkflowAppCatalogResourceAppCat wfResource =
-                            (WorkflowAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
-                    workflows.add(wfResource);
-                }
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return workflows;
-    }
-
-    @Override
-    public List<String> getAllIds() throws AppCatalogException {
-        List<String> workflowIds = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
-            generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
-            Query q = generator.selectQuery(em);
-            List results = q.getResultList();
-            if (results.size() != 0) {
-                for (Object result : results) {
-                    Workflow workflow = (Workflow) result;
-                    workflowIds.add(workflow.getWfTemplateId());
-                }
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return workflowIds;
-    }
-
-    @Override
-    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-        List<String> workflowResourceIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
-            Query q;
-            if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
-                generator.setParameter(fieldName, value);
-                q = generator.selectQuery(em);
-                List<?> results = q.getResultList();
-                for (Object result : results) {
-                    Workflow workflow = (Workflow) result;
-                    WorkflowAppCatalogResourceAppCat workflowResource = (WorkflowAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
-                    workflowResourceIDs.add(workflowResource.getWfTemplateId());
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return workflowResourceIDs;
-    }
-
-    @Override
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            Workflow existingWorkflow = em.find(Workflow.class, wfTemplateId);
-            em.close();
-            Workflow workflow;
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            if (existingWorkflow == null) {
-                workflow = new Workflow();
-                workflow.setCreationTime(AiravataUtils.getCurrentTimestamp());
-            } else {
-                workflow = existingWorkflow;
-                workflow.setUpdateTime(AiravataUtils.getCurrentTimestamp());
-            }
-            workflow.setWfName(getWfName());
-            workflow.setCreatedUser(getCreatedUser());
-            workflow.setGatewayId(gatewayId);
-            if (getGraph() != null){
-                workflow.setGraph(getGraph().toCharArray());
-            }
-            if (image != null){
-                workflow.setImage(image.getBytes());
-            }
-            workflow.setWfTemplateId(getWfTemplateId());
-            if (existingWorkflow == null) {
-                em.persist(workflow);
-            } else {
-                em.merge(workflow);
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    @Override
-    public boolean isExists(Object identifier) throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            Workflow workflow = em.find(Workflow.class, identifier);
-            em.close();
-            return workflow != null;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public String getWfName() {
-        return wfName;
-    }
-
-    public String getCreatedUser() {
-        return createdUser;
-    }
-
-    public String getGraph() {
-        return graph;
-    }
-
-    public String getWfTemplateId() {
-        return wfTemplateId;
-    }
-
-    public void setWfName(String wfName) {
-        this.wfName=wfName;
-    }
-
-    public void setCreatedUser(String createdUser) {
-        this.createdUser=createdUser;
-    }
-
-    public void setGraph(String graph) {
-        this.graph=graph;
-    }
-
-    public void setWfTemplateId(String wfTemplateId) {
-        this.wfTemplateId=wfTemplateId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputAppCatalogResourceAppCat.java
deleted file mode 100644
index 89a34f4..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputAppCatalogResourceAppCat.java
+++ /dev/null
@@ -1,451 +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.registry.core.app.catalog.resources;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.registry.core.app.catalog.model.Workflow;
-import org.apache.airavata.registry.core.app.catalog.model.WorkflowInput;
-import org.apache.airavata.registry.core.app.catalog.model.WorkflowInput_PK;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType;
-import org.apache.airavata.registry.cpi.AppCatalogException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class WorkflowInputAppCatalogResourceAppCat extends AppCatAbstractResource {
-
-    private final static Logger logger = LoggerFactory.getLogger(WorkflowInputAppCatalogResourceAppCat.class);
-
-    private String wfTemplateId;
-    private String inputKey;
-    private String dataType;
-    private String inputVal;
-    private String metadata;
-    private String appArgument;
-    private String userFriendlyDesc;
-    private boolean standardInput;
-    private int inputOrder;
-    private boolean isRequired;
-    private boolean requiredToCMD;
-    private boolean dataStaged;
-
-    private WorkflowAppCatalogResourceAppCat workflowResource;
-
-    public void remove(Object identifier) throws AppCatalogException {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map) {
-            ids = (HashMap) identifier;
-        } else {
-            logger.error("Identifier should be a map with the field name and it's value");
-            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-        }
-
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
-            generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
-            generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
-            Query q = generator.deleteQuery(em);
-            q.executeUpdate();
-            em.getTransaction().commit();
-            em.close();
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public AppCatalogResource get(Object identifier) throws AppCatalogException {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map) {
-            ids = (HashMap<String, String>) identifier;
-        } else {
-            logger.error("Identifier should be a map with the field name and it's value");
-            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-        }
-
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
-            generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
-            generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
-            Query q = generator.selectQuery(em);
-            WorkflowInput workflowInput = (WorkflowInput) q.getSingleResult();
-            WorkflowInputAppCatalogResourceAppCat workflowInputResource =
-                    (WorkflowInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_INPUT
-                            , workflowInput);
-            em.getTransaction().commit();
-            em.close();
-            return workflowInputResource;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
-        List<AppCatalogResource> wfInputResources = new ArrayList<AppCatalogResource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
-            List results;
-            if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
-                generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowInput workflowInput = (WorkflowInput) result;
-                        WorkflowInputAppCatalogResourceAppCat workflowInputResource =
-                                (WorkflowInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
-                        wfInputResources.add(workflowInputResource);
-                    }
-                }
-            } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
-                generator.setParameter(WFInputConstants.INPUT_KEY, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowInput workflowInput = (WorkflowInput) result;
-                        WorkflowInputAppCatalogResourceAppCat workflowInputResource =
-                                (WorkflowInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
-                        wfInputResources.add(workflowInputResource);
-                    }
-                }
-            } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
-                generator.setParameter(WFInputConstants.DATA_TYPE, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowInput workflowInput = (WorkflowInput) result;
-                        WorkflowInputAppCatalogResourceAppCat workflowInputResource =
-                                (WorkflowInputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
-                        wfInputResources.add(workflowInputResource);
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for WFInput Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for WFInput Resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return wfInputResources;
-    }
-
-    public List<AppCatalogResource> getAll() throws AppCatalogException {
-        return null;
-    }
-
-    public List<String> getAllIds() throws AppCatalogException {
-        return null;
-    }
-
-    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-        List<String> wfInputResourceIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
-            List results;
-            if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
-                generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowInput workflowInput = (WorkflowInput) result;
-                        wfInputResourceIDs.add(workflowInput.getWfTemplateId());
-                    }
-                }
-            } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
-                generator.setParameter(WFInputConstants.INPUT_KEY, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowInput workflowInput = (WorkflowInput) result;
-                        wfInputResourceIDs.add(workflowInput.getWfTemplateId());
-                    }
-                }
-            } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
-                generator.setParameter(WFInputConstants.DATA_TYPE, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowInput workflowInput = (WorkflowInput) result;
-                        wfInputResourceIDs.add(workflowInput.getWfTemplateId());
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for WFInput resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for WFInput Resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return wfInputResourceIDs;
-    }
-
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            WorkflowInput existingWFInput = em.find(WorkflowInput.class, new WorkflowInput_PK(wfTemplateId, inputKey));
-            em.close();
-            WorkflowInput workflowInput;
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            if (existingWFInput == null) {
-                workflowInput = new WorkflowInput();
-            } else {
-            	workflowInput=existingWFInput;
-            }
-            workflowInput.setWfTemplateId(wfTemplateId);
-            Workflow workflow = em.find(Workflow.class, wfTemplateId);
-            workflowInput.setWorkflow(workflow);
-            workflowInput.setDataType(dataType);
-            workflowInput.setInputKey(inputKey);
-            if (inputVal != null){
-                workflowInput.setInputVal(inputVal.toCharArray());
-            }
-            workflowInput.setMetadata(metadata);
-            workflowInput.setAppArgument(appArgument);
-            workflowInput.setUserFriendlyDesc(userFriendlyDesc);
-            workflowInput.setStandardInput(standardInput);
-            workflowInput.setRequiredToCMD(requiredToCMD);
-            workflowInput.setRequired(isRequired);
-            workflowInput.setDataStaged(dataStaged);
-            if (existingWFInput == null) {
-                em.persist(workflowInput);
-            } else {
-                em.merge(workflowInput);
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public boolean isExists(Object identifier) throws AppCatalogException {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map) {
-            ids = (HashMap<String, String>) identifier;
-        } else {
-            logger.error("Identifier should be a map with the field name and it's value");
-            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-        }
-
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            WorkflowInput workflowInput = em.find(WorkflowInput.class, new WorkflowInput_PK(
-                    ids.get(WFInputConstants.WF_TEMPLATE_ID),
-                    ids.get(WFInputConstants.INPUT_KEY)));
-
-            em.close();
-            return workflowInput != null;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public String getWfTemplateId() {
-        return wfTemplateId;
-    }
-
-    public void setWfTemplateId(String wfTemplateId) {
-        this.wfTemplateId = wfTemplateId;
-    }
-
-    public String getInputKey() {
-        return inputKey;
-    }
-
-    public void setInputKey(String inputKey) {
-        this.inputKey = inputKey;
-    }
-
-    public String getDataType() {
-        return dataType;
-    }
-
-    public void setDataType(String dataType) {
-        this.dataType = dataType;
-    }
-
-    public String getInputVal() {
-        return inputVal;
-    }
-
-    public void setInputVal(String inputVal) {
-        this.inputVal = inputVal;
-    }
-
-    public String getMetadata() {
-        return metadata;
-    }
-
-    public void setMetadata(String metadata) {
-        this.metadata = metadata;
-    }
-
-    public String getAppArgument() {
-        return appArgument;
-    }
-
-    public void setAppArgument(String appArgument) {
-        this.appArgument = appArgument;
-    }
-
-    public String getUserFriendlyDesc() {
-        return userFriendlyDesc;
-    }
-
-    public void setUserFriendlyDesc(String userFriendlyDesc) {
-        this.userFriendlyDesc = userFriendlyDesc;
-    }
-
-    public WorkflowAppCatalogResourceAppCat getWorkflowResource() {
-        return workflowResource;
-    }
-
-    public void setWorkflowResource(WorkflowAppCatalogResourceAppCat workflowResource) {
-        this.workflowResource = workflowResource;
-    }
-
-    public boolean isStandardInput() {
-        return standardInput;
-    }
-
-    public void setStandardInput(boolean standardInput) {
-        this.standardInput = standardInput;
-    }
-
-    public int getInputOrder() {
-        return inputOrder;
-    }
-
-    public void setInputOrder(int inputOrder) {
-        this.inputOrder = inputOrder;
-    }
-
-    public boolean getRequired() {
-        return isRequired;
-    }
-
-    public void setRequired(boolean required) {
-        this.isRequired = required;
-    }
-
-    public boolean getRequiredToCMD() {
-        return requiredToCMD;
-    }
-
-    public void setRequiredToCMD(boolean requiredToCMD) {
-        this.requiredToCMD = requiredToCMD;
-    }
-
-    public boolean isDataStaged() {
-        return dataStaged;
-    }
-
-    public void setDataStaged(boolean dataStaged) {
-        this.dataStaged = dataStaged;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
new file mode 100644
index 0000000..913d996
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
@@ -0,0 +1,451 @@
+/**
+ * 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.registry.core.app.catalog.resources;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.registry.core.app.catalog.model.Workflow;
+import org.apache.airavata.registry.core.app.catalog.model.WorkflowInput;
+import org.apache.airavata.registry.core.app.catalog.model.WorkflowInput_PK;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class WorkflowInputResource extends AppCatAbstractResource {
+
+    private final static Logger logger = LoggerFactory.getLogger(WorkflowInputResource.class);
+
+    private String wfTemplateId;
+    private String inputKey;
+    private String dataType;
+    private String inputVal;
+    private String metadata;
+    private String appArgument;
+    private String userFriendlyDesc;
+    private boolean standardInput;
+    private int inputOrder;
+    private boolean isRequired;
+    private boolean requiredToCMD;
+    private boolean dataStaged;
+
+    private WorkflowResource workflowResource;
+
+    public void remove(Object identifier) throws AppCatalogException {
+        HashMap<String, String> ids;
+        if (identifier instanceof Map) {
+            ids = (HashMap) identifier;
+        } else {
+            logger.error("Identifier should be a map with the field name and it's value");
+            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+        }
+
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
+            generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
+            generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
+            Query q = generator.deleteQuery(em);
+            q.executeUpdate();
+            em.getTransaction().commit();
+            em.close();
+        } catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    public AppCatalogResource get(Object identifier) throws AppCatalogException {
+        HashMap<String, String> ids;
+        if (identifier instanceof Map) {
+            ids = (HashMap<String, String>) identifier;
+        } else {
+            logger.error("Identifier should be a map with the field name and it's value");
+            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+        }
+
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
+            generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
+            generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
+            Query q = generator.selectQuery(em);
+            WorkflowInput workflowInput = (WorkflowInput) q.getSingleResult();
+            WorkflowInputResource workflowInputResource =
+                    (WorkflowInputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_INPUT
+                            , workflowInput);
+            em.getTransaction().commit();
+            em.close();
+            return workflowInputResource;
+        } catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+        List<AppCatalogResource> wfInputResources = new ArrayList<AppCatalogResource>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            Query q;
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
+            List results;
+            if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
+                generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        WorkflowInput workflowInput = (WorkflowInput) result;
+                        WorkflowInputResource workflowInputResource =
+                                (WorkflowInputResource) AppCatalogJPAUtils.getResource(
+                                        AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+                        wfInputResources.add(workflowInputResource);
+                    }
+                }
+            } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
+                generator.setParameter(WFInputConstants.INPUT_KEY, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        WorkflowInput workflowInput = (WorkflowInput) result;
+                        WorkflowInputResource workflowInputResource =
+                                (WorkflowInputResource) AppCatalogJPAUtils.getResource(
+                                        AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+                        wfInputResources.add(workflowInputResource);
+                    }
+                }
+            } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
+                generator.setParameter(WFInputConstants.DATA_TYPE, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        WorkflowInput workflowInput = (WorkflowInput) result;
+                        WorkflowInputResource workflowInputResource =
+                                (WorkflowInputResource) AppCatalogJPAUtils.getResource(
+                                        AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
+                        wfInputResources.add(workflowInputResource);
+                    }
+                }
+            } else {
+                em.getTransaction().commit();
+                em.close();
+                logger.error("Unsupported field name for WFInput Resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported field name for WFInput Resource.");
+            }
+            em.getTransaction().commit();
+            em.close();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return wfInputResources;
+    }
+
+    public List<AppCatalogResource> getAll() throws AppCatalogException {
+        return null;
+    }
+
+    public List<String> getAllIds() throws AppCatalogException {
+        return null;
+    }
+
+    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+        List<String> wfInputResourceIDs = new ArrayList<String>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            Query q;
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
+            List results;
+            if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
+                generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        WorkflowInput workflowInput = (WorkflowInput) result;
+                        wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+                    }
+                }
+            } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
+                generator.setParameter(WFInputConstants.INPUT_KEY, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        WorkflowInput workflowInput = (WorkflowInput) result;
+                        wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+                    }
+                }
+            } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
+                generator.setParameter(WFInputConstants.DATA_TYPE, value);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        WorkflowInput workflowInput = (WorkflowInput) result;
+                        wfInputResourceIDs.add(workflowInput.getWfTemplateId());
+                    }
+                }
+            } else {
+                em.getTransaction().commit();
+                em.close();
+                logger.error("Unsupported field name for WFInput resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported field name for WFInput Resource.");
+            }
+            em.getTransaction().commit();
+            em.close();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return wfInputResourceIDs;
+    }
+
+    public void save() throws AppCatalogException {
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            WorkflowInput existingWFInput = em.find(WorkflowInput.class, new WorkflowInput_PK(wfTemplateId, inputKey));
+            em.close();
+            WorkflowInput workflowInput;
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            if (existingWFInput == null) {
+                workflowInput = new WorkflowInput();
+            } else {
+            	workflowInput=existingWFInput;
+            }
+            workflowInput.setWfTemplateId(wfTemplateId);
+            Workflow workflow = em.find(Workflow.class, wfTemplateId);
+            workflowInput.setWorkflow(workflow);
+            workflowInput.setDataType(dataType);
+            workflowInput.setInputKey(inputKey);
+            if (inputVal != null){
+                workflowInput.setInputVal(inputVal.toCharArray());
+            }
+            workflowInput.setMetadata(metadata);
+            workflowInput.setAppArgument(appArgument);
+            workflowInput.setUserFriendlyDesc(userFriendlyDesc);
+            workflowInput.setStandardInput(standardInput);
+            workflowInput.setRequiredToCMD(requiredToCMD);
+            workflowInput.setRequired(isRequired);
+            workflowInput.setDataStaged(dataStaged);
+            if (existingWFInput == null) {
+                em.persist(workflowInput);
+            } else {
+                em.merge(workflowInput);
+            }
+            em.getTransaction().commit();
+            em.close();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    public boolean isExists(Object identifier) throws AppCatalogException {
+        HashMap<String, String> ids;
+        if (identifier instanceof Map) {
+            ids = (HashMap<String, String>) identifier;
+        } else {
+            logger.error("Identifier should be a map with the field name and it's value");
+            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+        }
+
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            WorkflowInput workflowInput = em.find(WorkflowInput.class, new WorkflowInput_PK(
+                    ids.get(WFInputConstants.WF_TEMPLATE_ID),
+                    ids.get(WFInputConstants.INPUT_KEY)));
+
+            em.close();
+            return workflowInput != null;
+        } catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    public String getWfTemplateId() {
+        return wfTemplateId;
+    }
+
+    public void setWfTemplateId(String wfTemplateId) {
+        this.wfTemplateId = wfTemplateId;
+    }
+
+    public String getInputKey() {
+        return inputKey;
+    }
+
+    public void setInputKey(String inputKey) {
+        this.inputKey = inputKey;
+    }
+
+    public String getDataType() {
+        return dataType;
+    }
+
+    public void setDataType(String dataType) {
+        this.dataType = dataType;
+    }
+
+    public String getInputVal() {
+        return inputVal;
+    }
+
+    public void setInputVal(String inputVal) {
+        this.inputVal = inputVal;
+    }
+
+    public String getMetadata() {
+        return metadata;
+    }
+
+    public void setMetadata(String metadata) {
+        this.metadata = metadata;
+    }
+
+    public String getAppArgument() {
+        return appArgument;
+    }
+
+    public void setAppArgument(String appArgument) {
+        this.appArgument = appArgument;
+    }
+
+    public String getUserFriendlyDesc() {
+        return userFriendlyDesc;
+    }
+
+    public void setUserFriendlyDesc(String userFriendlyDesc) {
+        this.userFriendlyDesc = userFriendlyDesc;
+    }
+
+    public WorkflowResource getWorkflowResource() {
+        return workflowResource;
+    }
+
+    public void setWorkflowResource(WorkflowResource workflowResource) {
+        this.workflowResource = workflowResource;
+    }
+
+    public boolean isStandardInput() {
+        return standardInput;
+    }
+
+    public void setStandardInput(boolean standardInput) {
+        this.standardInput = standardInput;
+    }
+
+    public int getInputOrder() {
+        return inputOrder;
+    }
+
+    public void setInputOrder(int inputOrder) {
+        this.inputOrder = inputOrder;
+    }
+
+    public boolean getRequired() {
+        return isRequired;
+    }
+
+    public void setRequired(boolean required) {
+        this.isRequired = required;
+    }
+
+    public boolean getRequiredToCMD() {
+        return requiredToCMD;
+    }
+
+    public void setRequiredToCMD(boolean requiredToCMD) {
+        this.requiredToCMD = requiredToCMD;
+    }
+
+    public boolean isDataStaged() {
+        return dataStaged;
+    }
+
+    public void setDataStaged(boolean dataStaged) {
+        this.dataStaged = dataStaged;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputAppCatalogResourceAppCat.java
deleted file mode 100644
index 75f5f7e..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputAppCatalogResourceAppCat.java
+++ /dev/null
@@ -1,410 +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.registry.core.app.catalog.resources;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.registry.core.app.catalog.model.Workflow;
-import org.apache.airavata.registry.core.app.catalog.model.WorkflowOutput;
-import org.apache.airavata.registry.core.app.catalog.model.WorkflowOutput_PK;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator;
-import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType;
-import org.apache.airavata.registry.cpi.AppCatalogException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class WorkflowOutputAppCatalogResourceAppCat extends AppCatAbstractResource {
-    private final static Logger logger = LoggerFactory.getLogger(WorkflowOutputAppCatalogResourceAppCat.class);
-
-    private String wfTemplateId;
-    private String outputKey;
-    private String outputVal;
-    private String dataType;
-    private String validityType;
-    private boolean dataMovement;
-    private String dataNameLocation;
-
-    private WorkflowAppCatalogResourceAppCat workflowResource;
-
-    public void remove(Object identifier) throws AppCatalogException {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map) {
-            ids = (HashMap) identifier;
-        } else {
-            logger.error("Identifier should be a map with the field name and it's value");
-            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-        }
-
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
-            generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
-            generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
-            Query q = generator.deleteQuery(em);
-            q.executeUpdate();
-            em.getTransaction().commit();
-            em.close();
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public AppCatalogResource get(Object identifier) throws AppCatalogException {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map) {
-            ids = (HashMap) identifier;
-        } else {
-            logger.error("Identifier should be a map with the field name and it's value");
-            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-        }
-
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
-            generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
-            generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
-            Query q = generator.selectQuery(em);
-            WorkflowOutput wfOutput = (WorkflowOutput) q.getSingleResult();
-            WorkflowOutputAppCatalogResourceAppCat workflowOutputResource =
-                    (WorkflowOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_OUTPUT
-                            , wfOutput);
-            em.getTransaction().commit();
-            em.close();
-            return workflowOutputResource;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
-        List<AppCatalogResource> wfOutputResources = new ArrayList<AppCatalogResource>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
-            List results;
-            if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
-                generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowOutput wfOutput = (WorkflowOutput) result;
-                        WorkflowOutputAppCatalogResourceAppCat workflowOutputResource =
-                                (WorkflowOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.WORKFLOW_OUTPUT, wfOutput);
-                        wfOutputResources.add(workflowOutputResource);
-                    }
-                }
-            } else if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
-                generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowOutput workflowOutput = (WorkflowOutput) result;
-                        WorkflowOutputAppCatalogResourceAppCat workflowOutputResource =
-                                (WorkflowOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
-                        wfOutputResources.add(workflowOutputResource);
-                    }
-                }
-            } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
-                generator.setParameter(WFOutputConstants.DATA_TYPE, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowOutput workflowOutput = (WorkflowOutput) result;
-                        WorkflowOutputAppCatalogResourceAppCat workflowOutputResource =
-                                (WorkflowOutputAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(
-                                        AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
-                        wfOutputResources.add(workflowOutputResource);
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for WF Output Resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for WF Output Resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return wfOutputResources;
-    }
-
-    public List<AppCatalogResource> getAll() throws AppCatalogException {
-        return null;
-    }
-
-    public List<String> getAllIds() throws AppCatalogException {
-        return null;
-    }
-
-    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-        List<String> wfOutputResourceIDs = new ArrayList<String>();
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            Query q;
-            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
-            List results;
-            if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
-                generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowOutput workflowOutput = (WorkflowOutput) result;
-                        wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
-                    }
-                }
-            }
-            if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
-                generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowOutput workflowOutput = (WorkflowOutput) result;
-                        wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
-                    }
-                }
-            } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
-                generator.setParameter(WFOutputConstants.DATA_TYPE, value);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        WorkflowOutput workflowOutput = (WorkflowOutput) result;
-                        wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
-                    }
-                }
-            } else {
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported field name for WF Output resource.", new IllegalArgumentException());
-                throw new IllegalArgumentException("Unsupported field name for WF Output Resource.");
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-        return wfOutputResourceIDs;
-    }
-
-    public void save() throws AppCatalogException {
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            WorkflowOutput existingWorkflowOutput = em.find(WorkflowOutput.class,
-                    new WorkflowOutput_PK(wfTemplateId, outputKey));
-            em.close();
-
-            em = AppCatalogJPAUtils.getEntityManager();
-            em.getTransaction().begin();
-            if (existingWorkflowOutput != null) {
-                existingWorkflowOutput.setWfTemplateId(wfTemplateId);
-                Workflow workflow = em.find(Workflow.class, wfTemplateId);
-                existingWorkflowOutput.setWorkflow(workflow);
-                existingWorkflowOutput.setDataType(dataType);
-                existingWorkflowOutput.setOutputKey(outputKey);
-                if (outputVal != null){
-                    existingWorkflowOutput.setOutputVal(outputVal.toCharArray());
-                }
-                existingWorkflowOutput.setValidityType(validityType);
-                existingWorkflowOutput.setDataMovement(dataMovement);
-                existingWorkflowOutput.setDataNameLocation(dataNameLocation);
-                em.merge(existingWorkflowOutput);
-            } else {
-                WorkflowOutput workflowOutput = new WorkflowOutput();
-                workflowOutput.setWfTemplateId(wfTemplateId);
-                Workflow workflow = em.find(Workflow.class, wfTemplateId);
-                workflowOutput.setWorkflow(workflow);
-                workflowOutput.setDataType(dataType);
-                workflowOutput.setOutputKey(outputKey);
-                if (outputVal != null){
-                    workflowOutput.setOutputVal(outputVal.toCharArray());
-                }
-                workflowOutput.setValidityType(validityType);
-                workflowOutput.setDataMovement(dataMovement);
-                workflowOutput.setDataNameLocation(dataNameLocation);
-                em.persist(workflowOutput);
-            }
-            em.getTransaction().commit();
-            em.close();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public boolean isExists(Object identifier) throws AppCatalogException {
-        HashMap<String, String> ids;
-        if (identifier instanceof Map) {
-            ids = (HashMap) identifier;
-        } else {
-            logger.error("Identifier should be a map with the field name and it's value");
-            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-        }
-
-        EntityManager em = null;
-        try {
-            em = AppCatalogJPAUtils.getEntityManager();
-            WorkflowOutput workflowOutput = em.find(WorkflowOutput.class, new WorkflowOutput_PK(
-                    ids.get(WFOutputConstants.WF_TEMPLATE_ID),
-                    ids.get(WFOutputConstants.OUTPUT_KEY)));
-
-            em.close();
-            return workflowOutput != null;
-        } catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-            throw new AppCatalogException(e);
-        } finally {
-            if (em != null && em.isOpen()) {
-                if (em.getTransaction().isActive()) {
-                    em.getTransaction().rollback();
-                }
-                em.close();
-            }
-        }
-    }
-
-    public String getWfTemplateId() {
-        return wfTemplateId;
-    }
-
-    public void setWfTemplateId(String wfTemplateId) {
-        this.wfTemplateId = wfTemplateId;
-    }
-
-    public String getOutputKey() {
-        return outputKey;
-    }
-
-    public void setOutputKey(String outputKey) {
-        this.outputKey = outputKey;
-    }
-
-    public String getOutputVal() {
-        return outputVal;
-    }
-
-    public void setOutputVal(String outputVal) {
-        this.outputVal = outputVal;
-    }
-
-    public String getDataType() {
-        return dataType;
-    }
-
-    public void setDataType(String dataType) {
-        this.dataType = dataType;
-    }
-
-    public WorkflowAppCatalogResourceAppCat getWorkflowResource() {
-        return workflowResource;
-    }
-
-    public void setWorkflowResource(WorkflowAppCatalogResourceAppCat workflowResource) {
-        this.workflowResource = workflowResource;
-    }
-
-    public String getValidityType() {
-        return validityType;
-    }
-
-    public void setValidityType(String validityType) {
-        this.validityType = validityType;
-    }
-
-    public boolean isDataMovement() {
-        return dataMovement;
-    }
-
-    public void setDataMovement(boolean dataMovement) {
-        this.dataMovement = dataMovement;
-    }
-
-    public String getDataNameLocation() {
-        return dataNameLocation;
-    }
-
-    public void setDataNameLocation(String dataNameLocation) {
-        this.dataNameLocation = dataNameLocation;
-    }
-}