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:17 UTC
[10/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/NodeInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputResource.java
deleted file mode 100644
index 5820b17..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeInputResource.java
+++ /dev/null
@@ -1,227 +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.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.NodeInput;
-import org.apache.airavata.registry.core.experiment.catalog.model.NodeInput_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NodeInputResource extends AbstractExpCatResource {
- private static final Logger logger = LoggerFactory.getLogger(NodeInputResource.class);
-
- private String nodeId;
- private String inputKey;
- private String dataType;
- private String metadata;
- private String value;
- 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 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 getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public ExperimentCatResource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<ExperimentCatResource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.getEntityManager();
- NodeInput existingInput = em.find(NodeInput.class, new NodeInput_PK(inputKey, nodeId));
- em.close();
-
- em = ExpCatResourceUtils.getEntityManager();
- em.getTransaction().begin();
- NodeInput nodeInput = new NodeInput();
- nodeInput.setNodeId(nodeId);
- nodeInput.setInputKey(inputKey);
- nodeInput.setDataType(dataType);
- nodeInput.setValue(value);
- nodeInput.setMetadata(metadata);
- nodeInput.setAppArgument(appArgument);
- nodeInput.setStandardInput(standardInput);
- nodeInput.setUserFriendlyDesc(userFriendlyDesc);
- nodeInput.setInputOrder(inputOrder);
- nodeInput.setRequiredToCMD(requiredToCMD);
- nodeInput.setIsRequired(isRequired);
- nodeInput.setDataStaged(dataStaged);
-
- if (existingInput != null){
- existingInput.setNodeId(nodeId);
- existingInput.setInputKey(inputKey);
- existingInput.setDataType(dataType);
- existingInput.setValue(value);
- existingInput.setMetadata(metadata);
- existingInput.setAppArgument(appArgument);
- existingInput.setStandardInput(standardInput);
- existingInput.setUserFriendlyDesc(userFriendlyDesc);
- existingInput.setInputOrder(inputOrder);
- existingInput.setRequiredToCMD(requiredToCMD);
- existingInput.setIsRequired(isRequired);
- existingInput.setDataStaged(dataStaged);
- nodeInput = em.merge(existingInput);
- }else {
- em.persist(nodeInput);
- }
- 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/NodeOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputResource.java
deleted file mode 100644
index 0c0cd63..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NodeOutputResource.java
+++ /dev/null
@@ -1,207 +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.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.NodeOutput;
-import org.apache.airavata.registry.core.experiment.catalog.model.NodeOutput_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NodeOutputResource extends AbstractExpCatResource {
- private static final Logger logger = LoggerFactory.getLogger(NodeOutputResource.class);
-
- private String nodeId;
- private String outputKey;
- private String dataType;
- private String value;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
-
- public ExperimentCatResource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ExpCatResourceUtils.getEntityManager();
- NodeOutput existingOutput = em.find(NodeOutput.class, new NodeOutput_PK(outputKey, nodeId));
- em.close();
-
- em = ExpCatResourceUtils.getEntityManager();
- em.getTransaction().begin();
- NodeOutput nodeOutput = new NodeOutput();
- nodeOutput.setNodeId(nodeId);
- nodeOutput.setOutputKey(outputKey);
- nodeOutput.setDataType(dataType);
- nodeOutput.setValue(value);
- nodeOutput.setRequired(isRequired);
- nodeOutput.setRequiredToCMD(requiredToCMD);
- nodeOutput.setDataMovement(dataMovement);
- nodeOutput.setDataNameLocation(dataNameLocation);
- nodeOutput.setApplicationArgument(appArgument);
- nodeOutput.setSearchQuery(searchQuery);
-
- if (existingOutput != null) {
- existingOutput.setNodeId(nodeId);
- existingOutput.setOutputKey(outputKey);
- existingOutput.setDataType(dataType);
- existingOutput.setValue(value);
- existingOutput.setRequired(isRequired);
- existingOutput.setRequiredToCMD(requiredToCMD);
- existingOutput.setDataMovement(dataMovement);
- existingOutput.setDataNameLocation(dataNameLocation);
- existingOutput.setApplicationArgument(appArgument);
- existingOutput.setSearchQuery(searchQuery);
- nodeOutput = em.merge(existingOutput);
- } else {
- em.persist(nodeOutput);
- }
- 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/NotificationEmailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NotificationEmailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NotificationEmailResource.java
deleted file mode 100644
index 47c8d83..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/NotificationEmailResource.java
+++ /dev/null
@@ -1,119 +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.*;
-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 NotificationEmailResource extends AbstractExpCatResource {
- private static final Logger logger = LoggerFactory.getLogger(NotificationEmailResource.class);
-
- private int emailId = 0;
- private String experimentId;
- private String taskId;
- private String emailAddress;
-
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- 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 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();
- em.getTransaction().begin();
- Notification_Email notification_email;
- if (emailId != 0 ){
- notification_email = em.find(Notification_Email.class, emailId);
- notification_email.setEmailId(emailId);
- }else {
- notification_email = new Notification_Email();
- }
- notification_email.setExperiment_id(experimentId);
- notification_email.setTaskId(taskId);
- notification_email.setEmailAddress(emailAddress);
- em.persist(notification_email);
- emailId = notification_email.getEmailId();
- 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/ProcessErrorResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessErrorResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessErrorResource.java
new file mode 100644
index 0000000..2f1f6de
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessErrorResource.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.ProcessError;
+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 ProcessErrorResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ProcessErrorResource.class);
+ private String processId;
+ private Timestamp creationTime;
+ private String actualErrorMessage;
+ private String userFriendlyMessage;
+ private Boolean transientOrPersistent;
+ private String rootCauseErrorIdList;
+
+ public String getProcessId() {
+ return processId;
+ }
+
+ public void setProcessId(String processId) {
+ this.processId = processId;
+ }
+
+ 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();
+ ProcessError processError;
+ if(processId == null || actualErrorMessage == null){
+ throw new RegistryException("Does not have the process id or error message");
+ }
+ processError = em.find(ProcessError.class, processId);
+ if(processError == null){
+ processError = new ProcessError();
+ }
+ processError.setProcessId(processId);
+ processError.setActualErrorMessage(actualErrorMessage);
+ processError.setUserFriendlyMessage(userFriendlyMessage);
+ processError.setRootCauseErrorIdList(rootCauseErrorIdList);
+ processError.setTransientOrPersistent(transientOrPersistent);
+ em.persist(processError);
+ 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/ProcessInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessInputResource.java
new file mode 100644
index 0000000..521284a
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessInputResource.java
@@ -0,0 +1,221 @@
+/*
+ *
+ * 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.ProcessInput;
+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 ProcessInputResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ProcessInputResource.class);
+ private int processInputId;
+ private String processId;
+ private String inputName;
+ private String inputValue;
+ private String dataType;
+ 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 getProcessInputId() {
+ return processInputId;
+ }
+
+ public void setProcessInputId(int processInputId) {
+ this.processInputId = processInputId;
+ }
+
+ public String getProcessId() {
+ return processId;
+ }
+
+ public void setProcessId(String processId) {
+ this.processId = processId;
+ }
+
+ public String getInputName() {
+ return inputName;
+ }
+
+ public void setInputName(String inputName) {
+ this.inputName = inputName;
+ }
+
+ public String getInputValue() {
+ return inputValue;
+ }
+
+ public void setInputValue(String inputValue) {
+ this.inputValue = inputValue;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getApplicationArgument() {
+ return applicationArgument;
+ }
+
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
+ }
+
+ public Boolean getStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(Boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public String getUserFriendlyDescription() {
+ return userFriendlyDescription;
+ }
+
+ public void setUserFriendlyDescription(String userFriendlyDescription) {
+ this.userFriendlyDescription = userFriendlyDescription;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public Integer getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(Integer inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public Boolean getIsRequired() {
+ return isRequired;
+ }
+
+ public void setIsRequired(Boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public Boolean getRequiredToAddedToCmd() {
+ return requiredToAddedToCmd;
+ }
+
+ public void setRequiredToAddedToCmd(Boolean requiredToAddedToCmd) {
+ this.requiredToAddedToCmd = requiredToAddedToCmd;
+ }
+
+ public Boolean getDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(Boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+
+ public ExperimentCatResource create(ResourceType type) throws RegistryException {
+ 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 process input data resource.", new UnsupportedOperationException());
+ throw 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 process input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ if(processId == null){
+ throw new RegistryException("Does not have the process id");
+ }
+ ProcessInput processInput;
+ processInput = em.find(ProcessInput.class, processInputId);
+ if(processInput == null){
+ processInput = new ProcessInput();
+ }
+ processInput.setProcessInputId(processInputId);
+ processInput.setProcessId(processId);
+ processInput.setInputName(inputName);
+ processInput.setInputValue(inputValue);
+ processInput.setDataType(dataType);
+ processInput.setApplicationArgument(applicationArgument);
+ processInput.setStandardInput(standardInput);
+ processInput.setUserFriendlyDescription(userFriendlyDescription);
+ processInput.setMetadata(metadata);
+ processInput.setInputOrder(inputOrder);
+ processInput.setIsRequired(isRequired);
+ processInput.setRequiredToAddedToCmd(requiredToAddedToCmd);
+ processInput.setDataStaged(dataStaged);
+ em.persist(processInput);
+ em.getTransaction().commit();
+ em.close();
+ this.processInputId = processInput.getProcessInputId();
+ } 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/ProcessOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessOutputResource.java
new file mode 100644
index 0000000..1d496d9
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessOutputResource.java
@@ -0,0 +1,181 @@
+/*
+ *
+ * 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.ProcessOutput;
+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 ProcessOutputResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ProcessOutputResource.class);
+ private int processOutputId;
+ private String processId;
+ private String dataType;
+ private String applicationArgument;
+ private Boolean isRequired;
+ private Boolean requiredToAddedToCmd;
+ private Boolean dataMovement;
+ private String location;
+ private String searchQuery;
+
+ public int getProcessOutputId() {
+ return processOutputId;
+ }
+
+ public void setProcessOutputId(int processOutputId) {
+ this.processOutputId = processOutputId;
+ }
+
+ public String getProcessId() {
+ return processId;
+ }
+
+ public void setProcessId(String processId) {
+ this.processId = processId;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getApplicationArgument() {
+ return applicationArgument;
+ }
+
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
+ }
+
+ public Boolean getIsRequired() {
+ return isRequired;
+ }
+
+ public void setIsRequired(Boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public Boolean getRequiredToAddedToCmd() {
+ return requiredToAddedToCmd;
+ }
+
+ public void setRequiredToAddedToCmd(Boolean requiredToAddedToCmd) {
+ this.requiredToAddedToCmd = requiredToAddedToCmd;
+ }
+
+ public Boolean getDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(Boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ 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 process output data resource.", new UnsupportedOperationException());
+ throw 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 process output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ if(processId == null){
+ throw new RegistryException("Does not have the process id");
+ }
+ ProcessOutput processOutput;
+ processOutput = em.find(ProcessOutput.class, processOutputId);
+ if(processOutput == null){
+ processOutput = new ProcessOutput();
+ }
+ processOutput.setProcessOutputId(processOutputId);
+ processOutput.setProcessId(processId);
+ processOutput.setDataType(dataType);
+ processOutput.setApplicationArgument(applicationArgument);
+ processOutput.setIsRequired(isRequired);
+ processOutput.setRequiredToAddedToCmd(requiredToAddedToCmd);
+ processOutput.setDataMovement(dataMovement);
+ processOutput.setLocation(location);
+ processOutput.setSearchQuery(searchQuery);
+ em.persist(processOutput);
+ em.getTransaction().commit();
+ em.close();
+ this.processOutputId = processOutput.getProcessOutputId();
+ } 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/ProcessResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResource.java
new file mode 100644
index 0000000..99a3405
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResource.java
@@ -0,0 +1,441 @@
+/*
+ *
+ * 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.Process;
+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.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 ProcessResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ProcessResource.class);
+ private String processId;
+ private String experimentId;
+ private Timestamp creationTime;
+ private Timestamp lastUpdateTime;
+ private String processDetail;
+ private String applicationInterfaceId;
+ private String taskDag;
+
+ public String getProcessId() {
+ return processId;
+ }
+
+ public void setProcessId(String processId) {
+ this.processId = processId;
+ }
+
+ 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 Timestamp getLastUpdateTime() {
+ return lastUpdateTime;
+ }
+
+ public void setLastUpdateTime(Timestamp lastUpdateTime) {
+ this.lastUpdateTime = lastUpdateTime;
+ }
+
+ public String getProcessDetail() {
+ return processDetail;
+ }
+
+ public void setProcessDetail(String processDetail) {
+ this.processDetail = processDetail;
+ }
+
+ public String getApplicationInterfaceId() {
+ return applicationInterfaceId;
+ }
+
+ public void setApplicationInterfaceId(String applicationInterfaceId) {
+ this.applicationInterfaceId = applicationInterfaceId;
+ }
+
+ public String getTaskDag() {
+ return taskDag;
+ }
+
+ public void setTaskDag(String taskDag) {
+ this.taskDag = taskDag;
+ }
+
+ public ExperimentCatResource create(ResourceType type) throws RegistryException{
+ switch (type){
+ case PROCESS_ERROR:
+ ProcessErrorResource errorResource = new ProcessErrorResource();
+ errorResource.setProcessId(processId);
+ return errorResource;
+ case PROCESS_STATUS:
+ ProcessStatusResource statusResource = new ProcessStatusResource();
+ statusResource.setProcessId(processId);
+ return statusResource;
+ case PROCESS_INPUT:
+ ProcessInputResource processInputResource = new ProcessInputResource();
+ processInputResource.setProcessId(processId);
+ return processInputResource;
+ case PROCESS_OUTPUT:
+ ProcessOutputResource processOutputResource = new ProcessOutputResource();
+ processOutputResource.setProcessId(processId);
+ return processOutputResource;
+ case PROCESS_RESOURCE_SCHEDULE:
+ ProcessResourceScheduleResource processResourceScheduleResource = new ProcessResourceScheduleResource();
+ processResourceScheduleResource.setProcessId(processId);
+ return processResourceScheduleResource;
+ case TASK:
+ TaskResource taskResource = new TaskResource();
+ taskResource.setParentProcessId(processId);
+ return taskResource;
+ default:
+ logger.error("Unsupported resource type for process resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for process resource.");
+ }
+ }
+
+
+ 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 PROCESS_ERROR:
+ generator = new QueryGenerator(PROCESS_ERROR);
+ generator.setParameter(ProcessErrorConstants.PROCESS_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case PROCESS_STATUS:
+ generator = new QueryGenerator(PROCESS_STATUS);
+ generator.setParameter(ProcessStatusConstants.PROCESS_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case PROCESS_INPUT:
+ generator = new QueryGenerator(PROCESS_INPUT);
+ generator.setParameter(ProcessInputConstants.PROCESS_INPUT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case PROCESS_OUTPUT:
+ generator = new QueryGenerator(PROCESS_OUTPUT);
+ generator.setParameter(ProcessOutputConstants.PROCESS_OUTPUT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case PROCESS_RESOURCE_SCHEDULE:
+ generator = new QueryGenerator(PROCESS_RESOURCE_SCHEDULE);
+ generator.setParameter(ProcessResourceScheduleConstants.PROCESS_ID, processId);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case TASK:
+ generator = new QueryGenerator(TASK);
+ generator.setParameter(TaskConstants.PROCESS_ID, processId);
+ generator.setParameter(TaskConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for process detail 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 PROCESS_STATUS:
+ generator = new QueryGenerator(PROCESS_STATUS);
+ generator.setParameter(ProcessStatusConstants.PROCESS_ID, name);
+ q = generator.selectQuery(em);
+ ProcessStatus status = (ProcessStatus) q.getSingleResult();
+ ProcessStatusResource statusResource = (ProcessStatusResource) Utils.getResource(ResourceType.PROCESS_STATUS, status);
+ em.getTransaction().commit();
+ em.close();
+ return statusResource;
+ case PROCESS_ERROR:
+ generator = new QueryGenerator(PROCESS_ERROR);
+ generator.setParameter(ProcessErrorConstants.PROCESS_ID, name);
+ q = generator.selectQuery(em);
+ ProcessError processError = (ProcessError) q.getSingleResult();
+ ProcessErrorResource processErrorResource = (ProcessErrorResource) Utils.getResource(ResourceType.PROCESS_ERROR, processError);
+ em.getTransaction().commit();
+ em.close();
+ return processErrorResource;
+ case PROCESS_INPUT:
+ generator = new QueryGenerator(PROCESS_INPUT);
+ generator.setParameter(ProcessInputConstants.PROCESS_INPUT_ID, name);
+ generator.setParameter(ProcessInputConstants.PROCESS_ID, processId);
+ q = generator.selectQuery(em);
+ ProcessInput processInput = (ProcessInput) q.getSingleResult();
+ ProcessInputResource processInputResource = (ProcessInputResource) Utils.getResource(ResourceType.PROCESS_INPUT, processInput);
+ em.getTransaction().commit();
+ em.close();
+ return processInputResource;
+ case PROCESS_OUTPUT:
+ generator = new QueryGenerator(PROCESS_OUTPUT);
+ generator.setParameter(ProcessOutputConstants.PROCESS_OUTPUT_ID, name);
+ generator.setParameter(ProcessInputConstants.PROCESS_ID, processId);
+ q = generator.selectQuery(em);
+ ProcessOutput processOutput = (ProcessOutput) q.getSingleResult();
+ ProcessOutputResource outputResource = (ProcessOutputResource) Utils.getResource(ResourceType.PROCESS_OUTPUT, processOutput);
+ em.getTransaction().commit();
+ em.close();
+ return outputResource;
+ case PROCESS_RESOURCE_SCHEDULE:
+ generator = new QueryGenerator(PROCESS_RESOURCE_SCHEDULE);
+ generator.setParameter(ProcessResourceScheduleConstants.PROCESS_ID, name);
+ q = generator.selectQuery(em);
+ ProcessResourceSchedule processResourceSchedule = (ProcessResourceSchedule) q.getSingleResult();
+ ProcessResourceScheduleResource processResourceScheduleResource = (ProcessResourceScheduleResource)
+ Utils.getResource(ResourceType.PROCESS_RESOURCE_SCHEDULE, processResourceSchedule);
+ em.getTransaction().commit();
+ em.close();
+ return processResourceScheduleResource;
+ case TASK:
+ generator = new QueryGenerator(TASK);
+ generator.setParameter(TaskConstants.TASK_ID, name);
+ generator.setParameter(TaskConstants.PROCESS_ID, processId);
+ q = generator.selectQuery(em);
+ Task task = (Task) q.getSingleResult();
+ TaskResource taskResource = (TaskResource) Utils.getResource(ResourceType.TASK, task);
+ em.getTransaction().commit();
+ em.close();
+ return taskResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for process resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for process 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 PROCESS_INPUT:
+ generator = new QueryGenerator(PROCESS_INPUT);
+ generator.setParameter(ProcessInputConstants.PROCESS_ID, processId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ProcessInput processInput = (ProcessInput) result;
+ ProcessInputResource processInputResource =
+ (ProcessInputResource) Utils.getResource(ResourceType.PROCESS_INPUT, processInput);
+ resourceList.add(processInputResource);
+ }
+ }
+ break;
+ case PROCESS_OUTPUT:
+ generator = new QueryGenerator(PROCESS_OUTPUT);
+ generator.setParameter(ProcessOutputConstants.PROCESS_ID, processId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ProcessOutput processOutput = (ProcessOutput) result;
+ ProcessOutputResource processOutputResource
+ = (ProcessOutputResource) Utils.getResource(ResourceType.PROCESS_OUTPUT, processOutput);
+ resourceList.add(processOutputResource);
+ }
+ }
+ break;
+ case TASK:
+ generator = new QueryGenerator(TASK);
+ generator.setParameter(TaskConstants.PROCESS_ID, processId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Task task = (Task) result;
+ TaskResource taskResource =
+ (TaskResource) Utils.getResource(ResourceType.TASK, task);
+ resourceList.add(taskResource);
+ }
+ }
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for task 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();
+ Process process = em.find(Process.class, processId);
+ em.close();
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (process == null) {
+ process = new Process();
+ }
+ process.setProcessId(processId);
+ process.setExperimentId(experimentId);
+ process.setCreationTime(creationTime);
+ process.setLastUpdateTime(lastUpdateTime);
+ process.setProcessDetail(processDetail);
+ process.setApplicationInterfaceId(applicationInterfaceId);
+ process.setTaskDag(taskDag);
+ em.persist(process);
+ em.getTransaction().commit();
+ } 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 List<ProcessInputResource> getProcessInputs() throws RegistryException{
+ List<ProcessInputResource> processInputResources = new ArrayList();
+ List<ExperimentCatResource> resources = get(ResourceType.PROCESS_INPUT);
+ for (ExperimentCatResource resource : resources) {
+ ProcessInputResource inputResource = (ProcessInputResource) resource;
+ processInputResources.add(inputResource);
+ }
+ return processInputResources;
+ }
+
+ public List<ProcessOutputResource> getProcessOutputs() throws RegistryException{
+ List<ProcessOutputResource> outputResources = new ArrayList();
+ List<ExperimentCatResource> resources = get(ResourceType.PROCESS_OUTPUT);
+ for (ExperimentCatResource resource : resources) {
+ ProcessOutputResource outputResource = (ProcessOutputResource) resource;
+ outputResources.add(outputResource);
+ }
+ return outputResources;
+ }
+
+ public ProcessStatusResource getProcessStatus() throws RegistryException{
+ ExperimentCatResource resource = get(ResourceType.PROCESS_STATUS, processId);
+ return (ProcessStatusResource)resource;
+ }
+
+ public ProcessErrorResource getProcessError() throws RegistryException{
+ ExperimentCatResource resource = get(ResourceType.PROCESS_ERROR, processId);
+ return (ProcessErrorResource)resource;
+ }
+
+ public ProcessResourceScheduleResource getProcessResourceSchedule() throws RegistryException{
+ ExperimentCatResource resource = get(ResourceType.PROCESS_RESOURCE_SCHEDULE, processId);
+ return (ProcessResourceScheduleResource)resource;
+ }
+
+ public List<TaskResource> getTaskList() throws RegistryException{
+ List<TaskResource> taskResources = new ArrayList<TaskResource>();
+ List<ExperimentCatResource> resources = get(ResourceType.TASK);
+ for (ExperimentCatResource resource : resources) {
+ TaskResource taskResource = (TaskResource) resource;
+ taskResources.add(taskResource);
+ }
+ return taskResources;
+ }
+}
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/ProcessResourceScheduleResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResourceScheduleResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResourceScheduleResource.java
new file mode 100644
index 0000000..4975ae9
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessResourceScheduleResource.java
@@ -0,0 +1,170 @@
+/*
+ *
+ * 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.ProcessResourceSchedule;
+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 ProcessResourceScheduleResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ProcessResourceScheduleResource.class);
+ private String processId;
+ private String resourceHostId;
+ private Integer totalCpuCount;
+ private Integer nodeCount;
+ private Integer numberOfThreads;
+ private String queueName;
+ private Integer wallTimeLimit;
+ private Integer totalPhysicalMemory;
+
+ public String getProcessId() {
+ return processId;
+ }
+
+ public void setProcessId(String processId) {
+ this.processId = processId;
+ }
+
+ public String getResourceHostId() {
+ return resourceHostId;
+ }
+
+ public void setResourceHostId(String resourceHostId) {
+ this.resourceHostId = resourceHostId;
+ }
+
+ public Integer getTotalCpuCount() {
+ return totalCpuCount;
+ }
+
+ public void setTotalCpuCount(Integer totalCpuCount) {
+ this.totalCpuCount = totalCpuCount;
+ }
+
+ public Integer getNodeCount() {
+ return nodeCount;
+ }
+
+ public void setNodeCount(Integer nodeCount) {
+ this.nodeCount = nodeCount;
+ }
+
+ public Integer getNumberOfThreads() {
+ return numberOfThreads;
+ }
+
+ public void setNumberOfThreads(Integer numberOfThreads) {
+ this.numberOfThreads = numberOfThreads;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName = queueName;
+ }
+
+ public Integer getWallTimeLimit() {
+ return wallTimeLimit;
+ }
+
+ public void setWallTimeLimit(Integer wallTimeLimit) {
+ this.wallTimeLimit = wallTimeLimit;
+ }
+
+ public Integer getTotalPhysicalMemory() {
+ return totalPhysicalMemory;
+ }
+
+ public void setTotalPhysicalMemory(Integer totalPhysicalMemory) {
+ this.totalPhysicalMemory = totalPhysicalMemory;
+ }
+
+ public ExperimentCatResource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for process resource scheduling data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for process resource scheduling data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for process resource scheduling data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for process resource scheduling data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ProcessResourceSchedule processResourceSchedule;
+ if(processId == null){
+ throw new RegistryException("Does not have the process id");
+ }
+ processResourceSchedule = em.find(ProcessResourceSchedule.class, processId);
+ if(processResourceSchedule == null){
+ processResourceSchedule = new ProcessResourceSchedule();
+ }
+ processResourceSchedule.setProcessId(processId);
+ processResourceSchedule.setResourceHostId(resourceHostId);
+ processResourceSchedule.setTotalCpuCount(totalCpuCount);
+ processResourceSchedule.setNodeCount(nodeCount);
+ processResourceSchedule.setNumberOfThreads(numberOfThreads);
+ processResourceSchedule.setQueueName(queueName);
+ processResourceSchedule.setWallTimeLimit(wallTimeLimit);
+ processResourceSchedule.setTotalPhysicalMemory(totalPhysicalMemory);
+ em.persist(processResourceSchedule);
+ 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/ProcessStatusResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessStatusResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessStatusResource.java
new file mode 100644
index 0000000..4ae5298
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProcessStatusResource.java
@@ -0,0 +1,130 @@
+/*
+ *
+ * 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.ProcessStatus;
+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 ProcessStatusResource extends AbstractExpCatResource {
+ private static final Logger logger = LoggerFactory.getLogger(ProcessStatusResource.class);
+ private String processId;
+ private String state;
+ private Timestamp timeOfStateChange;
+ private String reason;
+
+ public String getProcessId() {
+ return processId;
+ }
+
+ public void setProcessId(String processId) {
+ this.processId = processId;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public Timestamp getTimeOfStateChange() {
+ return timeOfStateChange;
+ }
+
+ public void setTimeOfStateChange(Timestamp timeOfStateChange) {
+ this.timeOfStateChange = timeOfStateChange;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public ExperimentCatResource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for process status data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for process status data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for process status data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<ExperimentCatResource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for process status data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ExpCatResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ProcessStatus processStatus;
+ if(processId == null || state == null){
+ throw new RegistryException("Does not have the process id or state");
+ }
+ processStatus = em.find(ProcessStatus.class, processId);
+ if(processStatus == null){
+ processStatus = new ProcessStatus();
+ }
+ processStatus.setProcessId(processId);
+ processStatus.setState(state);
+ processStatus.setReason(reason);
+ em.persist(processStatus);
+ 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/ProjectResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProjectResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProjectResource.java
index f67b1b4..c46256c 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProjectResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProjectResource.java
@@ -23,7 +23,10 @@ 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.*;
+import org.apache.airavata.registry.core.experiment.catalog.model.Experiment;
+import org.apache.airavata.registry.core.experiment.catalog.model.Project;
+import org.apache.airavata.registry.core.experiment.catalog.model.ProjectUser;
+import org.apache.airavata.registry.core.experiment.catalog.model.User;
import org.apache.airavata.registry.core.experiment.catalog.utils.QueryGenerator;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.airavata.registry.cpi.ResultOrderType;
@@ -47,7 +50,7 @@ public class ProjectResource extends AbstractExpCatResource {
private Timestamp creationTime;
/**
- *
+ *x
*/
public ProjectResource() {
}
@@ -60,8 +63,8 @@ public class ProjectResource extends AbstractExpCatResource {
public ExperimentCatResource create(ResourceType type) throws RegistryException {
if (type == ResourceType.EXPERIMENT) {
ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setGatewayId(gatewayId);
- experimentResource.setExecutionUser(worker.getUser());
+ experimentResource.setGatewayExecutionId(gatewayId);
+ experimentResource.setUserName(worker.getUser());
experimentResource.setProjectId(id);
return experimentResource;
} else if (type == ResourceType.PROJECT_USER){
@@ -236,7 +239,7 @@ public class ProjectResource extends AbstractExpCatResource {
* @param offset
* @param orderByIdentifier
* @return
- * @throws RegistryException
+ * @throws org.apache.airavata.registry.cpi.RegistryException
*/
public List<ExperimentCatResource> get(ResourceType type, int limit, int offset, Object orderByIdentifier,
ResultOrderType resultOrderType) throws RegistryException{
@@ -334,20 +337,20 @@ public class ProjectResource extends AbstractExpCatResource {
em = ExpCatResourceUtils.getEntityManager();
em.getTransaction().begin();
Project project = new Project();
- project.setProject_id(id);
- project.setProject_name(name);
- project.setGateway_id(gatewayId);
- Users user = em.find(Users.class, worker.getUser());
- project.setUsers(user);
- project.setUser_name(user.getUser_name());
+ project.setProjectId(id);
+ project.setProjectName(name);
+ project.setGatewayId(gatewayId);
+ User user = em.find(User.class, worker.getUser());
+ project.setUser(user);
+ project.setOwnerName(user.getUserName());
project.setDescription(description);
project.setCreationTime(creationTime);
if (existingProject != null) {
- existingProject.setProject_name(name);
- existingProject.setGateway_id(gatewayId);
- existingProject.setUsers(user);
- existingProject.setUser_name(user.getUser_name());
+ existingProject.setProjectName(name);
+ existingProject.setGatewayId(gatewayId);
+ existingProject.setUser(user);
+ existingProject.setOwnerName(user.getUserName());
existingProject.setDescription(description);
existingProject.setCreationTime(creationTime);
project = em.merge(existingProject);
@@ -450,7 +453,7 @@ public class ProjectResource extends AbstractExpCatResource {
*/
public ExperimentResource createExperiment(String experimentId) throws RegistryException{
ExperimentResource experimentResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentId);
+ experimentResource.setExperimentId(experimentId);
return experimentResource;
}
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/ProjectUserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProjectUserResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProjectUserResource.java
index 3063990..0bd74e8 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProjectUserResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ProjectUserResource.java
@@ -24,7 +24,10 @@ 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.*;
+import org.apache.airavata.registry.core.experiment.catalog.model.ProjectUser;
+import org.apache.airavata.registry.core.experiment.catalog.model.ProjectUsersPK;
+import org.apache.airavata.registry.core.experiment.catalog.model.Project;
+import org.apache.airavata.registry.core.experiment.catalog.model.User;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,25 +86,28 @@ public class ProjectUserResource extends AbstractExpCatResource {
EntityManager em = null;
try {
em = ExpCatResourceUtils.getEntityManager();
- ProjectUser existingPrUser = em.find(ProjectUser.class, new ProjectUser_PK(projectId, userName));
+ ProjectUsersPK projectUsersPK = new ProjectUsersPK();
+ projectUsersPK.setProjectId(projectId);
+ projectUsersPK.setUserName(userName);
+ ProjectUser existingPrUser = em.find(ProjectUser.class, projectUsersPK);
em.close();
em = ExpCatResourceUtils.getEntityManager();
em.getTransaction().begin();
ProjectUser prUser = new ProjectUser();
- prUser.setProjectID(projectId);
+ prUser.setProjectId(projectId);
prUser.setUserName(userName);
- Users user = em.find(Users.class, userName);
+ User user = em.find(User.class, userName);
prUser.setUser(user);
Project project = em.find(Project.class, projectId);
prUser.setProject(project);
if (existingPrUser != null) {
- existingPrUser.setProjectID(projectId);
+ existingPrUser.setProjectId(projectId);
existingPrUser.setUserName(userName);
existingPrUser.setUser(user);
existingPrUser.setProject(project);
- prUser = em.merge(existingPrUser);
+ em.merge(existingPrUser);
} else {
em.persist(prUser);
}