airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [4/6] Adding data models for execution - AIRAVATA-994 - Integration test failures can occur
Date Tue, 04 Feb 2014 19:52:19 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/10b41d86/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
index d2371a6..caf4310 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
@@ -1,355 +1,358 @@
-/*
- *
- * 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.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ExperimentDataResource extends AbstractResource{
-
-    private final static Logger logger = LoggerFactory.getLogger(ExperimentDataResource.class);
-    private String experimentID;
-    private String expName;
-    private String userName;
-
-    public String getExperimentID() {
-        return experimentID;
-    }
-
-    public String getExpName() {
-        return expName;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setExperimentID(String experimentID) {
-        this.experimentID = experimentID;
-    }
-
-    public void setExpName(String expName) {
-        this.expName = expName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public Resource create(ResourceType type) {
-        switch (type){
-            case WORKFLOW_DATA:
-                WorkflowDataResource workflowDataResource = new WorkflowDataResource();
-                workflowDataResource.setExperimentID(experimentID);
-                return workflowDataResource;
-            case EXECUTION_ERROR:
-				ExecutionErrorResource executionErrorResource = new ExecutionErrorResource();
-				executionErrorResource.setExperimentDataResource(this);
-				return executionErrorResource;
-            case EXPERIMENT_METADATA:
-                ExperimentMetadataResource experimentMetadataResource = new ExperimentMetadataResource();
-                experimentMetadataResource.setExpID(experimentID);
-                return experimentMetadataResource;
-            case GFAC_JOB_DATA:
-                GFacJobDataResource gFacJobDataResource = new GFacJobDataResource();
-                gFacJobDataResource.setExperimentDataResource(this);
-                return gFacJobDataResource;
-            default:
-                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
-                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
-        }
-
-    }
-
-    public void remove(ResourceType type, Object name) {
-        EntityManager em = ResourceUtils.getEntityManager();
-        em.getTransaction().begin();
-        Query q;
-        QueryGenerator generator;
-        switch (type){
-            case WORKFLOW_DATA:
-                generator = new QueryGenerator(WORKFLOW_DATA);
-//                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
-                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
-                q = generator.deleteQuery(em);
-                q.executeUpdate();
-                break;
-            case EXPERIMENT_METADATA:
-                generator = new QueryGenerator(EXPERIMENT_METADATA);
-                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, name);
-                q = generator.deleteQuery(em);
-                q.executeUpdate();
-                break;
-            case GFAC_JOB_DATA:
-                generator = new QueryGenerator(GFAC_JOB_DATA);
-                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
-                q = generator.deleteQuery(em);
-                q.executeUpdate();
-                break;
-            default:
-                break;
-        }
-        em.getTransaction().commit();
-        em.close();
-    }
-
-    public Resource get(ResourceType type, Object name) {
-        EntityManager em = ResourceUtils.getEntityManager();
-        em.getTransaction().begin();
-        QueryGenerator generator;
-        Query q;
-        switch (type) {
-            case WORKFLOW_DATA:
-                generator = new QueryGenerator(WORKFLOW_DATA);
-//                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
-                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
-                q = generator.selectQuery(em);
-                Workflow_Data eworkflowData = (Workflow_Data)q.getSingleResult();
-                WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, eworkflowData);
-                em.getTransaction().commit();
-                em.close();
-                return workflowDataResource;
-            case EXPERIMENT_METADATA:
-                generator = new QueryGenerator(EXPERIMENT_METADATA);
-                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, name);
-                q = generator.selectQuery(em);
-                Experiment_Metadata expMetadata = (Experiment_Metadata)q.getSingleResult();
-                ExperimentMetadataResource experimentMetadataResource = (ExperimentMetadataResource)Utils.getResource(ResourceType.EXPERIMENT_METADATA, expMetadata);
-                em.getTransaction().commit();
-                em.close();
-                return experimentMetadataResource;
-            case GFAC_JOB_DATA:
-                generator = new QueryGenerator(GFAC_JOB_DATA);
-                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
-                q = generator.selectQuery(em);
-                GFac_Job_Data gFacJobData = (GFac_Job_Data)q.getSingleResult();
-                GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
-                em.getTransaction().commit();
-                em.close();
-                return gFacJobDataResource;
-            default:
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
-                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
-        }
-    }
-
-    public List<Resource> get(ResourceType type) {
-        List<Resource> resourceList = new ArrayList<Resource>();
-        EntityManager em = ResourceUtils.getEntityManager();
-        em.getTransaction().begin();
-        Query q;
-        QueryGenerator generator;
-        List<?> results;
-        switch (type){
-            case WORKFLOW_DATA:
-                generator = new QueryGenerator(WORKFLOW_DATA);
-//                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
-                Experiment_Data experiment_data = em.find(Experiment_Data.class, experimentID);
-                generator.setParameter("experiment_data", experiment_data);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        Workflow_Data workflowData = (Workflow_Data) result;
-                        WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, workflowData);
-                        resourceList.add(workflowDataResource);
-                    }
-                }
-                break;
-            case EXPERIMENT_METADATA:
-                generator = new QueryGenerator(EXPERIMENT_METADATA);
-                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, experimentID);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        Experiment_Metadata expMetadata = (Experiment_Metadata) result;
-                        ExperimentMetadataResource experimentMetadataResource = (ExperimentMetadataResource)Utils.getResource(ResourceType.EXPERIMENT_METADATA, expMetadata);
-                        resourceList.add(experimentMetadataResource);
-                    }
-                }
-                break;
-            case EXECUTION_ERROR:
-                generator = new QueryGenerator(EXECUTION_ERROR);
-                generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, experimentID);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        Execution_Error executionError = (Execution_Error)result;
-                        ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
-                        resourceList.add(executionErrorResource);
-                    }
-                }
-                break;
-            case GFAC_JOB_DATA:
-                generator = new QueryGenerator(GFAC_JOB_DATA);
-                generator.setParameter(GFacJobDataConstants.EXPERIMENT_ID, experimentID);
-                q = generator.selectQuery(em);
-                results = q.getResultList();
-                if (results.size() != 0) {
-                    for (Object result : results) {
-                        GFac_Job_Data gFacJobData = (GFac_Job_Data)result;
-                        GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
-                        resourceList.add(gFacJobDataResource);
-                    }
-                }
-                break;
-            default:
-                em.getTransaction().commit();
-                em.close();
-                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
-                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
-        }
-        em.getTransaction().commit();
-        em.close();
-        return resourceList;
-    }
-
-    public void save() {
-        EntityManager em = ResourceUtils.getEntityManager();
-        Experiment_Data existingExpData = em.find(Experiment_Data.class, experimentID);
-        em.close();
-
-        em = ResourceUtils.getEntityManager();
-        em.getTransaction().begin();
-        Experiment_Data experimentData = new Experiment_Data();
-        experimentData.setExperiment_ID(experimentID);
-        experimentData.setName(expName);
-        experimentData.setUsername(userName);
-        if(existingExpData != null){
-            existingExpData.setName(expName);
-            existingExpData.setUsername(userName);
-            experimentData = em.merge(existingExpData);
-        } else{
-            em.persist(experimentData);
-        }
-        em.getTransaction().commit();
-        em.close();
-
-    }
-    
-    public boolean isWorkflowInstancePresent(String workflowInstanceId){
-		return isExists(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-    }
-    
-    public boolean isGFacJobPresent(String jobId){
-		return isExists(ResourceType.GFAC_JOB_DATA, jobId);
-    }
-    
-    public boolean isExperimentMetadataPresent(){
-		return isExists(ResourceType.EXPERIMENT_METADATA, getExperimentID());
-    }
-    
-    public WorkflowDataResource getWorkflowInstance(String workflowInstanceId){
-    	return (WorkflowDataResource)get(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-    }
-    
-    public List<Resource> getGFacJobs(){
-    	return get(ResourceType.GFAC_JOB_DATA);
-    }
-    
-    public ExperimentMetadataResource getExperimentMetadata(){
-    	return (ExperimentMetadataResource)get(ResourceType.EXPERIMENT_METADATA,getExperimentID());
-    }
-    
-    public List<WorkflowDataResource> getWorkflowInstances(){
-    	return getResourceList(get(ResourceType.WORKFLOW_DATA),WorkflowDataResource.class);
-    }
-    
-    public WorkflowDataResource createWorkflowInstanceResource(String workflowInstanceID){
-    	WorkflowDataResource r=(WorkflowDataResource)create(ResourceType.WORKFLOW_DATA);
-    	r.setWorkflowInstanceID(workflowInstanceID);
-    	return r;
-    }
-    
-    public GFacJobDataResource createGFacJob(String jobID){
-    	GFacJobDataResource r=(GFacJobDataResource)create(ResourceType.GFAC_JOB_DATA);
-    	r.setLocalJobID(jobID);
-    	return r;
-    }
-    
-    public ExperimentMetadataResource createExperimentMetadata(){
-    	return (ExperimentMetadataResource)create(ResourceType.EXPERIMENT_METADATA);
-    }
-    
-    public ExecutionErrorResource createExecutionError(){
-    	return (ExecutionErrorResource) create(ResourceType.EXECUTION_ERROR);
-    }
-    
-    public void removeWorkflowInstance(String workflowInstanceId){
-    	remove(ResourceType.WORKFLOW_DATA, workflowInstanceId);
-    }
-    
-    public void removeExperimentMetadata(){
-    	remove(ResourceType.EXPERIMENT_METADATA,getExperimentID());
-    }
-    
-    public List<ExecutionErrorResource> getExecutionErrors(String type, String experimentId, String workflowInstanceId, String nodeId, String gfacJobId){
-    	List<ExecutionErrorResource> resourceList = new ArrayList<ExecutionErrorResource>();
-        EntityManager em = ResourceUtils.getEntityManager();
-        em.getTransaction().begin();
-        Query q;
-        QueryGenerator generator;
-        List<?> results;
-    	generator = new QueryGenerator(EXECUTION_ERROR);
-        if (experimentId!=null){
-            generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, experimentId);
-        }
-        if (type!=null){
-            generator.setParameter(ExecutionErrorConstants.SOURCE_TYPE, type);
-        }
-        if (workflowInstanceId!=null){
-        	generator.setParameter(ExecutionErrorConstants.WORKFLOW_ID, workflowInstanceId);	
-        }
-        if (nodeId!=null){
-        	generator.setParameter(ExecutionErrorConstants.NODE_ID, nodeId);	
-        }
-        if (gfacJobId!=null){
-        	generator.setParameter(ExecutionErrorConstants.GFAC_JOB_ID, gfacJobId);	
-        }
-        q = generator.selectQuery(em);
-        results = q.getResultList();
-        if (results.size() != 0) {
-            for (Object result : results) {
-                Execution_Error executionError = (Execution_Error)result;
-                ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
-                resourceList.add(executionErrorResource);
-            }
-        }
-        em.getTransaction().commit();
-        em.close();
-        return resourceList;
-    }
-}
+///*
+// *
+// * 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.*;
+//import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//import javax.persistence.EntityManager;
+//import javax.persistence.Query;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * @deprecated
+// */
+//public class ExperimentDataResource extends AbstractResource{
+//
+//    private final static Logger logger = LoggerFactory.getLogger(ExperimentDataResource.class);
+//    private String experimentID;
+//    private String expName;
+//    private String userName;
+//
+//    public String getExperimentID() {
+//        return experimentID;
+//    }
+//
+//    public String getExpName() {
+//        return expName;
+//    }
+//
+//    public String getUserName() {
+//        return userName;
+//    }
+//
+//    public void setExperimentID(String experimentID) {
+//        this.experimentID = experimentID;
+//    }
+//
+//    public void setExpName(String expName) {
+//        this.expName = expName;
+//    }
+//
+//    public void setUserName(String userName) {
+//        this.userName = userName;
+//    }
+//
+//    public Resource create(ResourceType type) {
+//        switch (type){
+//            case WORKFLOW_DATA:
+//                WorkflowDataResource workflowDataResource = new WorkflowDataResource();
+//                workflowDataResource.setExperimentID(experimentID);
+//                return workflowDataResource;
+//            case EXECUTION_ERROR:
+//				ExecutionErrorResource executionErrorResource = new ExecutionErrorResource();
+//				executionErrorResource.setMetadataResource(this);
+//				return executionErrorResource;
+//            case EXPERIMENT_METADATA:
+//                ExperimentMetadataResource experimentMetadataResource = new ExperimentMetadataResource();
+//                experimentMetadataResource.setExpID(experimentID);
+//                return experimentMetadataResource;
+//            case GFAC_JOB_DATA:
+//                GFacJobDataResource gFacJobDataResource = new GFacJobDataResource();
+//                gFacJobDataResource.setMetadataResource(this);
+//                return gFacJobDataResource;
+//            default:
+//                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
+//                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
+//        }
+//
+//    }
+//
+//    public void remove(ResourceType type, Object name) {
+//        EntityManager em = ResourceUtils.getEntityManager();
+//        em.getTransaction().begin();
+//        Query q;
+//        QueryGenerator generator;
+//        switch (type){
+//            case WORKFLOW_DATA:
+//                generator = new QueryGenerator(WORKFLOW_DATA);
+////                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+//                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
+//                q = generator.deleteQuery(em);
+//                q.executeUpdate();
+//                break;
+//            case EXPERIMENT_METADATA:
+//                generator = new QueryGenerator(EXPERIMENT_METADATA);
+//                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, name);
+//                q = generator.deleteQuery(em);
+//                q.executeUpdate();
+//                break;
+//            case GFAC_JOB_DATA:
+//                generator = new QueryGenerator(GFAC_JOB_DATA);
+//                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
+//                q = generator.deleteQuery(em);
+//                q.executeUpdate();
+//                break;
+//            default:
+//                break;
+//        }
+//        em.getTransaction().commit();
+//        em.close();
+//    }
+//
+//    public Resource get(ResourceType type, Object name) {
+//        EntityManager em = ResourceUtils.getEntityManager();
+//        em.getTransaction().begin();
+//        QueryGenerator generator;
+//        Query q;
+//        switch (type) {
+//            case WORKFLOW_DATA:
+//                generator = new QueryGenerator(WORKFLOW_DATA);
+////                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+//                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
+//                q = generator.selectQuery(em);
+//                Workflow_Data eworkflowData = (Workflow_Data)q.getSingleResult();
+//                WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, eworkflowData);
+//                em.getTransaction().commit();
+//                em.close();
+//                return workflowDataResource;
+//            case EXPERIMENT_METADATA:
+//                generator = new QueryGenerator(EXPERIMENT_METADATA);
+//                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, name);
+//                q = generator.selectQuery(em);
+//                Experiment_Metadata expMetadata = (Experiment_Metadata)q.getSingleResult();
+//                ExperimentMetadataResource experimentMetadataResource = (ExperimentMetadataResource)Utils.getResource(ResourceType.EXPERIMENT_METADATA, expMetadata);
+//                em.getTransaction().commit();
+//                em.close();
+//                return experimentMetadataResource;
+//            case GFAC_JOB_DATA:
+//                generator = new QueryGenerator(GFAC_JOB_DATA);
+//                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
+//                q = generator.selectQuery(em);
+//                GFac_Job_Data gFacJobData = (GFac_Job_Data)q.getSingleResult();
+//                GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
+//                em.getTransaction().commit();
+//                em.close();
+//                return gFacJobDataResource;
+//            default:
+//                em.getTransaction().commit();
+//                em.close();
+//                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
+//                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
+//        }
+//    }
+//
+//    public List<Resource> get(ResourceType type) {
+//        List<Resource> resourceList = new ArrayList<Resource>();
+//        EntityManager em = ResourceUtils.getEntityManager();
+//        em.getTransaction().begin();
+//        Query q;
+//        QueryGenerator generator;
+//        List<?> results;
+//        switch (type){
+//            case WORKFLOW_DATA:
+//                generator = new QueryGenerator(WORKFLOW_DATA);
+////                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+//                Experiment_Data experiment_data = em.find(Experiment_Data.class, experimentID);
+//                generator.setParameter("experiment_data", experiment_data);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        Workflow_Data workflowData = (Workflow_Data) result;
+//                        WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, workflowData);
+//                        resourceList.add(workflowDataResource);
+//                    }
+//                }
+//                break;
+//            case EXPERIMENT_METADATA:
+//                generator = new QueryGenerator(EXPERIMENT_METADATA);
+//                generator.setParameter(ExperimentDataConstants.EXPERIMENT_ID, experimentID);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        Experiment_Metadata expMetadata = (Experiment_Metadata) result;
+//                        ExperimentMetadataResource experimentMetadataResource = (ExperimentMetadataResource)Utils.getResource(ResourceType.EXPERIMENT_METADATA, expMetadata);
+//                        resourceList.add(experimentMetadataResource);
+//                    }
+//                }
+//                break;
+//            case EXECUTION_ERROR:
+//                generator = new QueryGenerator(EXECUTION_ERROR);
+//                generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, experimentID);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        Execution_Error executionError = (Execution_Error)result;
+//                        ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
+//                        resourceList.add(executionErrorResource);
+//                    }
+//                }
+//                break;
+//            case GFAC_JOB_DATA:
+//                generator = new QueryGenerator(GFAC_JOB_DATA);
+//                generator.setParameter(GFacJobDataConstants.EXPERIMENT_ID, experimentID);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        GFac_Job_Data gFacJobData = (GFac_Job_Data)result;
+//                        GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
+//                        resourceList.add(gFacJobDataResource);
+//                    }
+//                }
+//                break;
+//            default:
+//                em.getTransaction().commit();
+//                em.close();
+//                logger.error("Unsupported resource type for experiment data resource... ", new UnsupportedOperationException());
+//                throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
+//        }
+//        em.getTransaction().commit();
+//        em.close();
+//        return resourceList;
+//    }
+//
+//    public void save() {
+//        EntityManager em = ResourceUtils.getEntityManager();
+//        Experiment_Data existingExpData = em.find(Experiment_Data.class, experimentID);
+//        em.close();
+//
+//        em = ResourceUtils.getEntityManager();
+//        em.getTransaction().begin();
+//        Experiment_Data experimentData = new Experiment_Data();
+//        experimentData.setExperiment_ID(experimentID);
+//        experimentData.setName(expName);
+//        experimentData.setUsername(userName);
+//        if(existingExpData != null){
+//            existingExpData.setName(expName);
+//            existingExpData.setUsername(userName);
+//            experimentData = em.merge(existingExpData);
+//        } else{
+//            em.persist(experimentData);
+//        }
+//        em.getTransaction().commit();
+//        em.close();
+//
+//    }
+//
+//    public boolean isWorkflowInstancePresent(String workflowInstanceId){
+//		return isExists(ResourceType.WORKFLOW_DATA, workflowInstanceId);
+//    }
+//
+//    public boolean isGFacJobPresent(String jobId){
+//		return isExists(ResourceType.GFAC_JOB_DATA, jobId);
+//    }
+//
+//    public boolean isExperimentMetadataPresent(){
+//		return isExists(ResourceType.EXPERIMENT_METADATA, getExperimentID());
+//    }
+//
+//    public WorkflowDataResource getWorkflowInstance(String workflowInstanceId){
+//    	return (WorkflowDataResource)get(ResourceType.WORKFLOW_DATA, workflowInstanceId);
+//    }
+//
+//    public List<Resource> getGFacJobs(){
+//    	return get(ResourceType.GFAC_JOB_DATA);
+//    }
+//
+//    public ExperimentMetadataResource getExperimentMetadata(){
+//    	return (ExperimentMetadataResource)get(ResourceType.EXPERIMENT_METADATA,getExperimentID());
+//    }
+//
+//    public List<WorkflowDataResource> getWorkflowInstances(){
+//    	return getResourceList(get(ResourceType.WORKFLOW_DATA),WorkflowDataResource.class);
+//    }
+//
+//    public WorkflowDataResource createWorkflowInstanceResource(String workflowInstanceID){
+//    	WorkflowDataResource r=(WorkflowDataResource)create(ResourceType.WORKFLOW_DATA);
+//    	r.setWorkflowInstanceID(workflowInstanceID);
+//    	return r;
+//    }
+//
+//    public GFacJobDataResource createGFacJob(String jobID){
+//    	GFacJobDataResource r=(GFacJobDataResource)create(ResourceType.GFAC_JOB_DATA);
+//    	r.setLocalJobID(jobID);
+//    	return r;
+//    }
+//
+//    public ExperimentMetadataResource createExperimentMetadata(){
+//    	return (ExperimentMetadataResource)create(ResourceType.EXPERIMENT_METADATA);
+//    }
+//
+//    public ExecutionErrorResource createExecutionError(){
+//    	return (ExecutionErrorResource) create(ResourceType.EXECUTION_ERROR);
+//    }
+//
+//    public void removeWorkflowInstance(String workflowInstanceId){
+//    	remove(ResourceType.WORKFLOW_DATA, workflowInstanceId);
+//    }
+//
+//    public void removeExperimentMetadata(){
+//    	remove(ResourceType.EXPERIMENT_METADATA,getExperimentID());
+//    }
+//
+//    public List<ExecutionErrorResource> getExecutionErrors(String type, String experimentId, String workflowInstanceId, String nodeId, String gfacJobId){
+//    	List<ExecutionErrorResource> resourceList = new ArrayList<ExecutionErrorResource>();
+//        EntityManager em = ResourceUtils.getEntityManager();
+//        em.getTransaction().begin();
+//        Query q;
+//        QueryGenerator generator;
+//        List<?> results;
+//    	generator = new QueryGenerator(EXECUTION_ERROR);
+//        if (experimentId!=null){
+//            generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, experimentId);
+//        }
+//        if (type!=null){
+//            generator.setParameter(ExecutionErrorConstants.SOURCE_TYPE, type);
+//        }
+//        if (workflowInstanceId!=null){
+//        	generator.setParameter(ExecutionErrorConstants.WORKFLOW_ID, workflowInstanceId);
+//        }
+//        if (nodeId!=null){
+//        	generator.setParameter(ExecutionErrorConstants.NODE_ID, nodeId);
+//        }
+//        if (gfacJobId!=null){
+//        	generator.setParameter(ExecutionErrorConstants.GFAC_JOB_ID, gfacJobId);
+//        }
+//        q = generator.selectQuery(em);
+//        results = q.getResultList();
+//        if (results.size() != 0) {
+//            for (Object result : results) {
+//                Execution_Error executionError = (Execution_Error)result;
+//                ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
+//                resourceList.add(executionErrorResource);
+//            }
+//        }
+//        em.getTransaction().commit();
+//        em.close();
+//        return resourceList;
+//    }
+//}

