http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessInputEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessInputEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessInputEntity.java new file mode 100644 index 0000000..850c4a9 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessInputEntity.java @@ -0,0 +1,174 @@ +/* + * + * 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.entities.expcatalog; + +import javax.persistence.*; + +@Entity +@Table(name = "EXPCAT_PROCESS_INPUT") +@IdClass(ProcessInputPK.class) +public class ProcessInputEntity { + private String processId; + public String name; + public String value; + public String type; + public String applicationArgument; + public boolean standardInput; + public String userFriendlyDescription; + public String metaData; + public int inputOrder; + public boolean isRequired; + public boolean requiredToAddedToCommandLine; + public boolean dataStaged; + public String storageResourceId; + + private ProcessEntity process; + + @Id + @Column(name = "PROCESS_ID") + public String getProceesId() { + return processId; + } + + public void setProceseId(String processId) { + this.processId = processId; + } + + @Id + @Column(name = "INPUT_NAME") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Column(name = "INPUT_VALUE") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Column(name = "INPUT_TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "APPLICATION_ARGUMENT") + public String getApplicationArgument() { + return applicationArgument; + } + + public void setApplicationArgument(String applicationArgument) { + this.applicationArgument = applicationArgument; + } + + @Column(name = "STANDARD_INPUT") + public boolean isStandardInput() { + return standardInput; + } + + public void setStandardInput(boolean standardInput) { + this.standardInput = standardInput; + } + + @Column(name = "USER_FRIENDLY_DESCRIPTION") + public String getUserFriendlyDescription() { + return userFriendlyDescription; + } + + public void setUserFriendlyDescription(String userFriendlyDescription) { + this.userFriendlyDescription = userFriendlyDescription; + } + + @Lob + @Column(name = "METADATA") + public String getMetaData() { + return metaData; + } + + public void setMetaData(String metaData) { + this.metaData = metaData; + } + + @Column(name = "INPUT_ORDER") + public int getInputOrder() { + return inputOrder; + } + + public void setInputOrder(int inputOrder) { + this.inputOrder = inputOrder; + } + + @Column(name = "REQUIRED") + public boolean isRequired() { + return isRequired; + } + + public void setRequired(boolean isRequired) { + this.isRequired = isRequired; + } + + @Column(name = "REQUIRED_TO_ADDED_TO_COMMANDLINE") + public boolean isRequiredToAddedToCommandLine() { + return requiredToAddedToCommandLine; + } + + public void setRequiredToAddedToCommandLine(boolean requiredToAddedToCommandLine) { + this.requiredToAddedToCommandLine = requiredToAddedToCommandLine; + } + + @Column(name = "DATA_STAGED") + public boolean isDataStaged() { + return dataStaged; + } + + public void setDataStaged(boolean dataStaged) { + this.dataStaged = dataStaged; + } + + @Column(name = "STORAGE_RESOURCE_ID") + public String getStorageResourceId() { + return storageResourceId; + } + + public void setStorageResourceId(String storageResourceId) { + this.storageResourceId = storageResourceId; + } + + @ManyToOne(targetEntity = ProcessEntity.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PROCESS_ID", referencedColumnName = "PROCESS_ID") + public ProcessEntity getProcess() { + return process; + } + + public void setProcess(ProcessEntity process) { + this.process = process; + } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessInputPK.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessInputPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessInputPK.java new file mode 100644 index 0000000..188b35f --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessInputPK.java @@ -0,0 +1,74 @@ +/* + * + * 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.entities.expcatalog; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +public class ProcessInputPK implements Serializable { + private final static Logger logger = LoggerFactory.getLogger(ProcessInputPK.class); + private String processId; + private String name; + + @Id + @Column(name = "PROCESS_ID") + public String getProcessId() { + return processId; + } + + public void setProcessId(String processId) { + this.processId = processId; + } + + @Id + @Column(name = "INPUT_NAME") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ProcessInputPK that = (ProcessInputPK) o; + + if (getProcessId() != null ? !getProcessId().equals(that.getProcessId()) : that.getProcessId() != null) return false; + if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = getProcessId() != null ? getProcessId().hashCode() : 0; + result = 31 * result + (getName() != null ? getName().hashCode() : 0); + return result; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessOutputEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessOutputEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessOutputEntity.java new file mode 100644 index 0000000..4226f7a --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessOutputEntity.java @@ -0,0 +1,165 @@ +/* + * + * 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.entities.expcatalog; + +import javax.persistence.*; + +@Entity +@Table(name = "EXPCAT_PROCESS_OUTPUT") +@IdClass(ProcessOutputPK.class) +public class ProcessOutputEntity { + private String processId; + public String name; + public String value; + public String type; + public String applicationArgument; + public boolean isRequired; + public boolean requiredToAddedToCommandLine; + public boolean dataMovement; + public String location; + public String searchQuery; + public boolean outputStreaming; + public String storageResourceId; + + private ProcessEntity process; + + + @Id + @Column(name = "PROCESS_ID") + public String getProcessId() { + return processId; + } + + public void setProcessId(String processId) { + this.processId = processId; + } + + @Id + @Column(name = "OUTPUT_NAME") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Column(name = "OUTPUT_VALUE") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Column(name = "OUTPUT_TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "APPLICATION_ARGUMENT") + public String getApplicationArgument() { + return applicationArgument; + } + + public void setApplicationArgument(String applicationArgument) { + this.applicationArgument = applicationArgument; + } + + @Column(name = "REQUIRED") + public boolean isRequired() { + return isRequired; + } + + public void setRequired(boolean isRequired) { + this.isRequired = isRequired; + } + + + @Column(name = "REQUIRED_TO_ADDED_TO_COMMANDLINE") + public boolean isRequiredToAddedToCommandLine() { + return requiredToAddedToCommandLine; + } + + public void setRequiredToAddedToCommandLine(boolean requiredToAddedToCommandLine) { + this.requiredToAddedToCommandLine = requiredToAddedToCommandLine; + } + + @Column(name = "DATA_MOVEMENT") + public boolean isDataMovement() { + return dataMovement; + } + + public void setDataMovement(boolean dataMovement) { + this.dataMovement = dataMovement; + } + + @Column(name = "LOCATION") + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + @Column(name = "SEARCH_QUERY") + public String getSearchQuery() { + return searchQuery; + } + + public void setSearchQuery(String searchQuery) { + this.searchQuery = searchQuery; + } + + @Column(name = "OUTPUT_STREAMING") + public boolean isOutputStreaming() { + return outputStreaming; + } + + public void setOutputStreaming(boolean outputStreaming) { + this.outputStreaming = outputStreaming; + } + + @Column(name = "STORAGE_RESOURCE_ID") + public String getStorageResourceId() { + return storageResourceId; + } + + public void setStorageResourceId(String storageResourceId) { + this.storageResourceId = storageResourceId; + } + + @ManyToOne(targetEntity = ProcessEntity.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PROCESS_ID", referencedColumnName = "PROCESS_ID") + public ProcessEntity getProcess() { + return process; + } + + public void setProcess(ProcessEntity process) { + this.process = process; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessOutputPK.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessOutputPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessOutputPK.java new file mode 100644 index 0000000..bde7c50 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessOutputPK.java @@ -0,0 +1,70 @@ +/* + * + * 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.entities.expcatalog; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +public class ProcessOutputPK implements Serializable { + private String processId; + private String name; + + @Id + @Column(name = "PROCESS_ID") + public String getProcessId() { + return processId; + } + + public void setProcessId(String processId) { + this.processId = processId; + } + + @Id + @Column(name = "OUTPUT_NAME") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ProcessOutputPK that = (ProcessOutputPK) o; + + if (getProcessId() != null ? !getProcessId().equals(that.getProcessId()) : that.getProcessId() != null) return false; + if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = getProcessId() != null ? getProcessId().hashCode() : 0; + result = 31 * result + (getName() != null ? getName().hashCode() : 0); + return result; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessResourceSchedulingEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessResourceSchedulingEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessResourceSchedulingEntity.java new file mode 100644 index 0000000..3a64f42 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessResourceSchedulingEntity.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.entities.expcatalog; + +import javax.persistence.*; + +@Entity +@Table(name = "EXPCAT_PROCESS_RESOURCE_SCHEDULING") +public class ProcessResourceSchedulingEntity { + private String processId; + private String resourceHostId; + private int totalCPUCount; + private int nodeCount; + private int numberOfThreads; + private String queueName; + private int wallTimeLimit; + private int totalPhysicalMemory; + private String chessisNumber; + private String staticWorkingDir; + private String overrideLoginUserName; + private String overrideScratchLocation; + private String overrideAllocationProjectNumber; + private ProcessEntity process; + + @Id + @Column(name = "PROCESS_ID") + public String getProcessId() { + return processId; + } + + public void setProcessId(String processId) { + this.processId = processId; + } + + @Column(name = "RESOURCE_HOST_ID") + public String getResourceHostId() { + return resourceHostId; + } + + public void setResourceHostId(String resourceHostId) { + this.resourceHostId = resourceHostId; + } + + @Column(name = "CPU_COUNT") + public int getTotalCPUCount() { + return totalCPUCount; + } + + public void setTotalCPUCount(int totalCPUCount) { + this.totalCPUCount = totalCPUCount; + } + + @Column(name = "NODE_COUNT") + public int getNodeCount() { + return nodeCount; + } + + public void setNodeCount(int nodeCount) { + this.nodeCount = nodeCount; + } + + @Column(name = "NUMBER_OF_THREADS") + public int getNumberOfThreads() { + return numberOfThreads; + } + + public void setNumberOfThreads(int numberOfThreads) { + this.numberOfThreads = numberOfThreads; + } + + @Column(name = "QUEUE_NAME") + public String getQueueName() { + return queueName; + } + + public void setQueueName(String queueName) { + this.queueName = queueName; + } + + @Column(name = "WALL_TIME_LIMIT") + public int getWallTimeLimit() { + return wallTimeLimit; + } + + public void setWallTimeLimit(int wallTimeLimit) { + this.wallTimeLimit = wallTimeLimit; + } + + @Column(name = "TOTAL_PHYSICAL_MEMORY") + public int getTotalPhysicalMemory() { + return totalPhysicalMemory; + } + + public void setTotalPhysicalMemory(int totalPhysicalMemory) { + this.totalPhysicalMemory = totalPhysicalMemory; + } + + @Column(name = "CHESSIS_NUMBER") + public String getChessisNumber() { + return chessisNumber; + } + + public void setChessisNumber(String chessisNumber) { + this.chessisNumber = chessisNumber; + } + + @Column(name = "STATIC_WORKING_DIRECTORY") + public String getStaticWorkingDir() { + return staticWorkingDir; + } + + public void setStaticWorkingDir(String staticWorkingDir) { + this.staticWorkingDir = staticWorkingDir; + } + + @Column(name = "OVERRIDE_LOGIN_USERNAME") + public String getOverrideLoginUserName() { + return overrideLoginUserName; + } + + public void setOverrideLoginUserName(String overrideLoginUserName) { + this.overrideLoginUserName = overrideLoginUserName; + } + + @Column(name = "OVERRIDE_SCRATCH_LOCATION") + public String getOverrideScratchLocation() { + return overrideScratchLocation; + } + + public void setOverrideScratchLocation(String overrideScratchLocation) { + this.overrideScratchLocation = overrideScratchLocation; + } + + @Column(name = "OVERRIDE_ALLOCATION_PROJECT_NUMBER") + public String getOverrideAllocationProjectNumber() { + return overrideAllocationProjectNumber; + } + + public void setOverrideAllocationProjectNumber(String overrideAllocationProjectNumber) { + this.overrideAllocationProjectNumber = overrideAllocationProjectNumber; + } + + @OneToOne(targetEntity = ProcessEntity.class, cascade = CascadeType.ALL) + @PrimaryKeyJoinColumn(name = "PROCESS_ID", referencedColumnName = "PROCESS_ID") + public ProcessEntity getProcess() { + return process; + } + + public void setProcess(ProcessEntity process) { + this.process = process; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessStatusEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessStatusEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessStatusEntity.java new file mode 100644 index 0000000..7a3c30e --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessStatusEntity.java @@ -0,0 +1,83 @@ +/* + * + * 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.entities.expcatalog; + +import javax.persistence.*; + +@Entity +@Table(name = "EXPCAT_PROCESS_STATUS") +@IdClass(ProcessStatusPK.class) +public class ProcessStatusEntity { + private String processId; + private String state; + private long timeOfStateChange; + private String reason; + + private ProcessEntity process; + + @Id + @Column(name = "PROCESS_ID") + public String getProcessId() { + return processId; + } + + public void setProcessId(String processId) { + this.processId = processId; + } + + @Id + @Column(name = "STATE") + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + @Column(name = "TIME_OF_STATE_CHANGE") + public long getTimeOfStateChange() { + return timeOfStateChange; + } + + public void setTimeOfStateChange(long timeOfStateChange) { + this.timeOfStateChange = timeOfStateChange; + } + + @Column(name = "REASON") + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + @ManyToOne(targetEntity = ProcessEntity.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PROCESS_ID", referencedColumnName = "PROCESS_ID") + public ProcessEntity getProcess() { + return process; + } + + public void setProcess(ProcessEntity process) { + this.process = process; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessStatusPK.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessStatusPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessStatusPK.java new file mode 100644 index 0000000..dba568a --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ProcessStatusPK.java @@ -0,0 +1,74 @@ +/* + * + * 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.entities.expcatalog; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +public class ProcessStatusPK implements Serializable { + private final static Logger logger = LoggerFactory.getLogger(ProcessStatusPK.class); + private String state; + private String processId; + + @Id + @Column(name = "STATUS_ID") + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + @Id + @Column(name = "PROCESS_ID") + public String getProcessId() { + return processId; + } + + public void setProcessId(String processId) { + this.processId = processId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ProcessStatusPK that = (ProcessStatusPK) o; + + if (getState() != null ? !getState().equals(that.getState()) : that.getState() != null) return false; + if (getProcessId() != null ? !getProcessId().equals(that.getProcessId()) : that.getProcessId() != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = getState() != null ? getState().hashCode() : 0; + result = 31 * result + (getProcessId() != null ? getProcessId().hashCode() : 0); + return result; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskEntity.java new file mode 100644 index 0000000..8e4be82 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskEntity.java @@ -0,0 +1,147 @@ +/* + * + * 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.entities.expcatalog; + +import org.apache.airavata.model.task.TaskTypes; + +import javax.persistence.*; +import java.nio.ByteBuffer; +import java.util.List; + +@Entity +@Table(name = "EXPCAT_TASK") +public class TaskEntity { + private String taskId; + private TaskTypes taskType; + private String parentProcessId; + private long creationTime; + private long lastUpdateTime; + private String taskDetail; + private ByteBuffer subTaskModel; + + private List<TaskStatusEntity> taskStatuses; + private List<TaskErrorEntity> taskErrors; + private List<JobEntity> jobs; + + private ProcessEntity process; + + @Id + @Column(name = "TASK_ID") + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + @Column(name = "TASK_TYPE") + public TaskTypes getTaskType() { + return taskType; + } + + public void setTaskType(TaskTypes taskType) { + this.taskType = taskType; + } + + @Column(name = "PARENT_PROCESS_ID") + public String getParentProcessId() { + return parentProcessId; + } + + public void setParentProcessId(String parentProcessId) { + this.parentProcessId = parentProcessId; + } + + @Column(name = "CREATION_TIME") + public long getCreationTime() { + return creationTime; + } + + public void setCreationTime(long creationTime) { + this.creationTime = creationTime; + } + + @Column(name = "LAST_UPDATE_TIME") + public long getLastUpdateTime() { + return lastUpdateTime; + } + + public void setLastUpdateTime(long lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + } + + @Column(name = "TASK_DETAIL") + public String getTaskDetail() { + return taskDetail; + } + + public void setTaskDetail(String taskDetail) { + this.taskDetail = taskDetail; + } + + @Lob + @Column(name = "SUB_TASK_MODEL") + public ByteBuffer getSubTaskModel() { + return subTaskModel; + } + + public void setSubTaskModel(ByteBuffer subTaskModel) { + this.subTaskModel = subTaskModel; + } + + @OneToMany(targetEntity = TaskStatusEntity.class, cascade = CascadeType.ALL, mappedBy = "task") + public List<TaskStatusEntity> getTaskStatuses() { + return taskStatuses; + } + + public void setTaskStatuses(List<TaskStatusEntity> taskStatus) { + this.taskStatuses = taskStatus; + } + + @OneToMany(targetEntity = TaskErrorEntity.class, cascade = CascadeType.ALL, mappedBy = "task") + public List<TaskErrorEntity> getTaskErrors() { + return taskErrors; + } + + public void setTaskErrors(List<TaskErrorEntity> taskError) { + this.taskErrors = taskError; + } + + @OneToMany(targetEntity = JobEntity.class, cascade = CascadeType.ALL, mappedBy = "task") + public List<JobEntity> getJobs() { + return jobs; + } + + public void setJobs(List<JobEntity> jobs) { + this.jobs = jobs; + } + + @ManyToOne(targetEntity = ProcessEntity.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PARENT_PROCESS_ID", referencedColumnName = "PROCESS_ID") + public ProcessEntity getProcess() { + return process; + } + + public void setProcess(ProcessEntity process) { + this.process = process; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskErrorEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskErrorEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskErrorEntity.java new file mode 100644 index 0000000..d269ab7 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskErrorEntity.java @@ -0,0 +1,118 @@ +/* + * + * 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.entities.expcatalog; + +import javax.persistence.*; +import java.util.List; + +@Entity +@Table(name = "EXPCAT_TASK_ERROR") +@IdClass(TaskErrorPK.class) +public class TaskErrorEntity { + private String errorId; + private String taskId; + private long creationTime; + private String actualErrorMessage; + private String userFriendlyMessage; + private boolean transientOrPersistent; + private List<String> rootCauseErrorIdList; + + private TaskEntity task; + + @Id + @Column(name = "ERROR_ID") + public String getErrorId() { + return errorId; + } + + public void setErrorId(String errorId) { + this.errorId = errorId; + } + + @Id + @Column(name = "TASK_ID") + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + @Column(name = "CREATION_TIME") + public long getCreationTime() { + return creationTime; + } + + public void setCreationTime(long creationTime) { + this.creationTime = creationTime; + } + + @Column(name = "ACTUAL_ERROR_MESSAGE") + public String getActualErrorMessage() { + return actualErrorMessage; + } + + public void setActualErrorMessage(String actualErrorMessage) { + this.actualErrorMessage = actualErrorMessage; + } + + @Column(name = "USER_FRIENDLY_MESSAGE") + public String getUserFriendlyMessage() { + return userFriendlyMessage; + } + + public void setUserFriendlyMessage(String userFriendlyMessage) { + this.userFriendlyMessage = userFriendlyMessage; + } + + + @Column(name = "TRANSIENT_OR_PERSISTENT") + public boolean isTransientOrPersistent() { + return transientOrPersistent; + } + + public void setTransientOrPersistent(boolean transientOrPersistent) { + this.transientOrPersistent = transientOrPersistent; + } + + + @ElementCollection + @CollectionTable(name="EXPCAT_EXPERIMENT_ERROR_ROOT_CAUSE_ERROR_ID", joinColumns = @JoinColumn(name="ERROR_ID")) + public List<String> getRootCauseErrorIdList() { + return rootCauseErrorIdList; + } + + public void setRootCauseErrorIdList(List<String> rootCauseErrorIdList) { + this.rootCauseErrorIdList = rootCauseErrorIdList; + } + + + @ManyToOne(targetEntity = TaskEntity.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "TASK_ID", referencedColumnName = "TASK_ID") + public TaskEntity getTask() { + return task; + } + + public void setTask(TaskEntity task) { + this.task = task; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskErrorPK.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskErrorPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskErrorPK.java new file mode 100644 index 0000000..e504f83 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskErrorPK.java @@ -0,0 +1,75 @@ +/* + * + * 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.entities.expcatalog; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +public class TaskErrorPK implements Serializable { + private final static Logger logger = LoggerFactory.getLogger(TaskErrorPK.class); + private String errorId; + private String taskId; + + @Column(name = "ERROR_ID") + @Id + public String getErrorId() { + return errorId; + } + + public void setErrorId(String errorId) { + this.errorId = errorId; + } + + @Column(name = "TASK_ID") + @Id + public String getTaskId() { + return taskId; + } + + public void setTaskId(String processId) { + this.taskId = taskId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + TaskErrorPK that = (TaskErrorPK) o; + + if (getErrorId() != null ? !getErrorId().equals(that.getErrorId()) : that.getErrorId() != null) return false; + if (getTaskId() != null ? !getTaskId().equals(that.getTaskId()) : that.getTaskId() != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = getErrorId() != null ? getErrorId().hashCode() : 0; + result = 31 * result + (getTaskId() != null ? getTaskId().hashCode() : 0); + return result; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskStatusEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskStatusEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskStatusEntity.java new file mode 100644 index 0000000..2465b48 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskStatusEntity.java @@ -0,0 +1,83 @@ +/* + * + * 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.entities.expcatalog; + +import javax.persistence.*; + +@Entity +@Table(name = "EXPCAT_TASK_STATUS") +@IdClass(TaskStatusPK.class) +public class TaskStatusEntity { + private String taskId; + private String state; + private long timeOfStateChange; + private String reason; + + private TaskEntity task; + + @Id + @Column(name = "TASK_ID") + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + @Id + @Column(name = "STATE") + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + @Column(name = "TIME_OF_STATE_CHANGE") + public long getTimeOfStateChange() { + return timeOfStateChange; + } + + public void setTimeOfStateChange(long timeOfStateChange) { + this.timeOfStateChange = timeOfStateChange; + } + + @Column(name = "REASON") + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + @ManyToOne(targetEntity = TaskEntity.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "TASK_ID", referencedColumnName = "TASK_ID") + public TaskEntity getTask() { + return task; + } + + public void setTask(TaskEntity task) { + this.task = task; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskStatusPK.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskStatusPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskStatusPK.java new file mode 100644 index 0000000..167d8a7 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/TaskStatusPK.java @@ -0,0 +1,74 @@ +/* + * + * 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.entities.expcatalog; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +public class TaskStatusPK implements Serializable { + private final static Logger logger = LoggerFactory.getLogger(TaskStatusPK.class); + private String state; + private String taskId; + + @Id + @Column(name = "STATUS_ID") + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + @Id + @Column(name = "TASK_ID") + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + TaskStatusPK that = (TaskStatusPK) o; + + if (getState() != null ? !getState().equals(that.getState()) : that.getState() != null) return false; + if (getTaskId() != null ? !getTaskId().equals(that.getTaskId()) : that.getTaskId() != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = getState() != null ? getState().hashCode() : 0; + result = 31 * result + (getTaskId() != null ? getTaskId().hashCode() : 0); + return result; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/UserConfigurationEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/UserConfigurationEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/UserConfigurationEntity.java new file mode 100644 index 0000000..b685312 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/UserConfigurationEntity.java @@ -0,0 +1,131 @@ +/* + * + * 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.entities.expcatalog; + +import javax.persistence.*; + +@Entity +@Table(name = "EXPCAT_USER_CONFIGURATION") +public class UserConfigurationEntity { + private String experimentId; + private boolean airavataAutoSchedule; + private boolean overrideManualScheduledParams; + private boolean throttleResources; + private String userDN; + private boolean generateCert; + private String storageId; + private String experimentDataDir; + + private ComputeResourceSchedulingEntity computeResourceSchedulingEntity; + private ExperimentEntity experiment; + + @Id + @Column(name = "EXPERIMENT_ID") + public String getExperimentId() { + return experimentId; + } + + public void setExperimentId(String experimentId) { + this.experimentId = experimentId; + } + + @Column(name = "AIRAVATA_AUTO_SCHEDULE") + public boolean isAiravataAutoSchedule() { + return airavataAutoSchedule; + } + + public void setAiravataAutoSchedule(boolean airavataAutoSchedule) { + this.airavataAutoSchedule = airavataAutoSchedule; + } + + @Column(name = "OVERRIDE_MANUAL_SCHEDULED_PARAMS") + public boolean isOverrideManualScheduledParams() { + return overrideManualScheduledParams; + } + + public void setOverrideManualScheduledParams(boolean overrideManualScheduledParams) { + this.overrideManualScheduledParams = overrideManualScheduledParams; + } + + @Column(name = "THROTTLE_RESOURCE") + public boolean isThrottleResources() { + return throttleResources; + } + + public void setThrottleResources(boolean throttleResources) { + this.throttleResources = throttleResources; + } + + @Column(name = "USER_DN") + public String getUserDN() { + return userDN; + } + + public void setUserDN(String userDN) { + this.userDN = userDN; + } + + @Column(name = "GENERATE_CERT") + public boolean isGenerateCert() { + return generateCert; + } + + public void setGenerateCert(boolean generateCert) { + this.generateCert = generateCert; + } + + @Column(name = "STORAGE_ID") + public String getStorageId() { + return storageId; + } + + public void setStorageId(String storageId) { + this.storageId = storageId; + } + + @Column(name = "EXPERIMENT_DATA_DIR") + public String getExperimentDataDir() { + return experimentDataDir; + } + + public void setExperimentDataDir(String experimentDataDir) { + this.experimentDataDir = experimentDataDir; + } + + @OneToOne(targetEntity = ComputeResourceSchedulingEntity.class, cascade = CascadeType.ALL, mappedBy = "userConfiguration") + public ComputeResourceSchedulingEntity getComputeResourceSchedulingEntity() { + return computeResourceSchedulingEntity; + } + + public void setComputeResourceSchedulingEntity(ComputeResourceSchedulingEntity computeResourceSchedulingEntity) { + this.computeResourceSchedulingEntity = computeResourceSchedulingEntity; + } + + @OneToOne(targetEntity = ExperimentEntity.class, cascade = CascadeType.ALL) + @PrimaryKeyJoinColumn(name = "EXPERIMENT_ID", referencedColumnName = "EXPERIMENT_ID") + public ExperimentEntity getExperiment() { + return experiment; + } + + public void setExperiment(ExperimentEntity experiment) { + this.experiment = experiment; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/GatewayEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/GatewayEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/GatewayEntity.java new file mode 100644 index 0000000..c4f1f59 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/GatewayEntity.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.entities.workspacecatalog; + +import javax.persistence.*; + +@Entity +@Table(name="WORKSPACE_GATEWAY") +public class GatewayEntity { + private String gatewayId; + private String gatewayName; + private String domain; + private String emailAddress; + private String gatewayApprovalStatus; + private String gatewayAcronym; + private String gatewayUrl; + private String gatewayPublicAbstract; + private String reviewProposalDescription; + private String gatewayAdminFirstName; + private String getGatewayAdminLastName; + private String gatewayAdminEmail; + private String identityServerUserName; + private String identityServerPasswordToken; + private String declinedReason; + private String oauthClientId; + private String getOauthClientSecret; + private long requestCreationTime; + private String requesterUsername; + + @Id + @Column(name = "GATEWAY_ID") + public String getGatewayId() { + return gatewayId; + } + + public void setGatewayId(String id) { + this.gatewayId = id; + } + + @Column(name = "GATEWAY_NAME") + public String getGatewayName() { + return gatewayName; + } + + public void setGatewayName(String gatewayName) { + this.gatewayName = gatewayName; + } + + @Column(name = "GATEWAY_DOMAIN") + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + @Column(name = "EMAIL_ADDRESS") + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + @Column(name = "GATEWAY_APPROVAL_STATUS") + public String getGatewayApprovalStatus() { + return gatewayApprovalStatus; + } + + public void setGatewayApprovalStatus(String gatewayApprovalStatus) { + this.gatewayApprovalStatus = gatewayApprovalStatus; + } + + @Column(name = "GATEWAY_ACRONYM") + public String getGatewayAcronym() { + return gatewayAcronym; + } + + public void setGatewayAcronym(String gatewayAcronym) { + this.gatewayAcronym = gatewayAcronym; + } + + @Column(name = "GATEWAY_URL") + public String getGatewayUrl() { + return gatewayUrl; + } + + public void setGatewayUrl(String gatewayUrl) { + this.gatewayUrl = gatewayUrl; + } + + @Lob + @Column(name = "GATEWAY_PUBLIC_ABSTRACT") + public String getGatewayPublicAbstract() { + return gatewayPublicAbstract; + } + + public void setGatewayPublicAbstract(String gatewayPublicAbstract) { + this.gatewayPublicAbstract = gatewayPublicAbstract; + } + + @Lob + @Column(name = "REVIEW_PROPOSAL_DESCRIPTION") + public String getReviewProposalDescription() { + return reviewProposalDescription; + } + + public void setReviewProposalDescription(String reviewProposalDescription) { + this.reviewProposalDescription = reviewProposalDescription; + } + + @Column(name = "GATEWAY_ADMIN_FIRST_NAME") + public String getGatewayAdminFirstName() { + return gatewayAdminFirstName; + } + + public void setGatewayAdminFirstName(String gatewayAdminFirstName) { + this.gatewayAdminFirstName = gatewayAdminFirstName; + } + + @Column(name = "GATEWAY_ADMIN_LAST_NAME") + public String getGetGatewayAdminLastName() { + return getGatewayAdminLastName; + } + + public void setGetGatewayAdminLastName(String getGatewayAdminLastName) { + this.getGatewayAdminLastName = getGatewayAdminLastName; + } + + @Column(name = "GATEWAY_ADMIN_EMAIL") + public String getGatewayAdminEmail() { + return gatewayAdminEmail; + } + + public void setGatewayAdminEmail(String gatewayAdminEmail) { + this.gatewayAdminEmail = gatewayAdminEmail; + } + + @Column(name = "IDENTITY_SERVER_USERNAME") + public String getIdentityServerUserName() { + return identityServerUserName; + } + + public void setIdentityServerUserName(String identityServerUserName) { + this.identityServerUserName = identityServerUserName; + } + + @Column(name = "IDENTITY_SERVER_PASSWORD_TOKEN") + public String getIdentityServerPasswordToken() { + return identityServerPasswordToken; + } + + public void setIdentityServerPasswordToken(String identityServerPasswordToken) { + this.identityServerPasswordToken = identityServerPasswordToken; + } + + @Column(name = "REQUESTER_USERNAME") + public String getRequesterUsername() { + return requesterUsername; + } + + public void setRequesterUsername(String requesterUsername) { + this.requesterUsername = requesterUsername; + } + + @Column(name = "DECLINED_REASON") + public String getDeclinedReason() { + return declinedReason; + } + + public void setDeclinedReason(String declinedReason) { + this.declinedReason = declinedReason; + } + + @Column(name = "OAUTH_CLIENT_ID") + public String getOauthClientId() { + return oauthClientId; + } + + public void setOauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + } + + @Column(name = "REQUEST_CREATION_TIME") + public long getRequestCreationTime() { + return requestCreationTime; + } + + public void setRequestCreationTime(long requestCreationTime) { + this.requestCreationTime = requestCreationTime; + } + + @Column(name = "OAUTH_CLIENT_SECRET") + public String getGetOauthClientSecret() { + return getOauthClientSecret; + } + + public void setGetOauthClientSecret(String oauthClientSecret) { + this.getOauthClientSecret = oauthClientSecret; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NSFDemographicsEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NSFDemographicsEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NSFDemographicsEntity.java new file mode 100644 index 0000000..0bcbafa --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NSFDemographicsEntity.java @@ -0,0 +1,94 @@ +/* + * + * 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.entities.workspacecatalog; + +import javax.persistence.*; +import java.util.List; + +@Entity +@Table(name = "WORKSPACE_NSF_DEMOGRAPHIC") +public class NSFDemographicsEntity { + private String airavataInternalUserId; + private String gender; + private List<String> ethnicities; + private List<String> races; + private List<String> disabilities; + private UserProfileEntity userProfile; + + @Id + @Column(name = "AIRAVATA_INTERNAL_USER_ID") + public String getAiravataInternalUserId() { + return airavataInternalUserId; + } + + public void setAiravataInternalUserId(String userId) { + this.airavataInternalUserId = userId; + } + + @Column(name = "GENDER") + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + @ElementCollection + @CollectionTable(name="NSF_DEMOGRAPHIC_ETHNICITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID")) + public List<String> getEthnicities() { + return ethnicities; + } + + public void setEthnicities(List<String> ethnicities) { + this.ethnicities = ethnicities; + } + + @ElementCollection + @CollectionTable(name="NSF_DEMOGRAPHIC_RACE", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID")) + public List<String> getRaces() { + return races; + } + + public void setRaces(List<String> races) { + this.races = races; + } + + @ElementCollection + @CollectionTable(name="NSF_DEMOGRAPHIC_DISABILITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID")) + public List<String> getDisabilities() { + return disabilities; + } + + public void setDisabilities(List<String> disabilities) { + this.disabilities = disabilities; + } + + @OneToOne(targetEntity = UserProfileEntity.class, cascade = CascadeType.ALL) + @PrimaryKeyJoinColumn(name = "AIRAVATA_INTERNAL_USER_ID", referencedColumnName = "AIRAVATA_INTERNAL_USER_ID") + public UserProfileEntity getUserProfile() { + return userProfile; + } + + public void setUserProfile(UserProfileEntity userProfile) { + this.userProfile = userProfile; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NotificationEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NotificationEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NotificationEntity.java new file mode 100644 index 0000000..67f8af2 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/NotificationEntity.java @@ -0,0 +1,110 @@ +/* + * + * 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.entities.workspacecatalog; + +import javax.persistence.*; + +@Entity +@Table(name = "WORKSPACE_NOTIFICATION") +public class NotificationEntity { + private String notificationId; + private String gatewayId; + private String title; + private String notificationMessage; + private long creationTime; + private long publishedTime; + private long expirationTime; + private String priority; + + @Id + @Column(name = "NOTIFICATION_ID") + public String getNotificationId() { + return notificationId; + } + + public void setNotificationId(String notificationId) { + this.notificationId = notificationId; + } + + @Column(name = "GATEWAY_ID") + public String getGatewayId() { + return gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + @Column(name = "TITLE") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + @Lob + @Column(name = "NOTIFICATION_MESSAGE") + public String getNotificationMessage() { + return notificationMessage; + } + + public void setNotificationMessage(String notificationMessage) { + this.notificationMessage = notificationMessage; + } + + @Column(name = "CREATION_TIME") + public long getCreationTime() { + return creationTime; + } + + public void setCreationTime(long creationTime) { + this.creationTime = creationTime; + } + + @Column(name = "PUBLISHED_TIME") + public long getPublishedTime() { + return publishedTime; + } + + public void setPublishedTime(long publishedTime) { + this.publishedTime = publishedTime; + } + + @Column(name = "EXPIRATION_TIME") + public long getExpirationTime() { + return expirationTime; + } + + public void setExpirationTime(long expirationTime) { + this.expirationTime = expirationTime; + } + + @Column(name = "PRIORITY") + public String getPriority() { + return priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/ProjectEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/ProjectEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/ProjectEntity.java new file mode 100644 index 0000000..31e0868 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/ProjectEntity.java @@ -0,0 +1,92 @@ +/* + * + * 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.entities.workspacecatalog; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "WORKSPACE_PROJECT") +public class ProjectEntity { + private String projectID; + private String owner; + private String gatewayId; + private String name; + private String description; + private long creationTime; + + @Id + @Column(name = "PROJECT_ID") + public String getProjectID() { + return projectID; + } + + public void setProjectID(String projectID) { + this.projectID = projectID; + } + + @Column(name = "OWNER") + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + @Column(name = "GATEWAY_ID") + public String getGatewayId() { + return gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + @Column(name = "PROJECT_NAME") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Column(name = "DESCRIPTION") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Column(name = "CREATION_TIME") + public long getCreationTime() { + return creationTime; + } + + public void setCreationTime(long creationTime) { + this.creationTime = creationTime; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/UserProfileEntity.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/UserProfileEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/UserProfileEntity.java new file mode 100644 index 0000000..7dd51ed --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workspacecatalog/UserProfileEntity.java @@ -0,0 +1,247 @@ +/* + * + * 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.entities.workspacecatalog; + +import javax.persistence.*; +import java.util.List; + +@Entity +@Table(name="WORKSPACE_USER_PROFILE") +public class UserProfileEntity { + private String airavataInternalUserId; + private String userId; + private String gatewayId; + private String userModelVersion; + private String userName; + private String orcidId; + private String country; + private String homeOrganization; + private String orginationAffiliation; + private long creationTime; + private long lastAccessTime; + private long validUntil; + private String state; + private String comments; + private List<String> labeledURI; + private String gpgKey; + private String timeZone; + + private List<String> nationality; + private List<String> emails; + private List<String> phones; + private NSFDemographicsEntity nsfDemographics; + + @Id + @Column(name = "AIRAVATA_INTERNAL_USER_ID") + public String getAiravataInternalUserId() { + return airavataInternalUserId; + } + + public void setAiravataInternalUserId(String id) { + this.airavataInternalUserId = id; + } + + @Column(name = "USER_ID") + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + @Column(name = "GATEWAY_ID") + public String getGatewayId() { + return gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + @Column(name = "USER_MODEL_VERSION") + public String getUserModelVersion() { + return userModelVersion; + } + + public void setUserModelVersion(String userModelVersion) { + this.userModelVersion = userModelVersion; + } + + @ElementCollection + @CollectionTable(name="USER_PROFILE_EMAIL", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID")) + public List<String> getEmails() { + return emails; + } + + public void setEmails(List<String> emails) { + this.emails = emails; + } + + @Column(name = "USER_NAME") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + @Column(name = "ORCID_ID") + public String getOrcidId() { + return orcidId; + } + + public void setOrcidId(String orcidId) { + this.orcidId = orcidId; + } + + @ElementCollection + @CollectionTable(name="USER_PROFILE_PHONE", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID")) + public List<String> getPhones() { + return phones; + } + + public void setPhones(List<String> phones) { + this.phones = phones; + } + + @Column(name = "COUNTRY") + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + @ElementCollection + @CollectionTable(name="USER_PROFILE_NATIONALITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID")) + public List<String> getNationality() { + return nationality; + } + + public void setNationality(List<String> nationality) { + this.nationality = nationality; + } + + @Column(name = "HOME_ORGANIZATION") + public String getHomeOrganization() { + return homeOrganization; + } + + public void setHomeOrganization(String homeOrganization) { + this.homeOrganization = homeOrganization; + } + + @Column(name = "ORIGINATION_AFFILIATION") + public String getOrginationAffiliation() { + return orginationAffiliation; + } + + public void setOrginationAffiliation(String orginationAffiliation) { + this.orginationAffiliation = orginationAffiliation; + } + + @Column(name="CREATION_TIME") + public long getCreationTime() { + return creationTime; + } + + public void setCreationTime(long creationTime) { + this.creationTime = creationTime; + } + + @Column(name = "LAST_ACCESS_TIME") + public long getLastAccessTime() { + return lastAccessTime; + } + + public void setLastAccessTime(long lastAccessTime) { + this.lastAccessTime = lastAccessTime; + } + + @Column(name = "VALID_UNTIL") + public long getValidUntil() { + return validUntil; + } + + public void setValidUntil(long validUntil) { + this.validUntil = validUntil; + } + + @Column(name = "STATE") + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + @Lob + @Column(name = "COMMENTS") + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + @ElementCollection + @CollectionTable(name="USER_PROFILE_LABELED_URI", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID")) + public List<String> getLabeledURI() { + return labeledURI; + } + + public void setLabeledURI(List<String> labeledURI) { + this.labeledURI = labeledURI; + } + + @Lob + @Column(name = "GPG_KEY") + public String getGpgKey() { + return gpgKey; + } + + public void setGpgKey(String gpgKey) { + this.gpgKey = gpgKey; + } + + @Column(name = "TIME_ZONE") + public String getTimeZone() { + return timeZone; + } + + public void setTimeZone(String timeZone) { + this.timeZone = timeZone; + } + + @OneToOne(targetEntity = NSFDemographicsEntity.class, cascade = CascadeType.ALL, mappedBy = "userProfile") + public NSFDemographicsEntity getNsfDemographics() { + return nsfDemographics; + } + + public void setNsfDemographics(NSFDemographicsEntity nsfDemographics) { + this.nsfDemographics = nsfDemographics; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java new file mode 100644 index 0000000..a83928d --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java @@ -0,0 +1,98 @@ +/* + * + * 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.repositories; + +import org.apache.airavata.registry.core.utils.JPAUtils; +import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; +import org.dozer.Mapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.persistence.Query; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public abstract class AbstractRepository<T, E, Id> { + private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class); + + private Class<T> thriftGenericClass; + private Class<E> dbEntityGenericClass; + + public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass) { + this.thriftGenericClass = thriftGenericClass; + this.dbEntityGenericClass = dbEntityGenericClass; + } + + public T create(T t) { + return update(t); + } + + public T update(T t) { + Mapper mapper = ObjectMapperSingleton.getInstance(); + E entity = mapper.map(t, dbEntityGenericClass); + E persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(entity)); + return mapper.map(persistedCopy, thriftGenericClass); + } + + public boolean delete(Id id) { + JPAUtils.execute(entityManager -> { + E entity = entityManager.find(dbEntityGenericClass, id); + entityManager.remove(entity); + return entity; + }); + return true; + } + + public T get(Id id) { + E entity = JPAUtils.execute(entityManager -> entityManager + .find(dbEntityGenericClass, id)); + Mapper mapper = ObjectMapperSingleton.getInstance(); + return mapper.map(entity, thriftGenericClass); + } + + public List<T> select(String query, int limit, int offset) { + List resultSet = (List) JPAUtils.execute(entityManager -> entityManager.createQuery(query).setFirstResult(offset) + .setMaxResults(offset).getResultList()); + Mapper mapper = ObjectMapperSingleton.getInstance(); + List<T> gatewayList = new ArrayList<>(); + resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass))); + return gatewayList; + } + + public List<T> select(String query, int limit, int offset, Map<String, Object> queryParams) { + List resultSet = (List) JPAUtils.execute(entityManager -> { + Query jpaQuery = entityManager.createQuery(query); + + for (Map.Entry<String, Object> entry : queryParams.entrySet()) { + + jpaQuery.setParameter(entry.getKey(), entry.getValue()); + } + + return jpaQuery.setFirstResult(offset).setMaxResults(limit).getResultList(); + + }); + Mapper mapper = ObjectMapperSingleton.getInstance(); + List<T> gatewayList = new ArrayList<>(); + resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass))); + return gatewayList; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/208e5d38/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java ---------------------------------------------------------------------- diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java new file mode 100644 index 0000000..a79a462 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java @@ -0,0 +1,101 @@ +/* + * + * 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.repositories.expcatalog; + +import org.apache.airavata.model.experiment.ExperimentModel; +import org.apache.airavata.registry.core.entities.expcatalog.ExperimentEntity; +import org.apache.airavata.registry.core.repositories.AbstractRepository; +import org.apache.airavata.registry.core.utils.JPAUtils; +import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; +import org.dozer.Mapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +public class ExperimentRepository extends AbstractRepository<ExperimentModel, ExperimentEntity, String> { + private final static Logger logger = LoggerFactory.getLogger(ExperimentRepository.class); + + public ExperimentRepository(Class<ExperimentModel> thriftGenericClass, Class<ExperimentEntity> dbEntityGenericClass) { + super(thriftGenericClass, dbEntityGenericClass); + } + + @Override + public ExperimentModel create(ExperimentModel experiment){ + return update(experiment); + } + + @Override + public ExperimentModel update(ExperimentModel experiment){ + String experimentId = experiment.getExperimentId(); + Mapper mapper = ObjectMapperSingleton.getInstance(); + ExperimentEntity entity = mapper.map(experiment, ExperimentEntity.class); + + if(entity.getUserConfigurationData() != null) { + entity.getUserConfigurationData().setExperimentId(experimentId); + if (entity.getUserConfigurationData().getComputeResourceSchedulingEntity() != null) + entity.getUserConfigurationData().getComputeResourceSchedulingEntity().setExperimentId(experimentId); + } + if(entity.getExperimentInputs() != null) + entity.getExperimentInputs().forEach(expIn->expIn.setExperimentId(experimentId)); + if(entity.getExperimentOutputs() != null) + entity.getExperimentOutputs().forEach(expOut->expOut.setExperimentId(experimentId)); + if(entity.getExperimentErrors() != null) + entity.getExperimentErrors().forEach(expErr->expErr.setExperimentId(experimentId)); + if(entity.getExperimentStatuses() != null) + entity.getExperimentStatuses().forEach(expStatus->expStatus.setExperimentId(experimentId)); + + if(entity.getProcesses() != null){ + entity.getProcesses().forEach(process->{ + process.setExperimentId(experimentId); + String processId = process.getProcessId(); + if(process.getProcessResourceSchedule() != null) + process.getProcessResourceSchedule().setProcessId(processId); + if(process.getProcessInputs() != null) + process.getProcessInputs().forEach(proInput->proInput.setProceseId(processId)); + if(process.getProcessOutputs() != null) + process.getProcessOutputs().forEach(proOutput->proOutput.setProcessId(processId)); + if(process.getProcessErrors() != null) + process.getProcessErrors().forEach(processErr->processErr.setProcessId(processId)); + if(process.getProcessStatuses() != null) + process.getProcessStatuses().forEach(processStat->processStat.setProcessId(processId)); + + if(process.getTasks() != null){ + process.getTasks().forEach(task->{ + String taskId = task.getTaskId(); + task.setParentProcessId(processId); + + + }); + } + }); + } + + ExperimentEntity persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(entity)); + return mapper.map(persistedCopy, ExperimentModel.class); + } + + @Override + public List<ExperimentModel> select(String criteria, int offset, int limit){ + throw new UnsupportedOperationException("Due to performance overheads this method is not supported. Instead use" + + " ExperimentSummaryRepository"); + } +} \ No newline at end of file
