You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/06/18 22:51:19 UTC
[12/17] airavata git commit: Changing the registry model and resource
packages to comply with the new data models
http://git-wip-us.apache.org/repos/asf/airavata/blob/f366c384/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ConfigurationResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ConfigurationResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ConfigurationResource.java
deleted file mode 100644
index 1a4227e..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ConfigurationResource.java
+++ /dev/null
@@ -1,204 +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.List;
-
-import javax.persistence.EntityManager;
-
-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.Configuration;
-import org.apache.airavata.registry.core.experiment.catalog.model.Configuration_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationResource extends AbstractExpCatResource {
- private final static Logger logger = LoggerFactory.getLogger(ConfigurationResource.class);
- private String configKey;
- private String configVal;
- private Timestamp expireDate;
- private String categoryID = ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE;
-
- public ConfigurationResource() {
- }
-
- /**
- * @param configKey configuration key
- * @param configVal configuration value
- */
- public ConfigurationResource(String configKey, String configVal) {
- this.configKey = configKey;
- this.configVal = configVal;
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public ExperimentCatResource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name name of the child resource
- * throws UnsupportedOperationException
- */
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public List<ExperimentCatResource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * @param expireDate expire date of the configuration
- */
- public void setExpireDate(Timestamp expireDate) {
- this.expireDate = expireDate;
- }
-
- /**
- * save configuration to database
- */
- public synchronized void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.getEntityManager();
- //whether existing
- Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, categoryID));
- em.close();
- em = ExpCatResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Configuration configuration = new Configuration();
- configuration.setConfig_key(configKey);
- configuration.setConfig_val(configVal);
- configuration.setExpire_date(expireDate);
- configuration.setCategory_id(categoryID);
- if (existing != null) {
- existing.setExpire_date(expireDate);
- existing.setCategory_id(categoryID);
- configuration = em.merge(existing);
- } else {
- em.persist(configuration);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name of the child resource
- * @return UnsupportedOperationException
- */
- public boolean isExists(ResourceType type, Object name) {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * @return configuration value
- */
- public String getConfigVal() {
- return configVal;
- }
-
- /**
- * @param configKey configuration key
- */
- public void setConfigKey(String configKey) {
- this.configKey = configKey;
- }
-
- /**
- * @param configVal configuration value
- */
- public void setConfigVal(String configVal) {
- this.configVal = configVal;
- }
-
- public String getCategoryID() {
- return categoryID;
- }
-
- public void setCategoryID(String categoryID) {
- this.categoryID = categoryID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/f366c384/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
deleted file mode 100644
index c5efb88..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/DataTransferDetailResource.java
+++ /dev/null
@@ -1,276 +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.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/f366c384/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
deleted file mode 100644
index ae1907d..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ErrorDetailResource.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 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/f366c384/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentErrorResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentErrorResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentErrorResource.java
new file mode 100644
index 0000000..23a6055
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentErrorResource.java
@@ -0,0 +1,150 @@
+/*
+ *
+ * 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.ExperimentError;
+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 ExperimentErrorResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ExperimentErrorResource.class);
+ private String experimentId;
+ private Timestamp creationTime;
+ private String actualErrorMessage;
+ private String userFriendlyMessage;
+ private Boolean transientOrPersistent;
+ private String rootCauseErrorIdList;
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getActualErrorMessage() {
+ return actualErrorMessage;
+ }
+
+ public void setActualErrorMessage(String actualErrorMessage) {
+ this.actualErrorMessage = actualErrorMessage;
+ }
+
+ public String getUserFriendlyMessage() {
+ return userFriendlyMessage;
+ }
+
+ public void setUserFriendlyMessage(String userFriendlyMessage) {
+ this.userFriendlyMessage = userFriendlyMessage;
+ }
+
+ public Boolean getTransientOrPersistent() {
+ return transientOrPersistent;
+ }
+
+ public void setTransientOrPersistent(Boolean transientOrPersistent) {
+ this.transientOrPersistent = transientOrPersistent;
+ }
+
+ public String getRootCauseErrorIdList() {
+ return rootCauseErrorIdList;
+ }
+
+ public void setRootCauseErrorIdList(String rootCauseErrorIdList) {
+ this.rootCauseErrorIdList = rootCauseErrorIdList;
+ }
+
+ public ExperimentCatResource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for task error data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for task error data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for task error data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for task error data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ExperimentError experimentError;
+ if(experimentId == null || actualErrorMessage == null){
+ throw new RegistryException("Does not have the experiment id or error message");
+ }
+ experimentError = em.find(ExperimentError.class, experimentId);
+ if(experimentError == null){
+ experimentError = new ExperimentError();
+ }
+ experimentError.setExperimentId(experimentId);
+ experimentError.setActualErrorMessage(actualErrorMessage);
+ experimentError.setUserFriendlyMessage(userFriendlyMessage);
+ experimentError.setRootCauseErrorIdList(rootCauseErrorIdList);
+ experimentError.setTransientOrPersistent(transientOrPersistent);
+ em.persist(experimentError);
+ 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/f366c384/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
index 4c3f646..3415b2b 100644
--- 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
@@ -1,31 +1,30 @@
/*
-*
-* 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.
-*
-*/
+ *
+ * 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.core.experiment.catalog.model.ExperimentInput;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,181 +34,178 @@ import java.util.List;
public class ExperimentInputResource extends AbstractExpCatResource {
private static final Logger logger = LoggerFactory.getLogger(ExperimentInputResource.class);
-
+ private int experimentInputId;
private String experimentId;
- private String experimentKey;
- private String value;
- private String metadata;
+ private String inputName;
+ private String inputValue;
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;
+ private String applicationArgument;
+ private Boolean standardInput;
+ private String userFriendlyDescription;
+ private String metadata;
+ private Integer inputOrder;
+ private Boolean isRequired;
+ private Boolean requiredToAddedToCmd;
+ private Boolean dataStaged;
+
+ public int getExperimentInputId() {
+ return experimentInputId;
}
- public void setRequired(boolean required) {
- this.isRequired = required;
+ public void setExperimentInputId(int experimentInputId) {
+ this.experimentInputId = experimentInputId;
}
- public boolean getRequiredToCMD() {
- return requiredToCMD;
+ public String getExperimentId() {
+ return experimentId;
}
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
}
- public boolean isDataStaged() {
- return dataStaged;
+ public String getInputName() {
+ return inputName;
}
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
+ public void setInputName(String inputName) {
+ this.inputName = inputName;
}
- public int getInputOrder() {
- return inputOrder;
+ public String getInputValue() {
+ return inputValue;
}
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
+ public void setInputValue(String inputValue) {
+ this.inputValue = inputValue;
}
- public String getAppArgument() {
- return appArgument;
+ public String getDataType() {
+ return dataType;
}
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
}
- public boolean isStandardInput() {
+ public String getApplicationArgument() {
+ return applicationArgument;
+ }
+
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
+ }
+
+ public Boolean getStandardInput() {
return standardInput;
}
- public void setStandardInput(boolean standardInput) {
+ public void setStandardInput(Boolean standardInput) {
this.standardInput = standardInput;
}
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
+ public String getUserFriendlyDescription() {
+ return userFriendlyDescription;
}
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
+ public void setUserFriendlyDescription(String userFriendlyDescription) {
+ this.userFriendlyDescription = userFriendlyDescription;
}
- public String getExperimentKey() {
- return experimentKey;
+ public String getMetadata() {
+ return metadata;
}
- public void setExperimentKey(String experimentKey) {
- this.experimentKey = experimentKey;
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
}
- public String getValue() {
- return value;
+ public Integer getInputOrder() {
+ return inputOrder;
}
- public void setValue(String value) {
- this.value = value;
+ public void setInputOrder(Integer inputOrder) {
+ this.inputOrder = inputOrder;
}
- public String getExperimentId() {
- return experimentId;
+ public Boolean getIsRequired() {
+ return isRequired;
}
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
+ public void setIsRequired(Boolean isRequired) {
+ this.isRequired = isRequired;
}
- public String getDataType() {
- return dataType;
+ public Boolean getRequiredToAddedToCmd() {
+ return requiredToAddedToCmd;
}
- public void setDataType(String dataType) {
- this.dataType = dataType;
+ public void setRequiredToAddedToCmd(Boolean requiredToAddedToCmd) {
+ this.requiredToAddedToCmd = requiredToAddedToCmd;
}
- public String getMetadata() {
- return metadata;
+ public Boolean getDataStaged() {
+ return dataStaged;
}
- public void setMetadata(String metadata) {
- this.metadata = metadata;
+ public void setDataStaged(Boolean dataStaged) {
+ this.dataStaged = dataStaged;
}
public ExperimentCatResource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ logger.error("Unsupported resource type for process 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());
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for process 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());
+
+ public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for process 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());
+
+ public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for process 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());
+ if(experimentId == null){
+ throw new RegistryException("Does not have the experiment id");
}
- 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);
+ ExperimentInput experimentInput;
+ experimentInput = em.find(ExperimentInput.class, experimentInputId);
+ if(experimentInput == null){
+ experimentInput = new ExperimentInput();
}
+ experimentInput.setExperimentInputId(experimentInputId);
+ experimentInput.setExperimentId(experimentId);
+ experimentInput.setInputName(inputName);
+ experimentInput.setInputValue(inputValue);
+ experimentInput.setDataType(dataType);
+ experimentInput.setApplicationArgument(applicationArgument);
+ experimentInput.setStandardInput(standardInput);
+ experimentInput.setUserFriendlyDescription(userFriendlyDescription);
+ experimentInput.setMetadata(metadata);
+ experimentInput.setInputOrder(inputOrder);
+ experimentInput.setIsRequired(isRequired);
+ experimentInput.setRequiredToAddedToCmd(requiredToAddedToCmd);
+ experimentInput.setDataStaged(dataStaged);
+ em.persist(experimentInput);
em.getTransaction().commit();
em.close();
+ this.experimentInputId = experimentInput.getExperimentInputId();
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RegistryException(e);
http://git-wip-us.apache.org/repos/asf/airavata/blob/f366c384/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentOutputResource.java
index d03bdd9..9a8124e 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentOutputResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentOutputResource.java
@@ -1,31 +1,30 @@
/*
-*
-* 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.
-*
-*/
+ *
+ * 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_Output;
-import org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Output_PK;
+import org.apache.airavata.registry.core.experiment.catalog.model.ExperimentOutput;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,160 +34,138 @@ import java.util.List;
public class ExperimentOutputResource extends AbstractExpCatResource {
private static final Logger logger = LoggerFactory.getLogger(ExperimentOutputResource.class);
-
+ private int experimentOutputId;
private String experimentId;
- private String experimentKey;
- private String value;
private String dataType;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
+ private String applicationArgument;
+ private Boolean isRequired;
+ private Boolean requiredToAddedToCmd;
+ private Boolean dataMovement;
+ private String location;
private String searchQuery;
- private String appArgument;
-
- public String getSearchQuery() {
- return searchQuery;
- }
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
+ public int getExperimentOutputId() {
+ return experimentOutputId;
}
- public String getAppArgument() {
- return appArgument;
+ public void setExperimentOutputId(int experimentOutputId) {
+ this.experimentOutputId = experimentOutputId;
}
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
+ public String getExperimentId() {
+ return experimentId;
}
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
}
- public boolean getRequired() {
- return isRequired;
+ public String getDataType() {
+ return dataType;
}
- public void setRequired(boolean required) {
- this.isRequired = required;
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
}
- public boolean isDataMovement() {
- return dataMovement;
+ public String getApplicationArgument() {
+ return applicationArgument;
}
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
}
- public String getDataNameLocation() {
- return dataNameLocation;
+ public Boolean getIsRequired() {
+ return isRequired;
}
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
+ public void setIsRequired(Boolean isRequired) {
+ this.isRequired = isRequired;
}
- public String getExperimentKey() {
- return experimentKey;
+ public Boolean getRequiredToAddedToCmd() {
+ return requiredToAddedToCmd;
}
- public void setExperimentKey(String experimentKey) {
- this.experimentKey = experimentKey;
+ public void setRequiredToAddedToCmd(Boolean requiredToAddedToCmd) {
+ this.requiredToAddedToCmd = requiredToAddedToCmd;
}
- public String getValue() {
- return value;
+ public Boolean getDataMovement() {
+ return dataMovement;
}
- public void setValue(String value) {
- this.value = value;
+ public void setDataMovement(Boolean dataMovement) {
+ this.dataMovement = dataMovement;
}
- public String getExperimentId() {
- return experimentId;
+ public String getLocation() {
+ return location;
}
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
+ public void setLocation(String location) {
+ this.location = location;
}
- public String getDataType() {
- return dataType;
+ public String getSearchQuery() {
+ return searchQuery;
}
- public void setDataType(String dataType) {
- this.dataType = dataType;
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
}
- public ExperimentCatResource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+ public ExperimentCatResource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for process output data resource.", new UnsupportedOperationException());
throw new UnsupportedOperationException();
}
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for process output data resource.", new UnsupportedOperationException());
throw new UnsupportedOperationException();
}
- public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+
+ public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for process output data resource.", new UnsupportedOperationException());
throw new UnsupportedOperationException();
}
- public List<ExperimentCatResource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+
+ public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for process output data resource.", new UnsupportedOperationException());
throw new UnsupportedOperationException();
}
- public void save() throws RegistryException {
+
+ public void save() throws RegistryException{
EntityManager em = null;
try {
em = ExpCatResourceUtils.getEntityManager();
- Experiment_Output existingOutput = em.find(Experiment_Output.class, new Experiment_Output_PK(experimentId, experimentKey));
- em.close();
-
- em = ExpCatResourceUtils.getEntityManager();
em.getTransaction().begin();
- Experiment_Output exOutput = new Experiment_Output();
- exOutput.setEx_key(experimentKey);
- exOutput.setExperiment_id(experimentId);
- if (value != null){
- exOutput.setValue(value.toCharArray());
+ if(experimentId == null){
+ throw new RegistryException("Does not have the experiment id");
}
- exOutput.setDataType(dataType);
- exOutput.setRequired(isRequired);
- exOutput.setRequiredToCMD(requiredToCMD);
- exOutput.setDataMovement(dataMovement);
- exOutput.setDataNameLocation(dataNameLocation);
- exOutput.setApplicationArgument(appArgument);
- exOutput.setSearchQuery(searchQuery);
-
- if (existingOutput != null) {
- existingOutput.setEx_key(experimentKey);
- existingOutput.setExperiment_id(experimentId);
- if (value != null){
- existingOutput.setValue(value.toCharArray());
- }
- existingOutput.setDataType(dataType);
- existingOutput.setRequired(isRequired);
- existingOutput.setRequiredToCMD(requiredToCMD);
- existingOutput.setDataMovement(dataMovement);
- existingOutput.setDataNameLocation(dataNameLocation);
- existingOutput.setApplicationArgument(appArgument);
- existingOutput.setSearchQuery(searchQuery);
- exOutput = em.merge(existingOutput);
- } else {
- em.persist(exOutput);
+ ExperimentOutput experimentOutput;
+ experimentOutput = em.find(ExperimentOutput.class, experimentOutputId);
+ if(experimentOutput == null){
+ experimentOutput = new ExperimentOutput();
}
+ experimentOutput.setExperimentOutputId(experimentOutputId);
+ experimentOutput.setExperimentId(experimentId);
+ experimentOutput.setDataType(dataType);
+ experimentOutput.setApplicationArgument(applicationArgument);
+ experimentOutput.setIsRequired(isRequired);
+ experimentOutput.setRequiredToAddedToCmd(requiredToAddedToCmd);
+ experimentOutput.setDataMovement(dataMovement);
+ experimentOutput.setLocation(location);
+ experimentOutput.setSearchQuery(searchQuery);
+ em.persist(experimentOutput);
em.getTransaction().commit();
em.close();
+ this.experimentOutputId = experimentOutput.getExperimentOutputId();
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RegistryException(e);