http://git-wip-us.apache.org/repos/asf/airavata/blob/10b41d86/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataRetriever.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataRetriever.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataRetriever.java
index cbcd7df..477b1c2 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataRetriever.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataRetriever.java
@@ -51,21 +51,17 @@ public class ExperimentDataRetriever {
             Class.forName(Utils.getJDBCDriver()).newInstance();
             connection = DriverManager.getConnection(connectionURL, Utils.getJDBCUser(), Utils.getJDBCPassword());
             statement = connection.createStatement();
-            String queryString = "SELECT e.experiment_ID, ed.name, ed.username, em.metadata, " +
-                    "wd.workflow_instanceID, wd.template_name, wd.status, wd.start_time," +
-                    "wd.last_update_time, nd.node_id, nd.inputs, nd.outputs, " +
-                    "e.project_name, e.submitted_date, nd.node_type, nd.status," +
-                    "nd.start_time, nd.last_update_time " +
-                    "FROM Experiment e " +
-                    "LEFT JOIN Experiment_Data ed " +
-                    "ON e.experiment_ID = ed.experiment_ID " +
-                    "LEFT JOIN Experiment_Metadata em " +
-                    "ON ed.experiment_ID = em.experiment_ID  " +
-                    "LEFT JOIN Workflow_Data wd " +
-                    "ON e.experiment_ID = wd.experiment_ID " +
-                    "LEFT JOIN Node_Data nd " +
-                    "ON wd.workflow_instanceID = nd.workflow_instanceID " +
-                    "WHERE e.experiment_ID ='" + experimentId + "'";
+            String queryString = "SELECT e.EXPERIMENT_ID, e.EXPERIMENT_NAME, e.EXECUTION_USER, e.DESCRIPTION, " +
+                    "wd.WORKFLOW_INSTANCE_ID, wd.TEMPLATE_NAME, wd.STATUS, wd.START_TIME," +
+                    "wd.LAST_UPDATE_TIME, nd.NODE_ID, nd.INPUTS, nd.OUTPUTS, " +
+                    "e.PROJECT_NAME, e.SUBMITTED_DATE, nd.NODE_TYPE, nd.STATUS," +
+                    "nd.START_TIME, nd.LAST_UPDATE_TIME " +
+                    "FROM EXPERIMENT_METADATA e " +
+                    "LEFT JOIN WORKFLOW_DATA wd " +
+                    "ON e.EXPERIMENT_ID = wd.EXPERIMENT_ID " +
+                    "LEFT JOIN NODE_DATA nd " +
+                    "ON wd.WORKFLOW_INSTANCE_ID = nd.WORKFLOW_INSTANCE_ID " +
+                    "WHERE e.EXPERIMENT_ID ='" + experimentId + "'";
 
 
             rs = statement.executeQuery(queryString);
@@ -76,7 +72,7 @@ public class ExperimentDataRetriever {
                         experimentData.setExperimentId(rs.getString(1));
                         experimentData.setExperimentName(rs.getString(2));
                         experimentData.setUser(rs.getString(3));
-                        experimentData.setMetadata(rs.getString(4));
+//                        experimentData.setMetadata(rs.getString(4));
                         experimentData.setTopic(rs.getString(1));
                     }
                     fillWorkflowInstanceData(experimentData, rs, experimentWorkflowInstances);
@@ -98,7 +94,7 @@ public class ExperimentDataRetriever {
         }catch (ParseException e) {
             logger.error(e.getMessage(), e);
         } catch (ExperimentLazyLoadedException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            logger.error(e.getMessage());
         }
         return experimentData;
     }
@@ -181,10 +177,8 @@ public class ExperimentDataRetriever {
             statement = connection.createStatement();
 
             // FIXME : pass user ID as a regular expression
-            String queryString = "SELECT ed.experiment_ID FROM Experiment_Data ed " +
-                    "LEFT JOIN Experiment e " +
-                    "ON ed.experiment_ID = e.experiment_ID " +
-                    "WHERE ed.username ='" + user + "'";
+            String queryString = "SELECT e.EXPERIMENT_ID FROM EXPERIMENT_METADATA e " +
+                    "WHERE e.EXECUTION_USER ='" + user + "'";
             rs = statement.executeQuery(queryString);
             if(rs != null){
                 while (rs.next()) {
@@ -219,10 +213,8 @@ public class ExperimentDataRetriever {
             Class.forName(Utils.getJDBCDriver()).newInstance();
             connection = DriverManager.getConnection(connectionURL, Utils.getJDBCUser(), Utils.getJDBCPassword());
             statement =  connection.createStatement();
-            String queryString = "SELECT ed.name FROM Experiment e " +
-                    "LEFT JOIN Experiment_Data ed " +
-                    "ON e.experiment_ID = ed.experiment_ID " +
-                    "WHERE e.experiment_ID='" + experimentId + "'";
+            String queryString = "SELECT e.name FROM EXPERIMENT_METADATA e " +
+                    "WHERE e.EXPERIMENT_ID='" + experimentId + "'";
             rs = statement.executeQuery(queryString);
             if(rs != null){
                 while (rs.next()) {
@@ -261,20 +253,17 @@ public class ExperimentDataRetriever {
             connection = DriverManager.getConnection(connectionURL, Utils.getJDBCUser(),
                     Utils.getJDBCPassword());
             statement = connection.createStatement();
-            String queryString = "SELECT e.experiment_ID, ed.name, ed.username, em.metadata, " +
-                    "wd.workflow_instanceID, wd.template_name, wd.status, wd.start_time," +
-                    "wd.last_update_time, nd.node_id, nd.inputs, nd.outputs, " +
-                    "e.project_name, e.submitted_date, nd.node_type, nd.status," +
-                    "nd.start_time, nd.last_update_time" +
-                    " FROM Experiment e INNER JOIN Experiment_Data ed " +
-                    "ON e.experiment_ID = ed.experiment_ID " +
-                    "LEFT JOIN Experiment_Metadata em " +
-                    "ON ed.experiment_ID = em.experiment_ID  " +
-                    "LEFT JOIN Workflow_Data wd " +
-                    "ON e.experiment_ID = wd.experiment_ID " +
-                    "LEFT JOIN Node_Data nd " +
-                    "ON wd.workflow_instanceID = nd.workflow_instanceID " +
-                    "WHERE ed.username='" + user + "'";
+            String queryString = "SELECT e.EXPERIMENT_ID, e.EXPERIMENT_NAME, e.EXECUTION_USER, e.DESCRIPTION, " +
+                    "wd.WORKFLOW_INSTANCE_ID, wd.TEMPLATE_NAME, wd.STATUS, wd.START_TIME," +
+                    "wd.LAST_UPDATE_TIME, nd.NODE_ID, nd.INPUTS, nd.OUTPUTS, " +
+                    "e.PROJECT_NAME, e.SUBMITTED_DATE, nd.NODE_TYPE, nd.STATUS, " +
+                    "nd.START_TIME, nd.LAST_UPDATE_TIME " +
+                    "FROM EXPERIMENT_METADATA e " +
+                    "LEFT JOIN WORKFLOW_DATA wd " +
+                    "ON e.EXPERIMENT_ID = wd.EXPERIMENT_ID " +
+                    "LEFT JOIN NODE_DATA nd " +
+                    "ON wd.WORKFLOW_INSTANCE_ID = nd.WORKFLOW_INSTANCE_ID " +
+                    "WHERE e.EXECUTION_USER='" + user + "'";
 
             rs = statement.executeQuery(queryString);
             if (rs != null) {
@@ -287,7 +276,7 @@ public class ExperimentDataRetriever {
                         experimentData.setExperimentId(rs.getString(1));
                         experimentData.setExperimentName(rs.getString(2));
                         experimentData.setUser(rs.getString(3));
-                        experimentData.setMetadata(rs.getString(4));
+//                        experimentData.setMetadata(rs.getString(4));
                         experimentData.setTopic(rs.getString(1));
                         experimentDataMap.put(experimentData.getExperimentId(),experimentData);
                         experimentDataList.add(experimentData);
@@ -331,19 +320,16 @@ public class ExperimentDataRetriever {
             connection = DriverManager.getConnection(connectionURL, Utils.getJDBCUser(),
                     Utils.getJDBCPassword());
             statement = connection.createStatement();
-            String queryString = "SELECT e.experiment_ID, ed.name, ed.username, em.metadata, " +
-                    "wd.workflow_instanceID, wd.template_name, wd.status, wd.start_time," +
-                    "wd.last_update_time, nd.node_id, nd.inputs, nd.outputs, " +
-                    "e.project_name, e.submitted_date, nd.node_type, nd.status," +
-                    "nd.start_time, nd.last_update_time" +
-                    " FROM Experiment e INNER JOIN Experiment_Data ed " +
-                    "ON e.experiment_ID = ed.experiment_ID " +
-                    "LEFT JOIN Experiment_Metadata em " +
-                    "ON ed.experiment_ID = em.experiment_ID  " +
-                    "LEFT JOIN Workflow_Data wd " +
-                    "ON e.experiment_ID = wd.experiment_ID " +
-                    "LEFT JOIN Node_Data nd " +
-                    "ON wd.workflow_instanceID = nd.workflow_instanceID ";
+            String queryString = "SELECT e.EXPERIMENT_ID, e.EXPERIMENT_NAME, e.EXECUTION_USER, e.DESCRIPTION, " +
+                    "wd.WORKFLOW_INSTANCE_ID, wd.TEMPLATE_NAME, wd.STATUS, wd.START_TIME," +
+                    "wd.LAST_UPDATE_TIME, nd.NODE_ID, nd.INPUTS, nd.OUTPUTS, " +
+                    "e.PROJECT_NAME, e.SUBMITTED_DATE, nd.NODE_TYPE, nd.STATUS, " +
+                    "nd.START_TIME, nd.LAST_UPDATE_TIME " +
+                    "FROM EXPERIMENT_METADATA e " +
+                    "LEFT JOIN WORKFLOW_DATA wd " +
+                    "ON e.EXPERIMENT_ID = wd.EXPERIMENT_ID " +
+                    "LEFT JOIN NODE_DATA nd " +
+                    "ON wd.WORKFLOW_INSTANCE_ID = nd.WORKFLOW_INSTANCE_ID ";
             
             DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             if(params.keySet().size()>0) {
@@ -362,7 +348,7 @@ public class ExperimentDataRetriever {
             		Date fromDate = dateFormat.parse(from);
             		Timestamp fromTime = new Timestamp(fromDate.getTime());
             		queryString += "e.submitted_date>='" + fromTime + "'";
-            		if(to!=null && to!="") {
+            		if(to!=null && !to.equals("")) {
             			queryString += " AND ";
             		}
             	}
@@ -383,7 +369,7 @@ public class ExperimentDataRetriever {
                         experimentData.setExperimentId(rs.getString(1));
                         experimentData.setExperimentName(rs.getString(2));
                         experimentData.setUser(rs.getString(3));
-                        experimentData.setMetadata(rs.getString(4));
+//                        experimentData.setMetadata(rs.getString(4));
                         experimentData.setTopic(rs.getString(1));
                         experimentDataMap.put(experimentData.getExperimentId(),experimentData);
                         experimentDataList.add(experimentData);
@@ -424,14 +410,12 @@ public class ExperimentDataRetriever {
             Class.forName(Utils.getJDBCDriver()).newInstance();
             connection = DriverManager.getConnection(connectionURL, Utils.getJDBCUser(), Utils.getJDBCPassword());
             statement = connection.createStatement();
-            String queryString = "SELECT e.experiment_ID, ed.name, ed.username, em.metadata, " +
-                    "e.project_name, e.submitted_date " +
-                    "FROM Experiment e " +
-                    "LEFT JOIN Experiment_Data ed " +
-                    "ON e.experiment_ID = ed.experiment_ID " +
-                    "LEFT JOIN Experiment_Metadata em " +
-                    "ON ed.experiment_ID = em.experiment_ID  " +
-                    "WHERE e.experiment_ID ='" + experimentId + "'";
+            String queryString = "SELECT e.EXPERIMENT_ID, e.EXPERIMENT_NAME, e.EXECUTION_USER, " +
+                    "e.PROJECT_NAME, e.SUBMITTED_DATE, wd.WORKFLOW_INSTANCE_ID " +
+                    "FROM EXPERIMENT_METADATA e " +
+                    "LEFT JOIN WORKFLOW_DATA wd " +
+                    "ON e.EXPERIMENT_ID = wd.EXPERIMENT_ID " +
+                    "WHERE e.EXPERIMENT_ID ='" + experimentId + "'";
 
             rs = statement.executeQuery(queryString);
             if (rs != null){
@@ -440,13 +424,13 @@ public class ExperimentDataRetriever {
                     experimentData.setExperimentId(rs.getString(1));
                     experimentData.setExperimentName(rs.getString(2));
                     experimentData.setUser(rs.getString(3));
-                    experimentData.setMetadata(rs.getString(4));
+//                    experimentData.setMetadata(rs.getString(4));
                     experimentData.setTopic(rs.getString(1));
 
-                    WorkflowExecution workflowInstance = new WorkflowExecution(experimentId, rs.getString(5));
+                    WorkflowExecution workflowInstance = new WorkflowExecution(experimentId, rs.getString(6));
                     workflowInstance.setTemplateName(rs.getString(6));
                     workflowInstance.setExperimentId(rs.getString(1));
-                    workflowInstance.setWorkflowExecutionId(rs.getString(5));
+                    workflowInstance.setWorkflowExecutionId(rs.getString(6));
                     experimentWorkflowInstances.add(workflowInstance);
                 }
             }
@@ -476,7 +460,7 @@ public class ExperimentDataRetriever {
             Class.forName(Utils.getJDBCDriver()).newInstance();
             connection = DriverManager.getConnection(connectionURL, Utils.getJDBCUser(), Utils.getJDBCPassword());
             statement = connection.createStatement();
-            String queryString = "SELECT name FROM Experiment_Data WHERE name='" + experimentName + "'";
+            String queryString = "SELECT EXPERIMENT_NAME FROM EXPERIMENT_METADATA WHERE EXPERIMENT_NAME='" + experimentName + "'";
             rs = statement.executeQuery(queryString);
             if(rs != null){
                 while (rs.next()) {
@@ -514,15 +498,11 @@ public class ExperimentDataRetriever {
             connection = DriverManager.getConnection(connectionURL, Utils.getJDBCUser(), Utils.getJDBCPassword());
             statement = connection.createStatement();
             //FIXME : pass user ID as a regular expression
-            String queryString = "SELECT e.experiment_ID, ed.name, ed.username, em.metadata, " +
-                    "e.project_name, e.submitted_date " +
-                    "FROM Experiment e " +
-                    "LEFT JOIN Experiment_Data ed " +
-                    "ON e.experiment_ID = ed.experiment_ID " +
-                    "LEFT JOIN Experiment_Metadata em " +
-                    "ON ed.experiment_ID = em.experiment_ID  " +
-                    "WHERE ed.username ='" + user + "'" +
-                    " ORDER BY e.submitted_date ASC";
+            String queryString = "SELECT e.EXPERIMENT_ID, e.EXPERIMENT_NAME, e.EXECUTION_USER,  " +
+                    "e.PROJECT_NAME, e.SUBMITTED_DATE " +
+                    "FROM EXPERIMENT_METADATA e " +
+                    "WHERE e.EXECUTION_USER ='" + user + "'" +
+                    " ORDER BY e.SUBMITTED_DATE ASC";
 
             rs = statement.executeQuery(queryString);
             if (rs != null){
@@ -531,7 +511,7 @@ public class ExperimentDataRetriever {
                     experimentData.setExperimentId(rs.getString(1));
                     experimentData.setExperimentName(rs.getString(2));
                     experimentData.setUser(rs.getString(3));
-                    experimentData.setMetadata(rs.getString(4));
+//                    experimentData.setMetadata(rs.getString(4));
                     experimentData.setTopic(rs.getString(1));
 
                     WorkflowExecution workflowInstance = new WorkflowExecution(rs.getString(1), rs.getString(5));

http://git-wip-us.apache.org/repos/asf/airavata/blob/10b41d86/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
new file mode 100644
index 0000000..15f3569
--- /dev/null
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
@@ -0,0 +1,111 @@
+/*
+ *
+ * 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.Experiment_Input;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Input_PK;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class ExperimentInputResource extends AbstractResource {
+    private static final Logger logger = LoggerFactory.getLogger(ExperimentInputResource.class);
+
+    private ExperimentMetadataResource experimentMetadataResource;
+    private String experimentKey;
+    private String value;
+
+    public ExperimentMetadataResource getExperimentMetadataResource() {
+        return experimentMetadataResource;
+    }
+
+    public void setExperimentMetadataResource(ExperimentMetadataResource experimentMetadataResource) {
+        this.experimentMetadataResource = experimentMetadataResource;
+    }
+
+    public String getExperimentKey() {
+        return experimentKey;
+    }
+
+    public void setExperimentKey(String experimentKey) {
+        this.experimentKey = experimentKey;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public Resource create(ResourceType type) {
+        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public void remove(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public List<Resource> get(ResourceType type) {
+        logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentMetadataResource.getExpID(), experimentKey));
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Experiment_Input exInput = new Experiment_Input();
+        exInput.setEx_key(experimentKey);
+        Experiment_Metadata metadata = em.find(Experiment_Metadata.class, experimentMetadataResource.getExpID());
+        exInput.setExperiment_metadata(metadata);
+        exInput.setValue(value);
+
+        if (existingInput != null){
+            existingInput.setEx_key(experimentKey);
+            existingInput.setExperiment_metadata(metadata);
+            existingInput.setValue(value);
+            exInput = em.merge(existingInput);
+        }else {
+            em.persist(exInput);
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/10b41d86/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
index 66c0559..b313c15 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentMetadataResource.java
@@ -24,60 +24,343 @@ 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.Experiment_Metadata;
+import org.apache.airavata.persistance.registry.jpa.model.*;
+import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
 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 ExperimentMetadataResource extends AbstractResource {
     private static final Logger logger = LoggerFactory.getLogger(ExperimentMetadataResource.class);
     private String expID;
-    private String metadata;
+    private String experimentName;
+    private String description;
+    private Timestamp submittedDate;
+    private String executionUser;
+    private GatewayResource gateway;
+    private ProjectResource project;
+    private boolean shareExp;
 
-    public String getExpID() {
-        return expID;
+    public static Logger getLogger() {
+        return logger;
     }
 
-    public String getMetadata() {
-        return metadata;
+    public String getExpID() {
+        return expID;
     }
 
     public void setExpID(String expID) {
         this.expID = expID;
     }
 
-    public void setMetadata(String metadata) {
-        this.metadata = metadata;
+    public String getExperimentName() {
+        return experimentName;
+    }
+
+    public void setExperimentName(String experimentName) {
+        this.experimentName = experimentName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Timestamp getSubmittedDate() {
+        return submittedDate;
+    }
+
+    public void setSubmittedDate(Timestamp submittedDate) {
+        this.submittedDate = submittedDate;
+    }
+
+    public String getExecutionUser() {
+        return executionUser;
+    }
+
+    public void setExecutionUser(String executionUser) {
+        this.executionUser = executionUser;
+    }
+
+    public GatewayResource getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(GatewayResource gateway) {
+        this.gateway = gateway;
+    }
+
+    public ProjectResource getProject() {
+        return project;
+    }
+
+    public void setProject(ProjectResource project) {
+        this.project = project;
+    }
+
+    public boolean isShareExp() {
+        return shareExp;
+    }
+
+    public void setShareExp(boolean shareExp) {
+        this.shareExp = shareExp;
     }
 
     public Resource create(ResourceType type) {
-        logger.error("Unsupported operation for experiment metadata resource "
-                + "since there are no child resources generated by experiment metadata resource.. ",
-                new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
+        switch (type) {
+            case EXPERIMENT_CONFIG_DATA:
+                ExperimentConfigDataResource configDataResource = new ExperimentConfigDataResource();
+                configDataResource.setExMetadata(this);
+                return configDataResource;
+            case EXPERIMENT_SUMMARY:
+                ExperimentSummaryResource summaryResource = new ExperimentSummaryResource();
+                summaryResource.setExperimentMetadataResource(this);
+                return summaryResource;
+            case EXPERIMENT_INPUT:
+                ExperimentInputResource exInputResource = new ExperimentInputResource();
+                exInputResource.setExperimentMetadataResource(this);
+                return exInputResource;
+            case EXPERIMENT_OUTPUT:
+                ExperimentOutputResource exOutputResouce = new ExperimentOutputResource();
+                exOutputResouce.setExperimentMetadataResource(this);
+                return exOutputResouce;
+            case WORKFLOW_DATA:
+                WorkflowDataResource workflowDataResource = new WorkflowDataResource();
+                workflowDataResource.setExperimentID(expID);
+                return workflowDataResource;
+            case EXECUTION_ERROR:
+                ExecutionErrorResource executionErrorResource = new ExecutionErrorResource();
+                executionErrorResource.setMetadataResource(this);
+                return executionErrorResource;
+            case GFAC_JOB_DATA:
+                GFacJobDataResource gFacJobDataResource = new GFacJobDataResource();
+                gFacJobDataResource.setMetadataResource(this);
+                return gFacJobDataResource;
+            default:
+                logger.error("Unsupported resource type for experiment metadata resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
+            }
     }
 
     public void remove(ResourceType type, Object name) {
-        logger.error("Unsupported operation for experiment metadata resource "
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Query q;
+        QueryGenerator generator;
+        switch (type){
+            case EXPERIMENT_CONFIG_DATA:
+                generator = new QueryGenerator(EXPERIMENT_CONFIG_DATA);
+                generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            case EXPERIMENT_SUMMARY:
+                generator = new QueryGenerator(EXPERIMENT_SUMMARY);
+                generator.setParameter(ExperimentSummaryConstants.EXPERIMENT_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            case EXPERIMENT_INPUT:
+                generator = new QueryGenerator(EXPERIMENT_INPUT);
+                generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            case EXPERIMENT_OUTPUT:
+                generator = new QueryGenerator(EXPERIMENT_OUTPUT);
+                generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            case WORKFLOW_DATA:
+                generator = new QueryGenerator(WORKFLOW_DATA);
+                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            case GFAC_JOB_DATA:
+                generator = new QueryGenerator(GFAC_JOB_DATA);
+                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
+            default:
+                logger.error("Unsupported operation for experiment metadata resource "
                 + "since there are no child resources generated by experiment metadata resource.. ",
                 new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
+                throw new UnsupportedOperationException();
+        }
+        em.getTransaction().commit();
+        em.close();
     }
 
     public Resource get(ResourceType type, Object name) {
-        logger.error("Unsupported operation for experiment metadata resource "
-                + "since there are no child resources generated by experiment metadata resource.. ",
-                new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        QueryGenerator generator;
+        Query q;
+        switch (type) {
+            case EXPERIMENT_CONFIG_DATA:
+                generator = new QueryGenerator(EXPERIMENT_CONFIG_DATA);
+                generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
+                q = generator.selectQuery(em);
+                Experiment_Configuration_Data exConfigData = (Experiment_Configuration_Data) q.getSingleResult();
+                ExperimentConfigDataResource experimentConfigDataResource =
+                        (ExperimentConfigDataResource)Utils.getResource(ResourceType.EXPERIMENT_CONFIG_DATA, exConfigData);
+                em.getTransaction().commit();
+                em.close();
+                return experimentConfigDataResource;
+            case EXPERIMENT_SUMMARY:
+                generator = new QueryGenerator(EXPERIMENT_SUMMARY);
+                generator.setParameter(ExperimentSummaryConstants.EXPERIMENT_ID, name);
+                q = generator.selectQuery(em);
+                Experiment_Summary exSummaryData = (Experiment_Summary) q.getSingleResult();
+                ExperimentSummaryResource exSummary =
+                        (ExperimentSummaryResource)Utils.getResource(ResourceType.EXPERIMENT_SUMMARY, exSummaryData);
+                em.getTransaction().commit();
+                em.close();
+                return exSummary;
+            case EXPERIMENT_INPUT:
+                generator = new QueryGenerator(EXPERIMENT_INPUT);
+                generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
+                q = generator.selectQuery(em);
+                Experiment_Input exInput = (Experiment_Input) q.getSingleResult();
+                ExperimentInputResource experimentInput =
+                        (ExperimentInputResource)Utils.getResource(ResourceType.EXPERIMENT_INPUT, exInput);
+                em.getTransaction().commit();
+                em.close();
+                return experimentInput;
+            case EXPERIMENT_OUTPUT:
+                generator = new QueryGenerator(EXPERIMENT_OUTPUT);
+                generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
+                q = generator.selectQuery(em);
+                Experiment_Output exOutput = (Experiment_Output) q.getSingleResult();
+                ExperimentOutputResource experimentOutput =
+                        (ExperimentOutputResource)Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, exOutput);
+                em.getTransaction().commit();
+                em.close();
+                return experimentOutput;
+            case WORKFLOW_DATA:
+                generator = new QueryGenerator(WORKFLOW_DATA);
+//                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+                generator.setParameter(WorkflowDataConstants.WORKFLOW_INSTANCE_ID, name);
+                q = generator.selectQuery(em);
+                Workflow_Data eworkflowData = (Workflow_Data)q.getSingleResult();
+                WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, eworkflowData);
+                em.getTransaction().commit();
+                em.close();
+                return workflowDataResource;
+            case GFAC_JOB_DATA:
+                generator = new QueryGenerator(GFAC_JOB_DATA);
+                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
+                q = generator.selectQuery(em);
+                GFac_Job_Data gFacJobData = (GFac_Job_Data)q.getSingleResult();
+                GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
+                em.getTransaction().commit();
+                em.close();
+                return gFacJobDataResource;
+            default:
+                logger.error("Unsupported operation for experiment metadata resource "
+                        + "since there are no child resources generated by experiment metadata resource.. ",
+                        new UnsupportedOperationException());
+                throw new UnsupportedOperationException();
+        }
     }
 
     public List<Resource> get(ResourceType type) {
-        logger.error("Unsupported operation for experiment metadata resource "
-                + "since there are no child resources generated by experiment metadata resource.. ",
-                new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
+        List<Resource> resourceList = new ArrayList<Resource>();
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Query q;
+        QueryGenerator generator;
+        List results;
+        switch (type){
+            case EXPERIMENT_INPUT:
+                generator = new QueryGenerator(EXPERIMENT_INPUT);
+                generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, expID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Experiment_Input expInput = (Experiment_Input) result;
+                        ExperimentInputResource experimentResource =
+                                (ExperimentInputResource)Utils.getResource(ResourceType.EXPERIMENT_INPUT, expInput);
+                        resourceList.add(experimentResource);
+                    }
+                }
+                break;
+            case EXPERIMENT_OUTPUT:
+                generator = new QueryGenerator(EXPERIMENT_OUTPUT);
+                generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, expID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Experiment_Output expOutput = (Experiment_Output) result;
+                        ExperimentOutputResource experimentResource =
+                                (ExperimentOutputResource)Utils.getResource(ResourceType.EXPERIMENT_INPUT, expOutput);
+                        resourceList.add(experimentResource);
+                    }
+                }
+                break;
+            case WORKFLOW_DATA:
+                generator = new QueryGenerator(WORKFLOW_DATA);
+//                generator.setParameter(WorkflowDataConstants.EXPERIMENT_ID, experimentID);
+                Experiment_Metadata experiment_metadata = em.find(Experiment_Metadata.class, expID);
+                generator.setParameter("experiment_metadata", experiment_metadata);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Workflow_Data workflowData = (Workflow_Data) result;
+                        WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA, workflowData);
+                        resourceList.add(workflowDataResource);
+                    }
+                }
+                break;
+            case EXECUTION_ERROR:
+                generator = new QueryGenerator(EXECUTION_ERROR);
+                generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, expID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Execution_Error executionError = (Execution_Error)result;
+                        ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
+                        resourceList.add(executionErrorResource);
+                    }
+                }
+                break;
+            case GFAC_JOB_DATA:
+                generator = new QueryGenerator(GFAC_JOB_DATA);
+                generator.setParameter(GFacJobDataConstants.EXPERIMENT_ID, expID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        GFac_Job_Data gFacJobData = (GFac_Job_Data)result;
+                        GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData);
+                        resourceList.add(gFacJobDataResource);
+                    }
+                }
+                break;
+            default:
+                logger.error("Unsupported operation for experiment metadata resource "
+                        + "since there are no child resources generated by experiment metadata resource.. ",
+                        new UnsupportedOperationException());
+                throw new UnsupportedOperationException();
+        }
+        em.getTransaction().commit();
+        em.close();
+        return resourceList;
     }
 
     public void save() {
@@ -88,13 +371,25 @@ public class ExperimentMetadataResource extends AbstractResource {
         em = ResourceUtils.getEntityManager();
         em.getTransaction().begin();
         Experiment_Metadata experimentMetadata = new Experiment_Metadata();
-        experimentMetadata.setExperiment_ID(expID);
-        byte[] contentBytes = metadata.getBytes();
-        experimentMetadata.setMetadata(contentBytes);
-
+        experimentMetadata.setExperiment_id(expID);
+        experimentMetadata.setExperiment_name(experimentName);
+        experimentMetadata.setShare_experiment(shareExp);
+        experimentMetadata.setDescription(description);
+        Gateway gatewayModel = em.find(Gateway.class, gateway.getGatewayName());
+        experimentMetadata.setGateway(gatewayModel);
+        Project projectModel = em.find(Project.class, project.getName());
+        experimentMetadata.setProject(projectModel);
+        experimentMetadata.setExecution_user(executionUser);
+        experimentMetadata.setSubmitted_date(submittedDate);
         if (existingExpMetaData != null) {
-            existingExpMetaData.setMetadata(contentBytes);
-            existingExpMetaData.setExperiment_ID(expID);
+            existingExpMetaData.setExperiment_id(expID);
+            existingExpMetaData.setDescription(description);
+            existingExpMetaData.setExperiment_name(experimentName);
+            existingExpMetaData.setGateway(gatewayModel);
+            existingExpMetaData.setExecution_user(executionUser);
+            existingExpMetaData.setProject(projectModel);
+            existingExpMetaData.setShare_experiment(shareExp);
+            existingExpMetaData.setSubmitted_date(submittedDate);
             experimentMetadata = em.merge(existingExpMetaData);
         } else {
             em.persist(experimentMetadata);
@@ -103,4 +398,85 @@ public class ExperimentMetadataResource extends AbstractResource {
         em.close();
 
     }
+
+    public boolean isWorkflowInstancePresent(String workflowInstanceId){
+        return isExists(ResourceType.WORKFLOW_DATA, workflowInstanceId);
+    }
+
+    public boolean isGFacJobPresent(String jobId){
+        return isExists(ResourceType.GFAC_JOB_DATA, jobId);
+    }
+
+    public WorkflowDataResource getWorkflowInstance(String workflowInstanceId){
+        return (WorkflowDataResource)get(ResourceType.WORKFLOW_DATA, workflowInstanceId);
+    }
+
+    public List<Resource> getGFacJobs(){
+        return get(ResourceType.GFAC_JOB_DATA);
+    }
+
+    public List<WorkflowDataResource> getWorkflowInstances(){
+        return getResourceList(get(ResourceType.WORKFLOW_DATA),WorkflowDataResource.class);
+    }
+
+    public WorkflowDataResource createWorkflowInstanceResource(String workflowInstanceID){
+        WorkflowDataResource r=(WorkflowDataResource)create(ResourceType.WORKFLOW_DATA);
+        r.setWorkflowInstanceID(workflowInstanceID);
+        return r;
+    }
+
+    public GFacJobDataResource createGFacJob(String jobID){
+        GFacJobDataResource r=(GFacJobDataResource)create(ResourceType.GFAC_JOB_DATA);
+        r.setLocalJobID(jobID);
+        return r;
+    }
+
+    public ExperimentMetadataResource createExperimentMetadata(){
+        return (ExperimentMetadataResource)create(ResourceType.EXPERIMENT_METADATA);
+    }
+
+    public ExecutionErrorResource createExecutionError(){
+        return (ExecutionErrorResource) create(ResourceType.EXECUTION_ERROR);
+    }
+
+    public void removeWorkflowInstance(String workflowInstanceId){
+        remove(ResourceType.WORKFLOW_DATA, workflowInstanceId);
+    }
+
+    public List<ExecutionErrorResource> getExecutionErrors(String type, String experimentId, String workflowInstanceId, String nodeId, String gfacJobId){
+        List<ExecutionErrorResource> resourceList = new ArrayList<ExecutionErrorResource>();
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Query q;
+        QueryGenerator generator;
+        List<?> results;
+        generator = new QueryGenerator(EXECUTION_ERROR);
+        if (experimentId!=null){
+            generator.setParameter(ExecutionErrorConstants.EXPERIMENT_ID, experimentId);
+        }
+        if (type!=null){
+            generator.setParameter(ExecutionErrorConstants.SOURCE_TYPE, type);
+        }
+        if (workflowInstanceId!=null){
+            generator.setParameter(ExecutionErrorConstants.WORKFLOW_ID, workflowInstanceId);
+        }
+        if (nodeId!=null){
+            generator.setParameter(ExecutionErrorConstants.NODE_ID, nodeId);
+        }
+        if (gfacJobId!=null){
+            generator.setParameter(ExecutionErrorConstants.GFAC_JOB_ID, gfacJobId);
+        }
+        q = generator.selectQuery(em);
+        results = q.getResultList();
+        if (results.size() != 0) {
+            for (Object result : results) {
+                Execution_Error executionError = (Execution_Error)result;
+                ExecutionErrorResource executionErrorResource = (ExecutionErrorResource)Utils.getResource(ResourceType.EXECUTION_ERROR, executionError);
+                resourceList.add(executionErrorResource);
+            }
+        }
+        em.getTransaction().commit();
+        em.close();
+        return resourceList;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/10b41d86/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
new file mode 100644
index 0000000..4d9a23e
--- /dev/null
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
@@ -0,0 +1,111 @@
+/*
+ *
+ * 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.Experiment_Metadata;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Output;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Output_PK;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class ExperimentOutputResource extends AbstractResource {
+    private static final Logger logger = LoggerFactory.getLogger(ExperimentOutputResource.class);
+
+    private ExperimentMetadataResource experimentMetadataResource;
+    private String experimentKey;
+    private String value;
+
+    public ExperimentMetadataResource getExperimentMetadataResource() {
+        return experimentMetadataResource;
+    }
+
+    public void setExperimentMetadataResource(ExperimentMetadataResource experimentMetadataResource) {
+        this.experimentMetadataResource = experimentMetadataResource;
+    }
+
+    public String getExperimentKey() {
+        return experimentKey;
+    }
+
+    public void setExperimentKey(String experimentKey) {
+        this.experimentKey = experimentKey;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public Resource create(ResourceType type) {
+        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public void remove(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public List<Resource> get(ResourceType type) {
+        logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        Experiment_Output existingOutput = em.find(Experiment_Output.class, new Experiment_Output_PK(experimentMetadataResource.getExpID(), experimentKey));
+        em.close();
+
+        em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Experiment_Output exOutput = new Experiment_Output();
+        exOutput.setEx_key(experimentKey);
+        Experiment_Metadata metadata = em.find(Experiment_Metadata.class, experimentMetadataResource.getExpID());
+        exOutput.setExperiment_metadata(metadata);
+        exOutput.setValue(value);
+
+        if (existingOutput != null){
+            existingOutput.setEx_key(experimentKey);
+            existingOutput.setExperiment_metadata(metadata);
+            existingOutput.setValue(value);
+            exOutput = em.merge(existingOutput);
+        }else {
+            em.persist(exOutput);
+        }
+        em.getTransaction().commit();
+        em.close();
+    }
+}


Mime
View raw message