From ec2ecffa89af4b064c23f0f3342da8da83191754 Mon Sep 17 00:00:00 2001 From: Abhiit Karanjkar Date: Fri, 30 Sep 2016 10:01:11 -0400 Subject: [PATCH 1/3] Workflow catalog Entities --- .../ComponentStatusEntity.java | 74 +++++++++ .../entities/workflowcatalog/EdgeEntity.java | 83 ++++++++++ .../core/entities/workflowcatalog/EdgePK.java | 60 +++++++ .../entities/workflowcatalog/NodeEntity.java | 105 ++++++++++++ .../core/entities/workflowcatalog/NodePK.java | 60 +++++++ .../entities/workflowcatalog/PortEntity.java | 84 ++++++++++ .../core/entities/workflowcatalog/PortPK.java | 61 +++++++ .../workflowcatalog/WorkflowEntity.java | 127 +++++++++++++++ .../workflowcatalog/WorkflowInputEntity.java | 150 ++++++++++++++++++ .../workflowcatalog/WorkflowInputPK.java | 64 ++++++++ .../workflowcatalog/WorkflowOutputEntity.java | 140 ++++++++++++++++ .../workflowcatalog/WorkflowOutputPK.java | 61 +++++++ .../workflowcatalog/WorkflowStatusEntity.java | 73 +++++++++ .../workflowcatalog/WorkflowStatusPK.java | 60 +++++++ 14 files changed, 1202 insertions(+) create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/ComponentStatusEntity.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/EdgeEntity.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/EdgePK.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/NodeEntity.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/NodePK.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/PortEntity.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/PortPK.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowEntity.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowInputEntity.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowInputPK.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowOutputEntity.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowOutputPK.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowStatusEntity.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowStatusPK.java diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/ComponentStatusEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/ComponentStatusEntity.java new file mode 100644 index 0000000000..da94a0f1bf --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/ComponentStatusEntity.java @@ -0,0 +1,74 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; +import java.sql.Timestamp; + + +/** + * The persistent class for the component_status database table. + */ +@Entity +@Table(name = "component_status") +public class ComponentStatusEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "STATUS_ID") + private String statusId; + + @Column(name = "REASON") + private String reason; + + @Column(name = "STATE") + private String state; + + @Column(name = "UPDATE_TIME") + private Timestamp updateTime; + + @Column(name = "TEMPLATE_ID") + private String templateId; + + public ComponentStatusEntity() { + } + + public String getStatusId() { + return statusId; + } + + public void setStatusId(String statusId) { + this.statusId = statusId; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/EdgeEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/EdgeEntity.java new file mode 100644 index 0000000000..4f6915a367 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/EdgeEntity.java @@ -0,0 +1,83 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; +import java.sql.Timestamp; + + +/** + * The persistent class for the edge database table. + */ +@Entity +public class EdgeEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @EmbeddedId + private EdgePK id; + + @Column(name = "COMPONENT_STATUS_ID") + private String componentStatusId; + + @Column(name = "CREATED_TIME") + private Timestamp createdTime; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "NAME") + private String name; + + @Column(name = "TEMPLATE_ID") + private String templateId; + + public EdgeEntity() { + } + + public EdgePK getId() { + return id; + } + + public void setId(EdgePK id) { + this.id = id; + } + + public String getComponentStatusId() { + return componentStatusId; + } + + public void setComponentStatusId(String componentStatusId) { + this.componentStatusId = componentStatusId; + } + + public Timestamp getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Timestamp createdTime) { + this.createdTime = createdTime; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/EdgePK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/EdgePK.java new file mode 100644 index 0000000000..fb73ca4ff3 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/EdgePK.java @@ -0,0 +1,60 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; + +/** + * The primary key class for the edge database table. + */ +@Embeddable +public class EdgePK implements Serializable { + //default serial version id, required for serializable classes. + private static final long serialVersionUID = 1L; + + @Column(name = "EDGE_ID") + private String edgeId; + + @Column(name = "TEMPLATE_ID", insertable = false, updatable = false) + private String templateId; + + public EdgePK() { + } + + public String getEdgeId() { + return edgeId; + } + + public void setEdgeId(String edgeId) { + this.edgeId = edgeId; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof EdgePK)) { + return false; + } + EdgePK castOther = (EdgePK) other; + return + this.edgeId.equals(castOther.edgeId) + && this.templateId.equals(castOther.templateId); + } + + public int hashCode() { + final int prime = 31; + int hash = 17; + hash = hash * prime + this.edgeId.hashCode(); + hash = hash * prime + this.templateId.hashCode(); + + return hash; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/NodeEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/NodeEntity.java new file mode 100644 index 0000000000..db0045ceb8 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/NodeEntity.java @@ -0,0 +1,105 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; +import java.sql.Timestamp; + + +/** + * The persistent class for the node database table. + */ +@Entity +public class NodeEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @EmbeddedId + private NodePK id; + + @Column(name = "APPLICATION_ID") + private String applicationId; + + @Column(name = "APPLICATION_NAME") + private String applicationName; + + @Column(name = "COMPONENT_STATUS_ID") + private String componentStatusId; + + @Column(name = "CREATED_TIME") + private Timestamp createdTime; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "NAME") + private String name; + + @Column(name = "TEMPLATE_ID") + private String templateId; + + public NodeEntity() { + } + + public NodePK getId() { + return id; + } + + public void setId(NodePK id) { + this.id = id; + } + + public String getApplicationId() { + return applicationId; + } + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + public String getApplicationName() { + return applicationName; + } + + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + public String getComponentStatusId() { + return componentStatusId; + } + + public void setComponentStatusId(String componentStatusId) { + this.componentStatusId = componentStatusId; + } + + public Timestamp getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Timestamp createdTime) { + this.createdTime = createdTime; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/NodePK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/NodePK.java new file mode 100644 index 0000000000..64c796d42c --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/NodePK.java @@ -0,0 +1,60 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; + +/** + * The primary key class for the node database table. + */ +@Embeddable +public class NodePK implements Serializable { + //default serial version id, required for serializable classes. + private static final long serialVersionUID = 1L; + + @Column(name = "NODE_ID") + private String nodeId; + + @Column(name = "TEMPLATE_ID", insertable = false, updatable = false) + private String templateId; + + public NodePK() { + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof NodePK)) { + return false; + } + NodePK castOther = (NodePK) other; + return + this.nodeId.equals(castOther.nodeId) + && this.templateId.equals(castOther.templateId); + } + + public int hashCode() { + final int prime = 31; + int hash = 17; + hash = hash * prime + this.nodeId.hashCode(); + hash = hash * prime + this.templateId.hashCode(); + + return hash; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/PortEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/PortEntity.java new file mode 100644 index 0000000000..9243875862 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/PortEntity.java @@ -0,0 +1,84 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; +import java.sql.Timestamp; + + +/** + * The persistent class for the port database table. + */ +@Entity +public class PortEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @EmbeddedId + private PortPK id; + + @Column(name = "COMPONENT_STATUS_ID") + private String componentStatusId; + + @Column(name = "CREATED_TIME") + private Timestamp createdTime; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "NAME") + private String name; + + @Column(name = "TEMPLATE_ID") + private String templateId; + + public PortEntity() { + } + + + public PortPK getId() { + return id; + } + + public void setId(PortPK id) { + this.id = id; + } + + public String getComponentStatusId() { + return componentStatusId; + } + + public void setComponentStatusId(String componentStatusId) { + this.componentStatusId = componentStatusId; + } + + public Timestamp getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Timestamp createdTime) { + this.createdTime = createdTime; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/PortPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/PortPK.java new file mode 100644 index 0000000000..d62be0b5ce --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/PortPK.java @@ -0,0 +1,61 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; + +/** + * The primary key class for the port database table. + * + */ +@Embeddable +public class PortPK implements Serializable { + //default serial version id, required for serializable classes. + private static final long serialVersionUID = 1L; + + @Column(name="PORT_ID") + private String portId; + + @Column(name="TEMPLATE_ID", insertable=false, updatable=false) + private String templateId; + + public PortPK() { + } + + public String getPortId() { + return portId; + } + + public void setPortId(String portId) { + this.portId = portId; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof PortPK)) { + return false; + } + PortPK castOther = (PortPK)other; + return + this.portId.equals(castOther.portId) + && this.templateId.equals(castOther.templateId); + } + + public int hashCode() { + final int prime = 31; + int hash = 17; + hash = hash * prime + this.portId.hashCode(); + hash = hash * prime + this.templateId.hashCode(); + + return hash; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowEntity.java new file mode 100644 index 0000000000..d1d8c4618e --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowEntity.java @@ -0,0 +1,127 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; +import java.sql.Timestamp; +import java.util.List; + + +/** + * The persistent class for the workflow database table. + */ +@Entity +public class WorkflowEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TEMPLATE_ID") + private String templateId; + + @Column(name = "CREATED_USER") + private String createdUser; + + @Column(name = "CREATION_TIME") + private Timestamp creationTime; + + @Column(name = "GATEWAY_ID") + private String gatewayId; + + @Column(name = "GRAPH") + private String graph; + + @Column(name = "IMAGE") + @Lob + private byte[] image; + + @Column(name = "UPDATE_TIME") + private Timestamp updateTime; + + @Column(name = "WORKFLOW_NAME") + private String workflowName; + + + public WorkflowEntity() { + } + + public String getTemplateId() { + + return this.templateId; + } + + public void setTemplateId(String templateId) { + + this.templateId = templateId; + } + + public String getCreatedUser() { + + return this.createdUser; + } + + public void setCreatedUser(String createdUser) { + + this.createdUser = createdUser; + } + + public Timestamp getCreationTime() { + + return this.creationTime; + } + + public void setCreationTime(Timestamp creationTime) { + + this.creationTime = creationTime; + } + + public String getGatewayId() { + + return this.gatewayId; + } + + public void setGatewayId(String gatewayId) { + + this.gatewayId = gatewayId; + } + + public String getGraph() { + + return this.graph; + } + + public void setGraph(String graph) { + + this.graph = graph; + } + + public byte[] getImage() { + + return this.image; + } + + public void setImage(byte[] image) { + + this.image = image; + } + + public Timestamp getUpdateTime() { + + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + + this.updateTime = updateTime; + } + + public String getWorkflowName() { + + return this.workflowName; + } + + public void setWorkflowName(String workflowName) { + + this.workflowName = workflowName; + } + + +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowInputEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowInputEntity.java new file mode 100644 index 0000000000..a607ae1e5c --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowInputEntity.java @@ -0,0 +1,150 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the workflow_input database table. + */ +@Entity +@Table(name = "workflow_input") +public class WorkflowInputEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @EmbeddedId + private WorkflowInputPK id; + + @Column(name = "APP_ARGUMENT") + private String appArgument; + + @Column(name = "DATA_STAGED") + private short dataStaged; + + @Column(name = "DATA_TYPE") + private String dataType; + + @Column(name = "INPUT_ORDER") + private int inputOrder; + + @Column(name = "INPUT_VALUE") + private String inputValue; + + @Column(name = "IS_REQUIRED") + private short isRequired; + + @Column(name = "METADATA") + private String metadata; + + @Column(name = "REQUIRED_TO_COMMANDLINE") + private short requiredToCommandline; + + @Column(name = "STANDARD_INPUT") + private short standardInput; + + @Column(name = "USER_FRIENDLY_DESC") + private String userFriendlyDesc; + + + @Column(name = "TEMPLATE_ID") + private String templateId; + + public WorkflowInputEntity() { + } + + public WorkflowInputPK getId() { + return id; + } + + public void setId(WorkflowInputPK id) { + this.id = id; + } + + public String getAppArgument() { + return appArgument; + } + + public void setAppArgument(String appArgument) { + this.appArgument = appArgument; + } + + public short getDataStaged() { + return dataStaged; + } + + public void setDataStaged(short dataStaged) { + this.dataStaged = dataStaged; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public int getInputOrder() { + return inputOrder; + } + + public void setInputOrder(int inputOrder) { + this.inputOrder = inputOrder; + } + + public String getInputValue() { + return inputValue; + } + + public void setInputValue(String inputValue) { + this.inputValue = inputValue; + } + + public short getIsRequired() { + return isRequired; + } + + public void setIsRequired(short isRequired) { + this.isRequired = isRequired; + } + + public String getMetadata() { + return metadata; + } + + public void setMetadata(String metadata) { + this.metadata = metadata; + } + + public short getRequiredToCommandline() { + return requiredToCommandline; + } + + public void setRequiredToCommandline(short requiredToCommandline) { + this.requiredToCommandline = requiredToCommandline; + } + + public short getStandardInput() { + return standardInput; + } + + public void setStandardInput(short standardInput) { + this.standardInput = standardInput; + } + + public String getUserFriendlyDesc() { + return userFriendlyDesc; + } + + public void setUserFriendlyDesc(String userFriendlyDesc) { + this.userFriendlyDesc = userFriendlyDesc; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowInputPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowInputPK.java new file mode 100644 index 0000000000..9f46bd6325 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowInputPK.java @@ -0,0 +1,64 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; + +/** + * The primary key class for the workflow_input database table. + */ +@Embeddable +public class WorkflowInputPK implements Serializable { + //default serial version id, required for serializable classes. + private static final long serialVersionUID = 1L; + + @Column(name = "TEMPLATE_ID", insertable = false, updatable = false) + private String templateId; + + @Column(name = "INPUT_KEY") + private String inputKey; + + public WorkflowInputPK() { + } + + public String getTemplateId() { + + return this.templateId; + } + + public void setTemplateId(String templateId) { + + this.templateId = templateId; + } + + public String getInputKey() { + + return this.inputKey; + } + + public void setInputKey(String inputKey) { + + this.inputKey = inputKey; + } + + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof WorkflowInputPK)) { + return false; + } + WorkflowInputPK castOther = (WorkflowInputPK) other; + return + this.templateId.equals(castOther.templateId) + && this.inputKey.equals(castOther.inputKey); + } + + public int hashCode() { + final int prime = 31; + int hash = 17; + hash = hash * prime + this.templateId.hashCode(); + hash = hash * prime + this.inputKey.hashCode(); + + return hash; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowOutputEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowOutputEntity.java new file mode 100644 index 0000000000..faf1c66ee9 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowOutputEntity.java @@ -0,0 +1,140 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the workflow_output database table. + * + */ +@Entity +@Table(name="workflow_output") +public class WorkflowOutputEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @EmbeddedId + private WorkflowOutputPK id; + + @Column(name="APP_ARGUMENT") + private String appArgument; + + @Column(name="DATA_MOVEMENT") + private short dataMovement; + + @Column(name="DATA_NAME_LOCATION") + private String dataNameLocation; + + @Column(name="DATA_TYPE") + private String dataType; + + @Column(name="IS_REQUIRED") + private short isRequired; + + @Column(name="OUTPUT_STREAMING") + private short outputStreaming; + + @Lob + @Column(name="OUTPUT_VALUE") + private String outputValue; + + @Column(name="REQUIRED_TO_COMMANDLINE") + private short requiredToCommandline; + + @Column(name="SEARCH_QUERY") + private String searchQuery; + + @Column(name="TEMPLATE_ID") + private String templateId; + + public WorkflowOutputEntity() { + } + + public WorkflowOutputPK getId() { + return id; + } + + public void setId(WorkflowOutputPK id) { + this.id = id; + } + + public String getAppArgument() { + return appArgument; + } + + public void setAppArgument(String appArgument) { + this.appArgument = appArgument; + } + + public short getDataMovement() { + return dataMovement; + } + + public void setDataMovement(short dataMovement) { + this.dataMovement = dataMovement; + } + + public String getDataNameLocation() { + return dataNameLocation; + } + + public void setDataNameLocation(String dataNameLocation) { + this.dataNameLocation = dataNameLocation; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public short getIsRequired() { + return isRequired; + } + + public void setIsRequired(short isRequired) { + this.isRequired = isRequired; + } + + public short getOutputStreaming() { + return outputStreaming; + } + + public void setOutputStreaming(short outputStreaming) { + this.outputStreaming = outputStreaming; + } + + public String getOutputValue() { + return outputValue; + } + + public void setOutputValue(String outputValue) { + this.outputValue = outputValue; + } + + public short getRequiredToCommandline() { + return requiredToCommandline; + } + + public void setRequiredToCommandline(short requiredToCommandline) { + this.requiredToCommandline = requiredToCommandline; + } + + public String getSearchQuery() { + return searchQuery; + } + + public void setSearchQuery(String searchQuery) { + this.searchQuery = searchQuery; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowOutputPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowOutputPK.java new file mode 100644 index 0000000000..8c0a9dfb23 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowOutputPK.java @@ -0,0 +1,61 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; + +/** + * The primary key class for the workflow_output database table. + * + */ +@Embeddable +public class WorkflowOutputPK implements Serializable { + //default serial version id, required for serializable classes. + private static final long serialVersionUID = 1L; + + @Column(name="TEMPLATE_ID", insertable=false, updatable=false) + private String templateId; + + @Column(name="OUTPUT_KEY") + private String outputKey; + + public WorkflowOutputPK() { + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public String getOutputKey() { + return outputKey; + } + + public void setOutputKey(String outputKey) { + this.outputKey = outputKey; + } + + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof WorkflowOutputPK)) { + return false; + } + WorkflowOutputPK castOther = (WorkflowOutputPK)other; + return + this.templateId.equals(castOther.templateId) + && this.outputKey.equals(castOther.outputKey); + } + + public int hashCode() { + final int prime = 31; + int hash = 17; + hash = hash * prime + this.templateId.hashCode(); + hash = hash * prime + this.outputKey.hashCode(); + + return hash; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowStatusEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowStatusEntity.java new file mode 100644 index 0000000000..006983c62e --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowStatusEntity.java @@ -0,0 +1,73 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; +import java.sql.Timestamp; + + +/** + * The persistent class for the workflow_status database table. + */ +@Entity +@Table(name = "workflow_status") +public class WorkflowStatusEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @EmbeddedId + private WorkflowStatusPK id; + + @Column(name = "REASON") + private String reason; + + @Column(name = "STATE") + private String state; + + @Column(name = "UPDATE_TIME") + private Timestamp updateTime; + + @Column(name = "TEMPLATE_ID") + private String templateId; + + public WorkflowStatusEntity() { + } + + public WorkflowStatusPK getId() { + return id; + } + + public void setId(WorkflowStatusPK id) { + this.id = id; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public Timestamp getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } +} \ No newline at end of file diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowStatusPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowStatusPK.java new file mode 100644 index 0000000000..76678fa17d --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/workflowcatalog/WorkflowStatusPK.java @@ -0,0 +1,60 @@ +package org.apache.airavata.registry.core.entities.workflowcatalog; + +import java.io.Serializable; +import javax.persistence.*; + +/** + * The primary key class for the workflow_status database table. + */ +@Embeddable +public class WorkflowStatusPK implements Serializable { + //default serial version id, required for serializable classes. + private static final long serialVersionUID = 1L; + + @Column(name = "STATUS_ID") + private String statusId; + + @Column(name = "TEMPLATE_ID", insertable = false, updatable = false) + private String templateId; + + public WorkflowStatusPK() { + } + + public String getStatusId() { + return statusId; + } + + public void setStatusId(String statusId) { + this.statusId = statusId; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof WorkflowStatusPK)) { + return false; + } + WorkflowStatusPK castOther = (WorkflowStatusPK) other; + return + this.statusId.equals(castOther.statusId) + && this.templateId.equals(castOther.templateId); + } + + public int hashCode() { + final int prime = 31; + int hash = 17; + hash = hash * prime + this.statusId.hashCode(); + hash = hash * prime + this.templateId.hashCode(); + + return hash; + } +} \ No newline at end of file From 727dfb733fb18e64219b50b60ce042bc157edfab Mon Sep 17 00:00:00 2001 From: Abhiit Karanjkar Date: Fri, 30 Sep 2016 10:02:33 -0400 Subject: [PATCH 2/3] Workflow Catalog Repositories --- .../ComponentStatusRepository.java | 20 ++++++++++++++++++ .../workflowcatalog/EdgeRepository.java | 21 +++++++++++++++++++ .../workflowcatalog/NodeRepository.java | 21 +++++++++++++++++++ .../workflowcatalog/PortRepository.java | 20 ++++++++++++++++++ .../workflowcatalog/WorkflowRepository.java | 20 ++++++++++++++++++ .../WorkflowStatusRepository.java | 20 ++++++++++++++++++ 6 files changed, 122 insertions(+) create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/ComponentStatusRepository.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/EdgeRepository.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/NodeRepository.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/PortRepository.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowRepository.java create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowStatusRepository.java diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/ComponentStatusRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/ComponentStatusRepository.java new file mode 100644 index 0000000000..8e439e16ae --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/ComponentStatusRepository.java @@ -0,0 +1,20 @@ +package org.apache.airavata.registry.core.repositories.workflowcatalog; + +import org.apache.airavata.model.ComponentStatus; +import org.apache.airavata.registry.core.entities.workflowcatalog.ComponentStatusEntity; +import org.apache.airavata.registry.core.repositories.AbstractRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by abhij on 9/28/2016. + */ +public class ComponentStatusRepository extends AbstractRepository { + + + private final static Logger logger = LoggerFactory.getLogger(ComponentStatusRepository.class); + + public ComponentStatusRepository(Class thriftGenericClass, Class dbEntityGenericClass) { + super(thriftGenericClass, dbEntityGenericClass); + } +} diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/EdgeRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/EdgeRepository.java new file mode 100644 index 0000000000..fece56bbb1 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/EdgeRepository.java @@ -0,0 +1,21 @@ +package org.apache.airavata.registry.core.repositories.workflowcatalog; + +import org.apache.airavata.model.EdgeModel; +import org.apache.airavata.registry.core.entities.workflowcatalog.EdgeEntity; +import org.apache.airavata.registry.core.entities.workflowcatalog.EdgePK; +import org.apache.airavata.registry.core.repositories.AbstractRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by abhij on 9/28/2016. + */ +public class EdgeRepository extends AbstractRepository { + + + private final static Logger logger = LoggerFactory.getLogger(EdgeRepository.class); + + public EdgeRepository(Class thriftGenericClass, Class dbEntityGenericClass) { + super(thriftGenericClass, dbEntityGenericClass); + } +} diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/NodeRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/NodeRepository.java new file mode 100644 index 0000000000..0d914e6ea9 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/NodeRepository.java @@ -0,0 +1,21 @@ +package org.apache.airavata.registry.core.repositories.workflowcatalog; + +import org.apache.airavata.model.NodeModel; +import org.apache.airavata.registry.core.entities.workflowcatalog.NodeEntity; +import org.apache.airavata.registry.core.entities.workflowcatalog.NodePK; +import org.apache.airavata.registry.core.repositories.AbstractRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by abhij on 9/28/2016. + */ +public class NodeRepository extends AbstractRepository { + + + private final static Logger logger = LoggerFactory.getLogger(NodeRepository.class); + + public NodeRepository(Class thriftGenericClass, Class dbEntityGenericClass) { + super(thriftGenericClass, dbEntityGenericClass); + } +} diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/PortRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/PortRepository.java new file mode 100644 index 0000000000..311324a1e7 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/PortRepository.java @@ -0,0 +1,20 @@ +package org.apache.airavata.registry.core.repositories.workflowcatalog; + +import org.apache.airavata.model.PortModel; +import org.apache.airavata.registry.core.entities.workflowcatalog.PortEntity; +import org.apache.airavata.registry.core.entities.workflowcatalog.PortPK; +import org.apache.airavata.registry.core.repositories.AbstractRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by abhij on 9/28/2016. + */ +public class PortRepository extends AbstractRepository { + + private final static Logger logger = LoggerFactory.getLogger(PortRepository.class); + + public PortRepository(Class thriftGenericClass, Class dbEntityGenericClass) { + super(thriftGenericClass, dbEntityGenericClass); + } +} diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowRepository.java new file mode 100644 index 0000000000..25476314db --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowRepository.java @@ -0,0 +1,20 @@ +package org.apache.airavata.registry.core.repositories.workflowcatalog; + +import org.apache.airavata.model.WorkflowModel; +import org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowEntity; +import org.apache.airavata.registry.core.repositories.AbstractRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by abhijit on 9/28/2016. + */ +public class WorkflowRepository extends AbstractRepository { + + private final static Logger logger = LoggerFactory.getLogger(WorkflowRepository.class); + + + public WorkflowRepository(Class thriftGenericClass, Class dbEntityGenericClass) { + super(thriftGenericClass, dbEntityGenericClass); + } +} diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowStatusRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowStatusRepository.java new file mode 100644 index 0000000000..a0a9468108 --- /dev/null +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowStatusRepository.java @@ -0,0 +1,20 @@ +package org.apache.airavata.registry.core.repositories.workflowcatalog; + +import org.apache.airavata.model.WorkflowStatus; +import org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowStatusEntity; +import org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowStatusPK; +import org.apache.airavata.registry.core.repositories.AbstractRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by abhijit on 9/28/2016. + */ +public class WorkflowStatusRepository extends AbstractRepository { + + private final static Logger logger = LoggerFactory.getLogger(WorkflowStatusRepository.class); + + public WorkflowStatusRepository(Class thriftGenericClass, Class dbEntityGenericClass) { + super(thriftGenericClass, dbEntityGenericClass); + } +} From d8cd7ba60ca983f5658f9c405c72501262047c9d Mon Sep 17 00:00:00 2001 From: Abhiit Karanjkar Date: Fri, 30 Sep 2016 10:10:06 -0400 Subject: [PATCH 3/3] Repository Test for Experiment Catalog --- .../core/repositories/RepositoryTest.java | 95 ++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/RepositoryTest.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/RepositoryTest.java index 53d77f17cd..ec1e4a052d 100644 --- a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/RepositoryTest.java +++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/RepositoryTest.java @@ -56,15 +56,19 @@ public class RepositoryTest { private NotificationRepository notificationRepository; private UserProfileRepository userProfileRepository; private ProjectRepository projectRepository; + private ExperimentRepository experimentRepository; private String gatewayId; private String notificationId; private String userId; private String projectId; + private String experimentId; private final String GATEWAY_DOMAIN = "test1.com"; private final String NOTIFY_MESSAGE = "NotifyMe"; private final String USER_COMMENT = "TestComment"; private final String PROJECT_DESCRIPTION = "Test Description"; + private final String EXPERIMENT_NAME = "sample experiment"; + private final String EXPERIMENT_DESCRIPTION = "sample description"; @Before public void setupRepository() { @@ -74,11 +78,13 @@ public void setupRepository() { NotificationEntity.class); userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class); projectRepository = new ProjectRepository(Project.class, ProjectEntity.class); + experimentRepository = new ExperimentRepository(ExperimentModel.class, ExperimentEntity.class); gatewayId = "test.com" + System.currentTimeMillis(); notificationId = UUID.randomUUID().toString(); userId = "testuser" + System.currentTimeMillis(); - projectId = "project" + System.currentTimeMillis();; + projectId = "project" + System.currentTimeMillis(); + experimentId = "exp" + System.currentTimeMillis(); } @@ -287,5 +293,92 @@ public void projectRepositoryTest() { Assert.assertTrue(deleteResult); + } + + @Test + public void experimentRepositoryTest() { + + /* + * Creating Gateway required for UserProfile & Project creation + */ + Gateway gateway = new Gateway(); + gateway.setGatewayApprovalStatus(GatewayApprovalStatus.ACTIVE); + gateway.setGatewayId(gatewayId); + gateway.setDomain(GATEWAY_DOMAIN); + gateway = gatewayRepository.create(gateway); + Assert.assertTrue(!gateway.getGatewayId().isEmpty()); + + /* + * UserProfile Instance creation required for Project Creation + */ + UserProfile userProfile = new UserProfile(); + userProfile.setAiravataInternalUserId(userId); + userProfile.setGatewayId(gateway.getGatewayId()); + userProfile = userProfileRepository.create(userProfile); + Assert.assertTrue(!userProfile.getAiravataInternalUserId().isEmpty()); + + /* + * Project Instance creation + */ + Project project = new Project(); + project.setGatewayId(gatewayId); + project.setOwner(userId); + project.setProjectID(projectId); + project.setGatewayIdIsSet(true); + project = projectRepository.create(project); + Assert.assertTrue(!project.getProjectID().isEmpty()); + + /* + * Experiment Instance Creation + */ + + ExperimentModel experiment = new ExperimentModel(); + experiment.setExperimentId(experimentId); + experiment.setExperimentName(EXPERIMENT_NAME); + experiment.setGatewayId(gatewayId); + experiment.setUserName(userId); + experiment.setProjectId(projectId); + + /* + * Experiment Repository Insert Operation Test + */ + experiment = experimentRepository.create(experiment); + Assert.assertTrue(!experiment.getExperimentId().isEmpty()); + + + + + /* + * Experiment Repository Update Operation Test + */ + experiment.setDescription(EXPERIMENT_DESCRIPTION); + experimentRepository.update(experiment); + experiment = experimentRepository.get(experimentId); + Assert.assertEquals(experiment.getDescription(), EXPERIMENT_DESCRIPTION); + + /* + * Workspace Project Repository Select Operation Test + */ + experiment = null; + experiment = experimentRepository.get(experimentId); + Assert.assertNotNull(experiment); + + /* + * Experiment Repository Delete Operation + */ + + boolean deleteResult = experimentRepository.delete(experimentId); + Assert.assertTrue(deleteResult); + + deleteResult = projectRepository.delete(projectId); + Assert.assertTrue(deleteResult); + + deleteResult = userProfileRepository.delete(userId); + Assert.assertTrue(deleteResult); + + deleteResult = gatewayRepository.delete(gatewayId); + Assert.assertTrue(deleteResult); + + } } \ No newline at end of file