*/
public Resource get(ResourceType type, Object name) {
Resource result = null;
EntityManager em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
QueryGenerator generator;
Query q;
switch (type) {
case PROJECT:
generator = new QueryGenerator(PROJECT);
generator.setParameter(ProjectConstants.PROJECT_NAME, name);
q = generator.selectQuery(em);
Project project = (Project) q.getSingleResult();
result= Utils.getResource(ResourceType.PROJECT, project);
break;
case USER_WORKFLOW:
generator = new QueryGenerator(USER_WORKFLOW);
generator.setParameter(UserWorkflowConstants.OWNER, getUser());
generator.setParameter(UserWorkflowConstants.TEMPLATE_NAME, name);
generator.setParameter(UserWorkflowConstants.GATEWAY_NAME, gateway.getGatewayName());
q = generator.selectQuery(em);
User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
result= Utils.getResource(ResourceType.USER_WORKFLOW, userWorkflow);
break;
case EXPERIMENT:
generator = new QueryGenerator(EXPERIMENT);
generator.setParameter(ExperimentConstants.USERNAME, getUser());
generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
q = generator.selectQuery(em);
Experiment experiment = (Experiment) q.getSingleResult();
result= Utils.getResource(ResourceType.EXPERIMENT, experiment);
break;
case WORKFLOW_DATA:
generator = new QueryGenerator(WORKFLOW_DATA);
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);
result= workflowDataResource;
break;
default: