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:25:59 UTC
[09/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/experiment/catalog/resources/DataTransferDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/DataTransferDetailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/DataTransferDetailResource.java
new file mode 100644
index 0000000..c5efb88
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/DataTransferDetailResource.java
@@ -0,0 +1,276 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.model.DataTransferDetail;
+import org.apache.airavata.registry.core.experiment.catalog.model.Status;
+import org.apache.airavata.registry.core.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.utils.StatusType;
+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 DataTransferDetailResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(DataTransferDetailResource.class);
+ private String transferId;
+ private String taskId;
+ private Timestamp creationTime;
+ private String transferDescription;
+ private StatusResource datatransferStatus;
+
+ public StatusResource getDatatransferStatus() {
+ return datatransferStatus;
+ }
+
+ public void setDatatransferStatus(StatusResource datatransferStatus) {
+ this.datatransferStatus = datatransferStatus;
+ }
+
+ public String getTransferId() {
+ return transferId;
+ }
+
+ public void setTransferId(String transferId) {
+ this.transferId = transferId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getTransferDescription() {
+ return transferDescription;
+ }
+
+ public void setTransferDescription(String transferDescription) {
+ this.transferDescription = transferDescription;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public ExperimentCatResource create(ResourceType type) throws RegistryException {
+ switch (type){
+ case STATUS:
+ StatusResource statusResource = new StatusResource();
+ statusResource.setTransferId(transferId);
+ return statusResource;
+ default:
+ logger.error("Unsupported resource type for data transfer details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TRANSFER_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for data transfer details resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TRANSFER_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
+ q = generator.selectQuery(em);
+ Status status = (Status) q.getSingleResult();
+ StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ em.getTransaction().commit();
+ em.close();
+ return statusResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for data transfer details resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for data transfer details resource.");
+ }
+ } catch (Exception e) {
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ List<ExperimentCatResource> resourceList = new ArrayList<ExperimentCatResource>();
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ List results;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TRANSFER_ID, transferId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Status status = (Status) result;
+ StatusResource statusResource =
+ (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ resourceList.add(statusResource);
+ }
+ }
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ DataTransferDetail existingDF = em.find(DataTransferDetail.class, transferId);
+ em.close();
+
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ DataTransferDetail dataTransferDetail = new DataTransferDetail();
+ dataTransferDetail.setTransferId(transferId);
+ dataTransferDetail.setTaskId(taskId);
+ dataTransferDetail.setCreationTime(creationTime);
+ if (transferDescription != null) {
+ dataTransferDetail.setTransferDesc(transferDescription.toCharArray());
+ }
+ if (existingDF != null) {
+ existingDF.setTransferId(transferId);
+ existingDF.setTaskId(taskId);
+ existingDF.setCreationTime(creationTime);
+ if (transferDescription != null) {
+ existingDF.setTransferDesc(transferDescription.toCharArray());
+ }
+ dataTransferDetail = em.merge(existingDF);
+ } else {
+ em.persist(dataTransferDetail);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public StatusResource getDataTransferStatus () throws RegistryException{
+ List<ExperimentCatResource> resources = get(ResourceType.STATUS);
+ for (ExperimentCatResource resource : resources) {
+ StatusResource dataTransferStatus = (StatusResource) resource;
+ if(dataTransferStatus.getStatusType().equals(StatusType.DATA_TRANSFER.toString())){
+ if (dataTransferStatus.getState() == null || dataTransferStatus.getState().equals("") ){
+ dataTransferStatus.setState("UNKNOWN");
+ }
+ return dataTransferStatus;
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailExperimentCatResource.java
deleted file mode 100644
index d96821e..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailExperimentCatResource.java
+++ /dev/null
@@ -1,215 +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.experiment.catalog.resources;
-
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.model.ErrorDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class ErrorDetailExperimentCatResource extends AbstractExperimentCatResource {
- private static final Logger logger = LoggerFactory.getLogger(ErrorDetailExperimentCatResource.class);
- private int errorId;
- private String experimentId;
- private String taskId;
- private String nodeId;
- private Timestamp creationTime;
- private String actualErrorMsg;
- private String userFriendlyErrorMsg;
- private boolean transientPersistent;
- private String errorCategory;
- private String correctiveAction;
- private String actionableGroup;
- private String jobId;
-
- public int getErrorId() {
- return errorId;
- }
-
- public void setErrorId(int errorId) {
- this.errorId = errorId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getActualErrorMsg() {
- return actualErrorMsg;
- }
-
- public void setActualErrorMsg(String actualErrorMsg) {
- this.actualErrorMsg = actualErrorMsg;
- }
-
- public String getUserFriendlyErrorMsg() {
- return userFriendlyErrorMsg;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public void setUserFriendlyErrorMsg(String userFriendlyErrorMsg) {
- this.userFriendlyErrorMsg = userFriendlyErrorMsg;
- }
-
- public boolean isTransientPersistent() {
- return transientPersistent;
- }
-
- public void setTransientPersistent(boolean transientPersistent) {
- this.transientPersistent = transientPersistent;
- }
-
- public String getErrorCategory() {
- return errorCategory;
- }
-
- public void setErrorCategory(String errorCategory) {
- this.errorCategory = errorCategory;
- }
-
- public String getCorrectiveAction() {
- return correctiveAction;
- }
-
- public void setCorrectiveAction(String correctiveAction) {
- this.correctiveAction = correctiveAction;
- }
-
- public String getActionableGroup() {
- return actionableGroup;
- }
-
- public void setActionableGroup(String actionableGroup) {
- this.actionableGroup = actionableGroup;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
-
- public ExperimentCatResource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ErrorDetail errorDetail;
- if (errorId != 0) {
- errorDetail = em.find(ErrorDetail.class, errorId);
- errorDetail.setErrorID(errorId);
- } else {
- errorDetail = new ErrorDetail();
- }
- errorDetail.setErrorID(errorId);
- errorDetail.setExpId(experimentId);
- errorDetail.setTaskId(taskId);
- errorDetail.setNodeId(nodeId);
- errorDetail.setCreationTime(creationTime);
- if (actualErrorMsg != null){
- errorDetail.setActualErrorMsg(actualErrorMsg.toCharArray());
- }
-
- errorDetail.setUserFriendlyErrorMsg(userFriendlyErrorMsg);
- errorDetail.setTransientPersistent(transientPersistent);
- errorDetail.setErrorCategory(errorCategory);
- errorDetail.setCorrectiveAction(correctiveAction);
- errorDetail.setActionableGroup(actionableGroup);
- errorDetail.setJobId(jobId);
- em.persist(errorDetail);
- errorId = errorDetail.getErrorID();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailResource.java
new file mode 100644
index 0000000..ae1907d
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailResource.java
@@ -0,0 +1,215 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.model.ErrorDetail;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.sql.Timestamp;
+import java.util.List;
+
+public class ErrorDetailResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ErrorDetailResource.class);
+ private int errorId;
+ private String experimentId;
+ private String taskId;
+ private String nodeId;
+ private Timestamp creationTime;
+ private String actualErrorMsg;
+ private String userFriendlyErrorMsg;
+ private boolean transientPersistent;
+ private String errorCategory;
+ private String correctiveAction;
+ private String actionableGroup;
+ private String jobId;
+
+ public int getErrorId() {
+ return errorId;
+ }
+
+ public void setErrorId(int errorId) {
+ this.errorId = errorId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getActualErrorMsg() {
+ return actualErrorMsg;
+ }
+
+ public void setActualErrorMsg(String actualErrorMsg) {
+ this.actualErrorMsg = actualErrorMsg;
+ }
+
+ public String getUserFriendlyErrorMsg() {
+ return userFriendlyErrorMsg;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public void setUserFriendlyErrorMsg(String userFriendlyErrorMsg) {
+ this.userFriendlyErrorMsg = userFriendlyErrorMsg;
+ }
+
+ public boolean isTransientPersistent() {
+ return transientPersistent;
+ }
+
+ public void setTransientPersistent(boolean transientPersistent) {
+ this.transientPersistent = transientPersistent;
+ }
+
+ public String getErrorCategory() {
+ return errorCategory;
+ }
+
+ public void setErrorCategory(String errorCategory) {
+ this.errorCategory = errorCategory;
+ }
+
+ public String getCorrectiveAction() {
+ return correctiveAction;
+ }
+
+ public void setCorrectiveAction(String correctiveAction) {
+ this.correctiveAction = correctiveAction;
+ }
+
+ public String getActionableGroup() {
+ return actionableGroup;
+ }
+
+ public void setActionableGroup(String actionableGroup) {
+ this.actionableGroup = actionableGroup;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+
+ public ExperimentCatResource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ErrorDetail errorDetail;
+ if (errorId != 0) {
+ errorDetail = em.find(ErrorDetail.class, errorId);
+ errorDetail.setErrorID(errorId);
+ } else {
+ errorDetail = new ErrorDetail();
+ }
+ errorDetail.setErrorID(errorId);
+ errorDetail.setExpId(experimentId);
+ errorDetail.setTaskId(taskId);
+ errorDetail.setNodeId(nodeId);
+ errorDetail.setCreationTime(creationTime);
+ if (actualErrorMsg != null){
+ errorDetail.setActualErrorMsg(actualErrorMsg.toCharArray());
+ }
+
+ errorDetail.setUserFriendlyErrorMsg(userFriendlyErrorMsg);
+ errorDetail.setTransientPersistent(transientPersistent);
+ errorDetail.setErrorCategory(errorCategory);
+ errorDetail.setCorrectiveAction(correctiveAction);
+ errorDetail.setActionableGroup(actionableGroup);
+ errorDetail.setJobId(jobId);
+ em.persist(errorDetail);
+ errorId = errorDetail.getErrorID();
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentExperimentCatResource.java
deleted file mode 100644
index 030cc76..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentExperimentCatResource.java
+++ /dev/null
@@ -1,831 +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.experiment.catalog.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.model.*;
-import org.apache.airavata.registry.core.experiment.catalog.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ExperimentExperimentCatResource extends AbstractExperimentCatResource {
- private static final Logger logger = LoggerFactory.getLogger(ExperimentExperimentCatResource.class);
-// private WorkerResource worker;
- private String executionUser;
- private String expID;
- private Timestamp creationTime;
- private String gatewayId;
- private String projectId;
- private String expName;
- private String description;
- private String applicationId;
- private String applicationVersion;
- private String workflowTemplateId;
- private String workflowTemplateVersion;
- private String workflowExecutionId;
- private boolean enableEmailNotifications;
- private String gatewayExecutionId;
- private List<ExperimentInputExperimentCatResource> experimentInputResources;
- private List<ExperimentOutputExperimentCatResource> experimentOutputputResources;
- private ComputationSchedulingExperimentCatResource computationSchedulingResource;
- private ConfigDataExperimentCatResource userConfigDataResource;
- private List<WorkflowNodeDetailExperimentCatResource> workflowNodeDetailResourceList;
- private List<StatusExperimentCatResource> stateChangeList;
- private List<ErrorDetailExperimentCatResource> errorDetailList;
- private StatusExperimentCatResource experimentStatus;
- private List<NotificationEmailExperimentCatResource> emailResourceList;
-
- /**
- *
- * @return experiment ID
- */
- public String getExpID() {
- return expID;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getExpName() {
- return expName;
- }
-
- public void setExpName(String expName) {
- this.expName = expName;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public String getApplicationVersion() {
- return applicationVersion;
- }
-
- public void setApplicationVersion(String applicationVersion) {
- this.applicationVersion = applicationVersion;
- }
-
- public String getWorkflowTemplateId() {
- return workflowTemplateId;
- }
-
- public void setWorkflowTemplateId(String workflowTemplateId) {
- this.workflowTemplateId = workflowTemplateId;
- }
-
- public String getWorkflowTemplateVersion() {
- return workflowTemplateVersion;
- }
-
- public void setWorkflowTemplateVersion(String workflowTemplateVersion) {
- this.workflowTemplateVersion = workflowTemplateVersion;
- }
-
- public String getWorkflowExecutionId() {
- return workflowExecutionId;
- }
-
- public void setWorkflowExecutionId(String workflowExecutionId) {
- this.workflowExecutionId = workflowExecutionId;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public boolean isEnableEmailNotifications() {
- return enableEmailNotifications;
- }
-
- public void setEnableEmailNotifications(boolean enableEmailNotifications) {
- this.enableEmailNotifications = enableEmailNotifications;
- }
-
- public String getGatewayExecutionId() {
- return gatewayExecutionId;
- }
-
- public void setGatewayExecutionId(String gatewayExecutionId) {
- this.gatewayExecutionId = gatewayExecutionId;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getProjectId() {
- return projectId;
- }
-
- public void setProjectId(String projectId) {
- this.projectId = projectId;
- }
-
- public List<ExperimentInputExperimentCatResource> getExperimentInputResources() {
- return experimentInputResources;
- }
-
- public void setExperimentInputResources(List<ExperimentInputExperimentCatResource> experimentInputResources) {
- this.experimentInputResources = experimentInputResources;
- }
-
- public List<ExperimentOutputExperimentCatResource> getExperimentOutputputResources() {
- return experimentOutputputResources;
- }
-
- public void setExperimentOutputputResources(List<ExperimentOutputExperimentCatResource> experimentOutputputResources) {
- this.experimentOutputputResources = experimentOutputputResources;
- }
-
- public ComputationSchedulingExperimentCatResource getComputationSchedulingResource() {
- return computationSchedulingResource;
- }
-
- public void setComputationSchedulingResource(ComputationSchedulingExperimentCatResource computationSchedulingResource) {
- this.computationSchedulingResource = computationSchedulingResource;
- }
-
- public ConfigDataExperimentCatResource getUserConfigDataResource() {
- return userConfigDataResource;
- }
-
- public void setUserConfigDataResource(ConfigDataExperimentCatResource userConfigDataResource) {
- this.userConfigDataResource = userConfigDataResource;
- }
-
- public List<WorkflowNodeDetailExperimentCatResource> getWorkflowNodeDetailResourceList() {
- return workflowNodeDetailResourceList;
- }
-
- public void setWorkflowNodeDetailResourceList(List<WorkflowNodeDetailExperimentCatResource> workflowNodeDetailResourceList) {
- this.workflowNodeDetailResourceList = workflowNodeDetailResourceList;
- }
-
- public List<StatusExperimentCatResource> getStateChangeList() {
- return stateChangeList;
- }
-
- public void setStateChangeList(List<StatusExperimentCatResource> stateChangeList) {
- this.stateChangeList = stateChangeList;
- }
-
- public List<ErrorDetailExperimentCatResource> getErrorDetailList() {
- return errorDetailList;
- }
-
- public void setErrorDetailList(List<ErrorDetailExperimentCatResource> errorDetailList) {
- this.errorDetailList = errorDetailList;
- }
-
- public void setExperimentStatus(StatusExperimentCatResource experimentStatus) {
- this.experimentStatus = experimentStatus;
- }
-
- public List<NotificationEmailExperimentCatResource> getEmailResourceList() {
- return emailResourceList;
- }
-
- public void setEmailResourceList(List<NotificationEmailExperimentCatResource> emailResourceList) {
- this.emailResourceList = emailResourceList;
- }
-
-
- /**
- * Since experiments are at the leaf level, this method is not
- * valid for an experiment
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public ExperimentCatResource create(ResourceType type) throws RegistryException {
- switch (type){
- case EXPERIMENT_INPUT:
- ExperimentInputExperimentCatResource inputResource = new ExperimentInputExperimentCatResource();
- inputResource.setExperimentId(expID);
- return inputResource;
- case EXPERIMENT_OUTPUT:
- ExperimentOutputExperimentCatResource experimentOutputResource = new ExperimentOutputExperimentCatResource();
- experimentOutputResource.setExperimentId(expID);
- return experimentOutputResource;
- case NOTIFICATION_EMAIL:
- NotificationEmailExperimentCatResource emailResource = new NotificationEmailExperimentCatResource();
- emailResource.setExperimentId(expID);
- return emailResource;
- case WORKFLOW_NODE_DETAIL:
- WorkflowNodeDetailExperimentCatResource nodeDetailResource = new WorkflowNodeDetailExperimentCatResource();
- nodeDetailResource.setExperimentId(expID);
- return nodeDetailResource;
- case ERROR_DETAIL:
- ErrorDetailExperimentCatResource errorDetailResource = new ErrorDetailExperimentCatResource();
- errorDetailResource.setExperimentId(expID);
- return errorDetailResource;
- case STATUS:
- StatusExperimentCatResource statusResource = new StatusExperimentCatResource();
- statusResource.setExperimentId(expID);
- return statusResource;
- case CONFIG_DATA:
- ConfigDataExperimentCatResource configDataResource = new ConfigDataExperimentCatResource();
- configDataResource.setExperimentId(expID);
- return configDataResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- ComputationSchedulingExperimentCatResource schedulingResource = new ComputationSchedulingExperimentCatResource();
- schedulingResource.setExperimentId(expID);
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- AdvanceInputDataHandlingExperimentCatResource dataHandlingResource = new AdvanceInputDataHandlingExperimentCatResource();
- dataHandlingResource.setExperimentId(expID);
- return dataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- AdvancedOutputDataHandlingExperimentCatResource outputDataHandlingResource = new AdvancedOutputDataHandlingExperimentCatResource();
- outputDataHandlingResource.setExperimentId(expID);
- return outputDataHandlingResource;
- case QOS_PARAM:
- QosParamExperimentCatResource qosParamResource = new QosParamExperimentCatResource();
- qosParamResource.setExperimentId(expID);
- return qosParamResource;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for experiment resource.");
- }
- }
-
- /**
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public void remove(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- 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 NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case CONFIG_DATA:
- generator = new QueryGenerator(CONFIG_DATA);
- generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case EXPERIMENT_INPUT:
- generator = new QueryGenerator(EXPERIMENT_INPUT);
- generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment_Input experimentInput = (Experiment_Input) q.getSingleResult();
- ExperimentInputExperimentCatResource inputResource = (ExperimentInputExperimentCatResource) Utils.getResource(ResourceType.EXPERIMENT_INPUT, experimentInput);
- em.getTransaction().commit();
- em.close();
- return inputResource;
- case EXPERIMENT_OUTPUT:
- generator = new QueryGenerator(EXPERIMENT_OUTPUT);
- generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment_Output experimentOutput = (Experiment_Output) q.getSingleResult();
- ExperimentOutputExperimentCatResource outputResource = (ExperimentOutputExperimentCatResource) Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, experimentOutput);
- em.getTransaction().commit();
- em.close();
- return outputResource;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Notification_Email notificationEmail = (Notification_Email) q.getSingleResult();
- NotificationEmailExperimentCatResource notificationEmailResource = (NotificationEmailExperimentCatResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- em.getTransaction().commit();
- em.close();
- return notificationEmailResource;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- WorkflowNodeDetail workflowNodeDetail = (WorkflowNodeDetail) q.getSingleResult();
- WorkflowNodeDetailExperimentCatResource nodeDetailResource = (WorkflowNodeDetailExperimentCatResource) Utils.getResource(ResourceType.WORKFLOW_NODE_DETAIL, workflowNodeDetail);
- em.getTransaction().commit();
- em.close();
- return nodeDetailResource;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailExperimentCatResource errorDetailResource = (ErrorDetailExperimentCatResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusExperimentCatResource statusResource = (StatusExperimentCatResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- case CONFIG_DATA:
- generator = new QueryGenerator(CONFIG_DATA);
- generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- ExperimentConfigData configData = (ExperimentConfigData) q.getSingleResult();
- ConfigDataExperimentCatResource configDataResource = (ConfigDataExperimentCatResource) Utils.getResource(ResourceType.CONFIG_DATA, configData);
- em.getTransaction().commit();
- em.close();
- return configDataResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.EXPERIMENT_ID, name);
- generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- Computational_Resource_Scheduling scheduling = (Computational_Resource_Scheduling) q.getSingleResult();
- ComputationSchedulingExperimentCatResource schedulingResource = (ComputationSchedulingExperimentCatResource) Utils.getResource(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, scheduling);
- em.getTransaction().commit();
- em.close();
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.EXPERIMENT_ID, name);
- generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- AdvancedInputDataHandling inputDataHandling = (AdvancedInputDataHandling) q.getSingleResult();
- AdvanceInputDataHandlingExperimentCatResource dataHandlingResource = (AdvanceInputDataHandlingExperimentCatResource) Utils.getResource(ResourceType.ADVANCE_INPUT_DATA_HANDLING, inputDataHandling);
- em.getTransaction().commit();
- em.close();
- return dataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.EXPERIMENT_ID, name);
- generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- AdvancedOutputDataHandling outputDataHandling = (AdvancedOutputDataHandling) q.getSingleResult();
- AdvancedOutputDataHandlingExperimentCatResource outputDataHandlingResource = (AdvancedOutputDataHandlingExperimentCatResource) Utils.getResource(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, outputDataHandling);
- em.getTransaction().commit();
- em.close();
- return outputDataHandlingResource;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.EXPERIMENT_ID, name);
- generator.setParameter(QosParamsConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- QosParam qosParam = (QosParam) q.getSingleResult();
- QosParamExperimentCatResource qosParamResource = (QosParamExperimentCatResource) Utils.getResource(ResourceType.QOS_PARAM, qosParam);
- em.getTransaction().commit();
- em.close();
- return qosParamResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- /**
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
- List<ExperimentCatResource> resourceList = new ArrayList<ExperimentCatResource>();
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.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 exInput = (Experiment_Input) result;
- ExperimentInputExperimentCatResource inputResource =
- (ExperimentInputExperimentCatResource) Utils.getResource(ResourceType.EXPERIMENT_INPUT, exInput);
- resourceList.add(inputResource);
- }
- }
- 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 output = (Experiment_Output) result;
- ExperimentOutputExperimentCatResource outputResource =
- (ExperimentOutputExperimentCatResource) Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, output);
- resourceList.add(outputResource);
- }
- }
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Notification_Email notificationEmail = (Notification_Email) result;
- NotificationEmailExperimentCatResource emailResource =
- (NotificationEmailExperimentCatResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- resourceList.add(emailResource);
- }
- }
- break;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowNodeDetail nodeDetail = (WorkflowNodeDetail) result;
- WorkflowNodeDetailExperimentCatResource nodeDetailResource =
- (WorkflowNodeDetailExperimentCatResource) Utils.getResource(ResourceType.WORKFLOW_NODE_DETAIL, nodeDetail);
- resourceList.add(nodeDetailResource);
- }
- }
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailExperimentCatResource errorDetailResource =
- (ErrorDetailExperimentCatResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusExperimentCatResource statusResource =
- (StatusExperimentCatResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for experiment resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * save experiment
- */
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.getEntityManager();
- Experiment existingExp = em.find(Experiment.class, expID);
- em.close();
-
- em = ExpCatResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Experiment experiment = new Experiment();
- experiment.setProjectID(projectId);
- experiment.setExpId(expID);
- experiment.setExecutionUser(executionUser);
- experiment.setExecutionUser(executionUser);
- experiment.setGatewayId(gatewayId);
- experiment.setCreationTime(creationTime);
- experiment.setExpName(expName);
- experiment.setExpDesc(description);
- experiment.setApplicationId(applicationId);
- experiment.setAppVersion(applicationVersion);
- experiment.setWorkflowExecutionId(workflowExecutionId);
- experiment.setWorkflowTemplateVersion(workflowTemplateVersion);
- experiment.setWorkflowExecutionId(workflowExecutionId);
- experiment.setAllowNotification(enableEmailNotifications);
- experiment.setGatewayExecutionId(gatewayExecutionId);
- if (existingExp != null) {
- existingExp.setGatewayId(gatewayId);
- existingExp.setExecutionUser(executionUser);
- existingExp.setProjectID(projectId);
- existingExp.setCreationTime(creationTime);
- existingExp.setExpName(expName);
- existingExp.setExpDesc(description);
- existingExp.setApplicationId(applicationId);
- existingExp.setAppVersion(applicationVersion);
- existingExp.setWorkflowExecutionId(workflowExecutionId);
- existingExp.setWorkflowTemplateVersion(workflowTemplateVersion);
- existingExp.setWorkflowExecutionId(workflowExecutionId);
- existingExp.setAllowNotification(enableEmailNotifications);
- existingExp.setGatewayExecutionId(gatewayExecutionId);
- experiment = em.merge(existingExp);
- } else {
- em.persist(experiment);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param expID experiment ID
- */
- public void setExpID(String expID) {
- this.expID = expID;
- }
-
- public String getExecutionUser() {
- return executionUser;
- }
-
- public void setExecutionUser(String executionUser) {
- this.executionUser = executionUser;
- }
-
- public List<NotificationEmailExperimentCatResource> getNotificationEmails () throws RegistryException{
- List<NotificationEmailExperimentCatResource> emailResources = new ArrayList<NotificationEmailExperimentCatResource>();
- List<ExperimentCatResource> resources = get(ResourceType.NOTIFICATION_EMAIL);
- for (ExperimentCatResource resource : resources) {
- emailResources.add((NotificationEmailExperimentCatResource) resource);
- }
- return emailResources;
- }
-
- public List<ExperimentInputExperimentCatResource> getExperimentInputs () throws RegistryException{
- List<ExperimentInputExperimentCatResource> expInputs = new ArrayList<ExperimentInputExperimentCatResource>();
- List<ExperimentCatResource> resources = get(ResourceType.EXPERIMENT_INPUT);
- for (ExperimentCatResource resource : resources) {
- expInputs.add((ExperimentInputExperimentCatResource) resource);
- }
- return expInputs;
- }
-
- public List<ExperimentOutputExperimentCatResource> getExperimentOutputs () throws RegistryException{
- List<ExperimentOutputExperimentCatResource> expOutputs = new ArrayList<ExperimentOutputExperimentCatResource>();
- List<ExperimentCatResource> resources = get(ResourceType.EXPERIMENT_OUTPUT);
- for (ExperimentCatResource resource : resources) {
- expOutputs.add((ExperimentOutputExperimentCatResource) resource);
- }
- return expOutputs;
- }
-
- public StatusExperimentCatResource getExperimentStatus() throws RegistryException{
- List<ExperimentCatResource> resources = get(ResourceType.STATUS);
- for (ExperimentCatResource resource : resources) {
- StatusExperimentCatResource expStatus = (StatusExperimentCatResource) resource;
- if(expStatus.getStatusType().equals(StatusType.EXPERIMENT.toString())){
- if (expStatus.getState() == null || expStatus.getState().equals("") ){
- expStatus.setState("UNKNOWN");
- }
- return expStatus;
- }
- }
- return null;
- }
-
- public List<StatusExperimentCatResource> getWorkflowNodeStatuses() throws RegistryException{
- List<StatusExperimentCatResource> statuses = new ArrayList<StatusExperimentCatResource>();
- List<ExperimentCatResource> resources = get(ResourceType.STATUS);
- for (ExperimentCatResource resource : resources) {
- StatusExperimentCatResource workflowNodeStatus = (StatusExperimentCatResource) resource;
- if(workflowNodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE.toString())){
- if (workflowNodeStatus.getState() == null || workflowNodeStatus.getState().equals("")){
- workflowNodeStatus.setState("UNKNOWN");
- }
- statuses.add(workflowNodeStatus);
- }
- }
- return statuses;
- }
-
- public List<WorkflowNodeDetailExperimentCatResource> getWorkflowNodeDetails () throws RegistryException{
- List<WorkflowNodeDetailExperimentCatResource> workflowNodeDetailResourceList = new ArrayList<WorkflowNodeDetailExperimentCatResource>();
- List<ExperimentCatResource> resources = get(ResourceType.WORKFLOW_NODE_DETAIL);
- for (ExperimentCatResource resource : resources) {
- WorkflowNodeDetailExperimentCatResource nodeDetailResource = (WorkflowNodeDetailExperimentCatResource) resource;
- workflowNodeDetailResourceList.add(nodeDetailResource);
- }
- return workflowNodeDetailResourceList;
- }
-
- public List<ErrorDetailExperimentCatResource> getErrorDetails () throws RegistryException{
- List<ErrorDetailExperimentCatResource> errorDetailResources = new ArrayList<ErrorDetailExperimentCatResource>();
- List<ExperimentCatResource> resources = get(ResourceType.ERROR_DETAIL);
- for (ExperimentCatResource resource : resources) {
- ErrorDetailExperimentCatResource errorDetailResource = (ErrorDetailExperimentCatResource) resource;
- errorDetailResources.add(errorDetailResource);
- }
- return errorDetailResources;
- }
-
- public ComputationSchedulingExperimentCatResource getComputationScheduling (String expId) throws RegistryException{
- return (ComputationSchedulingExperimentCatResource)get(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, expId);
- }
-
- public AdvanceInputDataHandlingExperimentCatResource getInputDataHandling (String expId) throws RegistryException{
- return (AdvanceInputDataHandlingExperimentCatResource)get(ResourceType.ADVANCE_INPUT_DATA_HANDLING, expId);
- }
-
- public AdvancedOutputDataHandlingExperimentCatResource getOutputDataHandling (String expId) throws RegistryException{
- return (AdvancedOutputDataHandlingExperimentCatResource)get(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, expId);
- }
-
- public QosParamExperimentCatResource getQOSparams (String expId) throws RegistryException{
- return (QosParamExperimentCatResource)get(ResourceType.QOS_PARAM, expId);
- }
-
- public ConfigDataExperimentCatResource getUserConfigData(String expID) throws RegistryException{
- return (ConfigDataExperimentCatResource)get(ResourceType.CONFIG_DATA, expID);
- }
- public WorkflowNodeDetailExperimentCatResource getWorkflowNode (String nodeId) throws RegistryException{
- return (WorkflowNodeDetailExperimentCatResource)get(ResourceType.WORKFLOW_NODE_DETAIL, nodeId);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentInputExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentInputExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentInputExperimentCatResource.java
deleted file mode 100644
index d921e54..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentInputExperimentCatResource.java
+++ /dev/null
@@ -1,225 +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.experiment.catalog.resources;
-
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Input;
-import org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Input_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ExperimentInputExperimentCatResource extends AbstractExperimentCatResource {
- private static final Logger logger = LoggerFactory.getLogger(ExperimentInputExperimentCatResource.class);
-
- private String experimentId;
- private String experimentKey;
- private String value;
- private String metadata;
- private String dataType;
- private String appArgument;
- private boolean standardInput;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- 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;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- 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 String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public ExperimentCatResource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public List<ExperimentCatResource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.getEntityManager();
- Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentId, experimentKey));
- em.close();
-
- em = ExpCatResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Experiment_Input exInput = new Experiment_Input();
- exInput.setEx_key(experimentKey);
- exInput.setExperiment_id(experimentId);
- if (value != null){
- exInput.setValue(value.toCharArray());
- }
- exInput.setDataType(dataType);
- exInput.setMetadata(metadata);
- exInput.setAppArgument(appArgument);
- exInput.setStandardInput(standardInput);
- exInput.setUserFriendlyDesc(userFriendlyDesc);
- exInput.setInputOrder(inputOrder);
- exInput.setRequiredToCMD(requiredToCMD);
- exInput.setRequired(isRequired);
- exInput.setDataStaged(dataStaged);
- if (existingInput != null) {
- existingInput.setEx_key(experimentKey);
- existingInput.setExperiment_id(experimentId);
- if (value != null){
- existingInput.setValue(value.toCharArray());
- }
- existingInput.setDataType(dataType);
- existingInput.setMetadata(metadata);
- existingInput.setAppArgument(appArgument);
- existingInput.setStandardInput(standardInput);
- existingInput.setUserFriendlyDesc(userFriendlyDesc);
- existingInput.setInputOrder(inputOrder);
- existingInput.setRequiredToCMD(requiredToCMD);
- existingInput.setRequired(isRequired);
- existingInput.setDataStaged(dataStaged);
- exInput = em.merge(existingInput);
- } else {
- em.persist(exInput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/4045c094/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentInputResource.java
new file mode 100644
index 0000000..4c3f646
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentInputResource.java
@@ -0,0 +1,225 @@
+/*
+*
+* 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.experiment.catalog.resources;
+
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Input;
+import org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Input_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class ExperimentInputResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ExperimentInputResource.class);
+
+ private String experimentId;
+ private String experimentKey;
+ private String value;
+ private String metadata;
+ private String dataType;
+ private String appArgument;
+ private boolean standardInput;
+ private String userFriendlyDesc;
+ private int inputOrder;
+ private boolean isRequired;
+ private boolean requiredToCMD;
+ private boolean dataStaged;
+
+ 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;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ 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 String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public ExperimentCatResource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public List<ExperimentCatResource> get(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentId, experimentKey));
+ em.close();
+
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Experiment_Input exInput = new Experiment_Input();
+ exInput.setEx_key(experimentKey);
+ exInput.setExperiment_id(experimentId);
+ if (value != null){
+ exInput.setValue(value.toCharArray());
+ }
+ exInput.setDataType(dataType);
+ exInput.setMetadata(metadata);
+ exInput.setAppArgument(appArgument);
+ exInput.setStandardInput(standardInput);
+ exInput.setUserFriendlyDesc(userFriendlyDesc);
+ exInput.setInputOrder(inputOrder);
+ exInput.setRequiredToCMD(requiredToCMD);
+ exInput.setRequired(isRequired);
+ exInput.setDataStaged(dataStaged);
+ if (existingInput != null) {
+ existingInput.setEx_key(experimentKey);
+ existingInput.setExperiment_id(experimentId);
+ if (value != null){
+ existingInput.setValue(value.toCharArray());
+ }
+ existingInput.setDataType(dataType);
+ existingInput.setMetadata(metadata);
+ existingInput.setAppArgument(appArgument);
+ existingInput.setStandardInput(standardInput);
+ existingInput.setUserFriendlyDesc(userFriendlyDesc);
+ existingInput.setInputOrder(inputOrder);
+ existingInput.setRequiredToCMD(requiredToCMD);
+ existingInput.setRequired(isRequired);
+ existingInput.setDataStaged(dataStaged);
+ exInput = em.merge(existingInput);
+ } else {
+ em.persist(exInput);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}