message: Updating the entity and primary key classes for workflow catalog

diff:
@@ -32,7 +32,7 @@ import java.sql.Timestamp;
* The persistent class for the component_status database table.
*/
@Entity
-@Table(name = "component_status")
+@Table(name = "COMPONENT_STATUS")
public class ComponentStatusEntity implements Serializable {
private static final long serialVersionUID = 1L;
@@ -47,7 +47,7 @@ public class ComponentStatusEntity implements Serializable {
private String state;
@Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
+ private Timestamp timeofStateChange;
@Column(name = "TEMPLATE_ID")
private String templateId;
@@ -79,12 +79,12 @@ public class ComponentStatusEntity implements Serializable {
this.state = state;
}
- public Timestamp getUpdateTime() {
- return updateTime;
+ public Timestamp getTimeofStateChange() {
+ return timeofStateChange;
}
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
+ public void setTimeofStateChange(Timestamp timeofStateChange) {
+ this.timeofStateChange = timeofStateChange;
}
public String getTemplateId() {

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
+import org.apache.airavata.model.ComponentStatus;
+
+import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
-
/**
* The persistent class for the edge database table.
*/
@Entity
+@Table(name = "EDGE")
+@IdClass(EdgePK.class)
public class EdgeEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private EdgePK id;
+ @Id
+ @Column(name = "EDGE_ID")
+ private String edgeId;
+
+ @Id
+ @Column(name = "TEMPLATE_ID")
+ private String templateId;
@Column(name = "COMPONENT_STATUS_ID")
- private String componentStatusId;
+ private ComponentStatus status;
@Column(name = "CREATED_TIME")
private Timestamp createdTime;
@@ -49,26 +55,31 @@ public class EdgeEntity implements Serializable {
@Column(name = "NAME")
private String name;
- @Column(name = "TEMPLATE_ID")
- private String templateId;
-
public EdgeEntity() {
}
- public EdgePK getId() {
- return id;
+ public String getEdgeId() {
+ return edgeId;
+ }
+
+ public void setEdgeId(String edgeId) {
+ this.edgeId = edgeId;
+ }
+
+ public String getTemplateId() {
+ return templateId;
}
- public void setId(EdgePK id) {
- this.id = id;
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId;
}
- public String getComponentStatusId() {
- return componentStatusId;
+ public ComponentStatus getStatus() {
+ return status;
}
- public void setComponentStatusId(String componentStatusId) {
- this.componentStatusId = componentStatusId;
+ public void setStatus(ComponentStatus status) {
+ this.status = status;
}
public Timestamp getCreatedTime() {
@@ -94,12 +105,4 @@ public class EdgeEntity implements Serializable {
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:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* 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() {

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
+import org.apache.airavata.model.ComponentStatus;
+
+import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
-
/**
* The persistent class for the node database table.
*/
@Entity
+@Table(name = "NODE")
+@IdClass(NodePK.class)
public class NodeEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private NodePK id;
+ @Id
+ @Column(name = "NODE_ID")
+ private String nodeId;
+
+ @Id
+ @Column(name = "TEMPLATE_ID")
+ private String templateId;
@Column(name = "APPLICATION_ID")
private String applicationId;
@@ -44,7 +50,7 @@ public class NodeEntity implements Serializable {
private String applicationName;
@Column(name = "COMPONENT_STATUS_ID")
- private String componentStatusId;
+ private ComponentStatus status;
@Column(name = "CREATED_TIME")
private Timestamp createdTime;
@@ -55,18 +61,15 @@ public class NodeEntity implements Serializable {
@Column(name = "NAME")
private String name;
- @Column(name = "TEMPLATE_ID")
- private String templateId;
-
public NodeEntity() {
}
- public NodePK getId() {
- return id;
+ public String getNodeId() {
+ return nodeId;
}
- public void setId(NodePK id) {
- this.id = id;
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
}
public String getApplicationId() {
@@ -85,12 +88,12 @@ public class NodeEntity implements Serializable {
this.applicationName = applicationName;
}
- public String getComponentStatusId() {
- return componentStatusId;
+ public ComponentStatus getStatus() {
+ return status;
}
- public void setComponentStatusId(String componentStatusId) {
- this.componentStatusId = componentStatusId;
+ public void setStatus(ComponentStatus status) {
+ this.status = status;
}
public Timestamp getCreatedTime() {

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* 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() {

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
+import org.apache.airavata.model.ComponentStatus;
+
+import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
@@ -31,14 +31,21 @@ import java.sql.Timestamp;
* The persistent class for the port database table.
*/
@Entity
+@Table(name = "PORT")
+@IdClass(PortPK.class)
public class PortEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private PortPK id;
+ @Id
+ @Column(name = "PORT_ID")
+ private String portId;
+
+ @Id
+ @Column(name = "TEMPLATE_ID")
+ private String templateId;
@Column(name = "COMPONENT_STATUS_ID")
- private String componentStatusId;
+ private ComponentStatus status;
@Column(name = "CREATED_TIME")
private Timestamp createdTime;
@@ -49,27 +56,23 @@ public class PortEntity implements Serializable {
@Column(name = "NAME")
private String name;
- @Column(name = "TEMPLATE_ID")
- private String templateId;
-
public PortEntity() {
}
-
- public PortPK getId() {
- return id;
+ public String getPortId() {
+ return portId;
}
- public void setId(PortPK id) {
- this.id = id;
+ public void setPortId(String portId) {
+ this.portId = portId;
}
- public String getComponentStatusId() {
- return componentStatusId;
+ public ComponentStatus getComponentStatusId() {
+ return status;
}
- public void setComponentStatusId(String componentStatusId) {
- this.componentStatusId = componentStatusId;
+ public void setComponentStatusId(ComponentStatus status) {
+ this.status = status;
}
public Timestamp getCreatedTime() {

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* 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() {

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
+import org.apache.airavata.model.application.io.InputDataObjectType;
+import org.apache.airavata.model.application.io.OutputDataObjectType;
+
+import java.nio.ByteBuffer;
+import java.util.List;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
-
/**
* The persistent class for the workflow database table.
*/
@Entity
-@Table(name="workflow")
+@Table(name="WORKFLOW")
public class WorkflowEntity implements Serializable {
private static final long serialVersionUID = 1L;
@@ -40,8 +44,7 @@ public class WorkflowEntity implements Serializable {
@Column(name = "CREATED_USER")
private String createdUser;
- @Column(name = "CREATION_TIME", insertable = false, updatable = false)
- @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "CREATION_TIME")
private Timestamp creationTime;
@Column(name = "GATEWAY_ID")
@@ -51,7 +54,7 @@ public class WorkflowEntity implements Serializable {
private String graph;
@Column(name = "IMAGE")
- private byte[] image;
+ private ByteBuffer image;
@Column(name = "UPDATE_TIME")
private Timestamp updateTime;
@@ -59,6 +62,13 @@ public class WorkflowEntity implements Serializable {
@Column(name = "WORKFLOW_NAME")
private String name;
+ @OneToMany(targetEntity = WorkflowInputEntity.class, cascade = CascadeType.ALL,
+ mappedBy = "workflow", fetch = FetchType.EAGER)
+ private List<InputDataObjectType> workflowInputs;
+
+ @OneToMany(targetEntity = WorkflowOutputEntity.class, cascade = CascadeType.ALL,
+ mappedBy = "workflow", fetch = FetchType.EAGER)
+ private List<OutputDataObjectType> workflowOutputs;
public WorkflowEntity() {
}
@@ -113,12 +123,12 @@ public class WorkflowEntity implements Serializable {
this.graph = graph;
}
- public byte[] getImage() {
+ public ByteBuffer getImage() {
return this.image;
}
- public void setImage(byte[] image) {
+ public void setImage(ByteBuffer image) {
this.image = image;
}
@@ -140,4 +150,20 @@ public class WorkflowEntity implements Serializable {
public void setName(String name) {
this.name = name;
}
+
+ public List<InputDataObjectType> getWorkflowInputs() {
+ return workflowInputs;
+ }
+
+ public void setWorkflowInputs(List<InputDataObjectType> workflowInputs) {
+ this.workflowInputs = workflowInputs;
+ }
+
+ public List<OutputDataObjectType> getWorkflowOutputs() {
+ return workflowOutputs;
+ }
+
+ public void setWorkflowOutputs(List<OutputDataObjectType> workflowOutputs) {
+ this.workflowOutputs = workflowOutputs;
+ }
}
\ No newline at end of file

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.io.Serializable;
-
/**
* The persistent class for the workflow_input database table.
*/
@Entity
-@Table(name = "workflow_input")
+@Table(name = "WORKFLOW_INPUT")
+@IdClass(WorkflowInputPK.class)
public class WorkflowInputEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private WorkflowInputPK id;
+ @Id
+ @Column(name = "TEMPLATE_ID")
+ private String templateId;
+
+ @Id
+ @Column(name = "INPUT_KEY")
+ private String name;
@Column(name = "APP_ARGUMENT")
- private String appArgument;
+ private String applicationArgument;
@Column(name = "DATA_STAGED")
- private short dataStaged;
+ private boolean dataStaged;
@Column(name = "DATA_TYPE")
- private String dataType;
+ private String type;
@Column(name = "INPUT_ORDER")
private int inputOrder;
@@ -54,57 +56,65 @@ public class WorkflowInputEntity implements Serializable {
private String inputValue;
@Column(name = "IS_REQUIRED")
- private short isRequired;
+ private boolean isRequired;
@Column(name = "METADATA")
- private String metadata;
+ private String metaData;
@Column(name = "REQUIRED_TO_COMMANDLINE")
- private short requiredToCommandline;
+ private boolean requiredToAddedToCommandLine;
@Column(name = "STANDARD_INPUT")
- private short standardInput;
+ private boolean standardInput;
@Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
-
+ private String userFriendlyDescription;
- @Column(name = "TEMPLATE_ID")
- private String templateId;
+ @ManyToOne(targetEntity = WorkflowEntity.class, cascade = CascadeType.MERGE)
+ @JoinColumn(name = "TEMPLATE_ID")
+ private WorkflowEntity workflow;
public WorkflowInputEntity() {
}
- public WorkflowInputPK getId() {
- return id;
+ public String getTemplateId() {
+ return templateId;
}
- public void setId(WorkflowInputPK id) {
- this.id = id;
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
}
- public String getAppArgument() {
- return appArgument;
+ public String getApplicationArgument() {
+ return applicationArgument;
}
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
}
- public short getDataStaged() {
+ public boolean getDataStaged() {
return dataStaged;
}
- public void setDataStaged(short dataStaged) {
+ public void setDataStaged(boolean dataStaged) {
this.dataStaged = dataStaged;
}
- public String getDataType() {
- return dataType;
+ public String getType() {
+ return type;
}
- public void setDataType(String dataType) {
- this.dataType = dataType;
+ public void setType(String type) {
+ this.type = type;
}
public int getInputOrder() {
@@ -123,51 +133,51 @@ public class WorkflowInputEntity implements Serializable {
this.inputValue = inputValue;
}
- public short getIsRequired() {
+ public boolean getIsRequired() {
return isRequired;
}
- public void setIsRequired(short isRequired) {
+ public void setIsRequired(boolean isRequired) {
this.isRequired = isRequired;
}
- public String getMetadata() {
- return metadata;
+ public String getMetaData() {
+ return metaData;
}
- public void setMetadata(String metadata) {
- this.metadata = metadata;
+ public void setMetaData(String metaData) {
+ this.metaData = metaData;
}
- public short getRequiredToCommandline() {
- return requiredToCommandline;
+ public boolean getRequiredToAddedToCommandLine() {
+ return requiredToAddedToCommandLine;
}
- public void setRequiredToCommandline(short requiredToCommandline) {
- this.requiredToCommandline = requiredToCommandline;
+ public void setRequiredToAddedToCommandLine(boolean requiredToAddedToCommandLine) {
+ this.requiredToAddedToCommandLine = requiredToAddedToCommandLine;
}
- public short getStandardInput() {
+ public boolean getStandardInput() {
return standardInput;
}
- public void setStandardInput(short standardInput) {
+ public void setStandardInput(boolean standardInput) {
this.standardInput = standardInput;
}
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
+ public String getUserFriendlyDescription() {
+ return userFriendlyDescription;
}
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
+ public void setUserFriendlyDescription(String userFriendlyDescription) {
+ this.userFriendlyDescription = userFriendlyDescription;
}
- public String getTemplateId() {
- return templateId;
+ public WorkflowEntity getWorkflow() {
+ return workflow;
}
- public void setTemplateId(String templateId) {
- this.templateId = templateId;
+ public void setWorkflow(WorkflowEntity workflow) {
+ this.workflow = workflow;
}
}
\ No newline at end of file

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* 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;
+ private String name;
public WorkflowInputPK() {
}
@@ -51,14 +45,14 @@ public class WorkflowInputPK implements Serializable {
this.templateId = templateId;
}
- public String getInputKey() {
+ public String getName() {
- return this.inputKey;
+ return this.name;
}
- public void setInputKey(String inputKey) {
+ public void setName(String name) {
- this.inputKey = inputKey;
+ this.name = name;
}
public boolean equals(Object other) {
@@ -71,14 +65,14 @@ public class WorkflowInputPK implements Serializable {
WorkflowInputPK castOther = (WorkflowInputPK) other;
return
this.templateId.equals(castOther.templateId)
- && this.inputKey.equals(castOther.inputKey);
+ && this.name.equals(castOther.name);
}
public int hashCode() {
final int prime = 31;
int hash = 17;
hash = hash * prime + this.templateId.hashCode();
- hash = hash * prime + this.inputKey.hashCode();
+ hash = hash * prime + this.name.hashCode();
return hash;
}

diff:
@@ -23,30 +23,35 @@ package org.apache.airavata.registry.core.entities.workflowcatalog;
import javax.persistence.*;
import java.io.Serializable;
-
/**
* The persistent class for the workflow_output database table.
*
*/
@Entity
-@Table(name="workflow_output")
+@Table(name="WORKFLOW_OUTPUT")
+@IdClass(WorkflowOutputEntity.class)
public class WorkflowOutputEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private WorkflowOutputPK id;
+ @Id
+ @Column(name = "TEMPLATE_ID")
+ private String templateId;
+
+ @Id
+ @Column(name = "OUTPUT_KEY")
+ private String name;
@Column(name="APP_ARGUMENT")
- private String appArgument;
+ private String applicationArgument;
@Column(name="DATA_MOVEMENT")
private short dataMovement;
@Column(name="DATA_NAME_LOCATION")
- private String dataNameLocation;
+ private String location;
@Column(name="DATA_TYPE")
- private String dataType;
+ private String type;
@Column(name="IS_REQUIRED")
private short isRequired;
@@ -54,36 +59,44 @@ public class WorkflowOutputEntity implements Serializable {
@Column(name="OUTPUT_STREAMING")
private short outputStreaming;
- @Lob
@Column(name="OUTPUT_VALUE")
- private String outputValue;
+ private String value;
@Column(name="REQUIRED_TO_COMMANDLINE")
- private short requiredToCommandline;
+ private short requiredToAddedToCommandLine;
@Column(name="SEARCH_QUERY")
private String searchQuery;
- @Column(name="TEMPLATE_ID")
- private String templateId;
+ @ManyToOne(targetEntity = WorkflowEntity.class, cascade = CascadeType.MERGE)
+ @JoinColumn(name = "TEMPLATE_ID")
+ private WorkflowEntity workflow;
public WorkflowOutputEntity() {
}
- public WorkflowOutputPK getId() {
- return id;
+ public String getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId;
+ }
+
+ public String getName() {
+ return name;
}
- public void setId(WorkflowOutputPK id) {
- this.id = id;
+ public void setName(String name) {
+ this.name = name;
}
- public String getAppArgument() {
- return appArgument;
+ public String getApplicationArgument() {
+ return applicationArgument;
}
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
}
public short getDataMovement() {
@@ -94,20 +107,20 @@ public class WorkflowOutputEntity implements Serializable {
this.dataMovement = dataMovement;
}
- public String getDataNameLocation() {
- return dataNameLocation;
+ public String getLocation() {
+ return location;
}
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
+ public void setLocation(String location) {
+ this.location = location;
}
- public String getDataType() {
- return dataType;
+ public String getType() {
+ return type;
}
- public void setDataType(String dataType) {
- this.dataType = dataType;
+ public void setType(String type) {
+ this.type = type;
}
public short getIsRequired() {
@@ -126,20 +139,20 @@ public class WorkflowOutputEntity implements Serializable {
this.outputStreaming = outputStreaming;
}
- public String getOutputValue() {
- return outputValue;
+ public String getValue() {
+ return value;
}
- public void setOutputValue(String outputValue) {
- this.outputValue = outputValue;
+ public void setValue(String value) {
+ this.value = value;
}
- public short getRequiredToCommandline() {
- return requiredToCommandline;
+ public short getRequiredToAddedToCommandLine() {
+ return requiredToAddedToCommandLine;
}
- public void setRequiredToCommandline(short requiredToCommandline) {
- this.requiredToCommandline = requiredToCommandline;
+ public void setRequiredToAddedToCommandLine(short requiredToAddedToCommandLine) {
+ this.requiredToAddedToCommandLine = requiredToAddedToCommandLine;
}
public String getSearchQuery() {
@@ -150,11 +163,11 @@ public class WorkflowOutputEntity implements Serializable {
this.searchQuery = searchQuery;
}
- public String getTemplateId() {
- return templateId;
+ public WorkflowEntity getWorkflow() {
+ return workflow;
}
- public void setTemplateId(String templateId) {
- this.templateId = templateId;
+ public void setWorkflow(WorkflowEntity workflow) {
+ this.workflow = workflow;
}
}
\ No newline at end of file

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* 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;
+ private String name;
public WorkflowOutputPK() {
}
@@ -50,12 +44,12 @@ public class WorkflowOutputPK implements Serializable {
this.templateId = templateId;
}
- public String getOutputKey() {
- return outputKey;
+ public String getName() {
+ return name;
}
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
+ public void setName(String name) {
+ this.name = name;
}
public boolean equals(Object other) {
@@ -68,14 +62,14 @@ public class WorkflowOutputPK implements Serializable {
WorkflowOutputPK castOther = (WorkflowOutputPK)other;
return
this.templateId.equals(castOther.templateId)
- && this.outputKey.equals(castOther.outputKey);
+ && this.name.equals(castOther.name);
}
public int hashCode() {
final int prime = 31;
int hash = 17;
hash = hash * prime + this.templateId.hashCode();
- hash = hash * prime + this.outputKey.hashCode();
+ hash = hash * prime + this.name.hashCode();
return hash;
}

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
-
/**
* The persistent class for the workflow_status database table.
*/
@Entity
-@Table(name = "workflow_status")
+@Table(name = "WORKFLOW_STATUS")
+@IdClass(WorkflowStatusPK.class)
public class WorkflowStatusEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private WorkflowStatusPK id;
+ @Id
+ @Column(name = "STATUS_ID")
+ private String statusId;
+
+ @Id
+ @Column(name = "TEMPLATE_ID")
+ private String templateId;
@Column(name = "REASON")
private String reason;
@@ -46,20 +48,17 @@ public class WorkflowStatusEntity implements Serializable {
private String state;
@Column(name = "UPDATE_TIME")
- private Timestamp updateTime;
-
- @Column(name = "TEMPLATE_ID")
- private String templateId;
+ private Timestamp timeOfStateChange;
public WorkflowStatusEntity() {
}
- public WorkflowStatusPK getId() {
- return id;
+ public String getStatusId() {
+ return statusId;
}
- public void setId(WorkflowStatusPK id) {
- this.id = id;
+ public void setStatusId(String statusId) {
+ this.statusId = statusId;
}
public String getReason() {
@@ -78,12 +77,12 @@ public class WorkflowStatusEntity implements Serializable {
this.state = state;
}
- public Timestamp getUpdateTime() {
- return updateTime;
+ public Timestamp getTimeOfStateChange() {
+ return timeOfStateChange;
}
- public void setUpdateTime(Timestamp updateTime) {
- this.updateTime = updateTime;
+ public void setTimeOfStateChange(Timestamp timeOfStateChange) {
+ this.timeOfStateChange = timeOfStateChange;
}
public String getTemplateId() {

diff:
*/
package org.apache.airavata.registry.core.entities.workflowcatalog;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* 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() {


message: Add repository class and override interface methods

change_type: MODIFY

diff:
@@ -64,11 +64,11 @@ public class WorkflowEntity implements Serializable {
@OneToMany(targetEntity = WorkflowInputEntity.class, cascade = CascadeType.ALL,
mappedBy = "workflow", fetch = FetchType.EAGER)
- private List<InputDataObjectType> workflowInputs;
+ private List<WorkflowInputEntity> workflowInputs;
@OneToMany(targetEntity = WorkflowOutputEntity.class, cascade = CascadeType.ALL,
mappedBy = "workflow", fetch = FetchType.EAGER)
- private List<OutputDataObjectType> workflowOutputs;
+ private List<WorkflowOutputEntity> workflowOutputs;
public WorkflowEntity() {
}
@@ -151,19 +151,19 @@ public class WorkflowEntity implements Serializable {
this.name = name;
}
- public List<InputDataObjectType> getWorkflowInputs() {
+ public List<WorkflowInputEntity> getWorkflowInputs() {
return workflowInputs;
}
- public void setWorkflowInputs(List<InputDataObjectType> workflowInputs) {
+ public void setWorkflowInputs(List<WorkflowInputEntity> workflowInputs) {
this.workflowInputs = workflowInputs;
}
- public List<OutputDataObjectType> getWorkflowOutputs() {
+ public List<WorkflowOutputEntity> getWorkflowOutputs() {
return workflowOutputs;
}
- public void setWorkflowOutputs(List<OutputDataObjectType> workflowOutputs) {
+ public void setWorkflowOutputs(List<WorkflowOutputEntity> workflowOutputs) {
this.workflowOutputs = workflowOutputs;
}
}
\ No newline at end of file

change_type: DELETE

diff:
-/*
- *
- * 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.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;
-
-public class ComponentStatusRepository extends AbstractRepository<ComponentStatus, ComponentStatusEntity, String> {
-
-
- private final static Logger logger = LoggerFactory.getLogger(ComponentStatusRepository.class);
-
- public ComponentStatusRepository(Class<ComponentStatus> thriftGenericClass, Class<ComponentStatusEntity> dbEntityGenericClass) {
- super(thriftGenericClass, dbEntityGenericClass);
- }
-}

diff:
-/*
- *
- * 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.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;
-
-public class EdgeRepository extends AbstractRepository<EdgeModel, EdgeEntity, EdgePK> {
-
-
- private final static Logger logger = LoggerFactory.getLogger(EdgeRepository.class);
-
- public EdgeRepository(Class<EdgeModel> thriftGenericClass, Class<EdgeEntity> dbEntityGenericClass) {
- super(thriftGenericClass, dbEntityGenericClass);
- }
-}

diff:
-/*
- *
- * 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.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;
-
-public class NodeRepository extends AbstractRepository<NodeModel, NodeEntity, NodePK> {
-
-
- private final static Logger logger = LoggerFactory.getLogger(NodeRepository.class);
-
- public NodeRepository(Class<NodeModel> thriftGenericClass, Class<NodeEntity> dbEntityGenericClass) {
- super(thriftGenericClass, dbEntityGenericClass);
- }
-}

change_type: ADD

diff:
+/*
+ *
+ * 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.workflowcatalog;
+
+import org.apache.airavata.registry.core.utils.Committer;
+import org.apache.airavata.registry.core.utils.DBConstants;
+import org.apache.airavata.registry.core.utils.JPAUtil.RepCatalogJPAUtils;
+import org.apache.airavata.registry.core.utils.JPAUtil.WorkflowCatalogJPAUtils;
+import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class WorkflowCatAbstractRepository<T, E, Id> {
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowCatAbstractRepository.class);
+
+ private Class<T> thriftGenericClass;
+ private Class<E> dbEntityGenericClass;
+
+ public WorkflowCatAbstractRepository(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 = execute(entityManager -> entityManager.merge(entity));
+ return mapper.map(persistedCopy, thriftGenericClass);
+ }
+
+ public boolean delete(Id id) {
+ execute(entityManager -> {
+ E entity = entityManager.find(dbEntityGenericClass, id);
+ entityManager.remove(entity);
+ return entity;
+ });
+ return true;
+ }
+
+ public T get(Id id) {
+ E entity = execute(entityManager -> entityManager
+ .find(dbEntityGenericClass, id));
+ if(entity == null)
+ return null;
+ Mapper mapper = ObjectMapperSingleton.getInstance();
+ return mapper.map(entity, thriftGenericClass);
+ }
+
+ public List<T> select(String query, int offset) {
+ List resultSet = (List) execute(entityManager -> entityManager.createQuery(query).setFirstResult(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) {
+ int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+
+ List resultSet = (List) 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(newLimit).getResultList();
+
+ });
+ Mapper mapper = ObjectMapperSingleton.getInstance();
+ List<T> gatewayList = new ArrayList<>();
+ resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+ return gatewayList;
+ }
+
+ public boolean isExists(Id id) {
+ return get(id) != null;
+ }
+
+ public <R> R execute(Committer<EntityManager, R> committer){
+ EntityManager entityManager = null;
+ try {
+ entityManager = WorkflowCatalogJPAUtils.getEntityManager();
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to get Workflow Catalog EntityManager", e);
+ }
+ try {
+ entityManager.getTransaction().begin();
+ R r = committer.commit(entityManager);
+ entityManager.getTransaction().commit();
+ return r;
+ }finally {
+ if (entityManager != null && entityManager.isOpen()) {
+ if (entityManager.getTransaction().isActive()) {
+ entityManager.getTransaction().rollback();
+ }
+ entityManager.close();
+ }
+ }
+ }
+
+}

diff:
package org.apache.airavata.registry.core.repositories.workflowcatalog;
import org.apache.airavata.model.WorkflowModel;
+import org.apache.airavata.model.application.io.OutputDataObjectType;
import org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowEntity;
-import org.apache.airavata.registry.core.repositories.AbstractRepository;
+import org.apache.airavata.registry.core.utils.DBConstants;
+import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.apache.airavata.registry.core.utils.QueryConstants;
+import org.apache.airavata.registry.core.utils.WorkflowCatalogUtils;
+import org.apache.airavata.registry.cpi.WorkflowCatalog;
+import org.apache.airavata.registry.cpi.WorkflowCatalogException;
+import org.dozer.Mapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class WorkflowRepository extends AbstractRepository<WorkflowModel, WorkflowEntity, String> {
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+public class WorkflowRepository extends WorkflowCatAbstractRepository<WorkflowModel, WorkflowEntity, String> implements WorkflowCatalog {
private final static Logger logger = LoggerFactory.getLogger(WorkflowRepository.class);
+ public WorkflowRepository() {
+ super(WorkflowModel.class, WorkflowEntity.class);
+ }
+
+ protected String saveWorkflowModelData(WorkflowModel workflowModel, String gatewayId) throws WorkflowCatalogException {
+ WorkflowEntity workflowEntity = saveWorkflow(workflowModel, gatewayId);
+ return workflowEntity.getTemplateId();
+ }
+
+ protected WorkflowEntity saveWorkflow(WorkflowModel workflowModel, String gatewayId) throws WorkflowCatalogException {
+ if (workflowModel.getTemplateId() == null) {
+ logger.debug("Setting the Template ID for the new Workflow");
+ workflowModel.setTemplateId(WorkflowCatalogUtils.getID(workflowModel.getName()));
+ }
+
+ String templateId = workflowModel.getTemplateId();
+ Mapper mapper = ObjectMapperSingleton.getInstance();
+ WorkflowEntity workflowEntity = mapper.map(workflowModel, WorkflowEntity.class);
+
+ if (gatewayId != null) {
+ logger.debug("Setting the gateway ID of the Workflow");
+ workflowEntity.setGatewayId(gatewayId);
+ }
+
+ if (workflowEntity.getWorkflowInputs() != null) {
+ logger.debug("Populating the template ID for WorkflowInput objects for the Workflow");
+ workflowEntity.getWorkflowInputs().forEach(workflowInputEntity -> workflowInputEntity.setTemplateId(templateId));
+ }
+
+ if (workflowEntity.getWorkflowOutputs() != null) {
+ logger.debug("Populating the template ID for WorkflowOutput objects for the Workflow");
+ workflowEntity.getWorkflowOutputs().forEach(workflowOutputEntity -> workflowOutputEntity.setTemplateId(templateId));
+ }
+
+ if (get(templateId) == null) {
+ logger.debug("Checking if the Workflow already exists");
+ workflowEntity.setCreationTime(new Timestamp(System.currentTimeMillis()));
+ }
+
+ workflowEntity.setUpdateTime(new Timestamp(System.currentTimeMillis()));
+
+ return execute(entityManager -> entityManager.merge(workflowEntity));
+ }
+
+ @Override
+ public String registerWorkflow(WorkflowModel workflowModel, String gatewayId) throws WorkflowCatalogException {
+ return saveWorkflowModelData(workflowModel, gatewayId);
+ }
+
+ @Override
+ public void updateWorkflow(String templateId, WorkflowModel updatedWorkflowModel) throws WorkflowCatalogException {
+ saveWorkflowModelData(updatedWorkflowModel, null);
+ }
+
+ @Override
+ public WorkflowModel getWorkflow(String templateId) throws WorkflowCatalogException {
+ return get(templateId);
+ }
+
+ @Override
+ public List<String> getAllWorkflows(String gatewayId) throws WorkflowCatalogException {
+ Map<String, Object> queryParameters = new HashMap<>();
+ queryParameters.put(DBConstants.Workflow.GATEWAY_ID, gatewayId);
+ List<WorkflowModel> workflowModelList = select(QueryConstants.GET_ALL_WORKFLOWS, -1, 0, queryParameters);
+ List<String> workflows = new ArrayList<>();
+ for (WorkflowModel workflowModel : workflowModelList) {
+ workflows.add(workflowModel.getTemplateId());
+ }
+ return workflows;
+ }
+
+ @Override
+ public String getWorkflowTemplateId(String workflowName) throws WorkflowCatalogException {
+ Map<String, Object> queryParameters = new HashMap<>();
+ queryParameters.put(DBConstants.Workflow.WORKFLOW_NAME, workflowName);
+ List<WorkflowModel> workflowModelList = select(QueryConstants.GET_WORKFLOW_GIVEN_NAME, -1, 0, queryParameters);
- public WorkflowRepository(Class<WorkflowModel> thriftGenericClass, Class<WorkflowEntity> dbEntityGenericClass) {
- super(thriftGenericClass, dbEntityGenericClass);
+ if (!workflowModelList.isEmpty() && workflowModelList != null) {
+ logger.debug("Return the record (there is only one record)");
+ return workflowModelList.get(0).getTemplateId();
}
+
+ return null;
+ }
+
+ @Override
+ public boolean isWorkflowExistWithName(String workflowName) throws WorkflowCatalogException {
+ Map<String, Object> queryParameters = new HashMap<>();
+ queryParameters.put(DBConstants.Workflow.WORKFLOW_NAME, workflowName);
+ List<WorkflowModel> workflowModelList = select(QueryConstants.GET_WORKFLOW_GIVEN_NAME, -1, 0, queryParameters);
+ return (!workflowModelList.isEmpty() && workflowModelList != null);
+ }
+
+ @Override
+ public void updateWorkflowOutputs(String templateId, List<OutputDataObjectType> workflowOutputs) throws WorkflowCatalogException {
+ WorkflowModel workflowModel = getWorkflow(templateId);
+ workflowModel.setWorkflowOutputs(workflowOutputs);
+ updateWorkflow(workflowModel.getTemplateId(), workflowModel);
+ }
+
+ @Override
+ public void deleteWorkflow(String templateId) throws WorkflowCatalogException {
+ delete(templateId);
+ }
+
}

diff:
-/*
- *
- * 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.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;
-
-public class WorkflowStatusRepository extends AbstractRepository<WorkflowStatus, WorkflowStatusEntity, WorkflowStatusPK> {
-
- private final static Logger logger = LoggerFactory.getLogger(WorkflowStatusRepository.class);
-
- public WorkflowStatusRepository(Class<WorkflowStatus> thriftGenericClass, Class<WorkflowStatusEntity> dbEntityGenericClass) {
- super(thriftGenericClass, dbEntityGenericClass);
- }
-}

diff:
@@ -133,4 +133,9 @@ public class DBConstants {
public static final String PARENT_PRODUCT_URI = "parentProductUri";
}
+ public static class Workflow {
+ public static final String GATEWAY_ID = "gatewayId";
+ public static final String WORKFLOW_NAME = "workflowName";
+ }
+
}

diff:
+/**
+ *
+ * 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.utils.JPAUtil;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+public class WorkflowCatalogJPAUtils {
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowCatalogJPAUtils.class);
+
+ private static final String PERSISTENCE_UNIT_NAME = "workflowcatalog_data";
+ private static final String WFCATALOG_JDBC_DRIVER = "wfcatalog.jdbc.driver";
+ private static final String WFCATALOG_JDBC_URL = "wfcatalog.jdbc.url";
+ private static final String WFCATALOG_JDBC_USER = "wfcatalog.jdbc.user";
+ private static final String WFCATALOG_JDBC_PASSWORD = "wfcatalog.jdbc.password";
+ private static final String WFCATALOG_VALIDATION_QUERY = "wfcatalog.validationQuery";
+ private static final String JPA_CACHE_SIZE = "jpa.cache.size";
+ private static final String JPA_CACHE_ENABLED = "cache.enable";
+ @PersistenceUnit(unitName="workflowcatalog_data")
+ protected static EntityManagerFactory factory;
+ @PersistenceContext(unitName="worlkflowcatalog_data")
+ private static EntityManager wfCatEntityManager;
+
+ public static EntityManager getEntityManager() throws ApplicationSettingsException {
+ if (factory == null) {
+ String connectionProperties = "DriverClassName=" + readServerProperties(WFCATALOG_JDBC_DRIVER) + "," +
+ "Url=" + readServerProperties(WFCATALOG_JDBC_URL) + "?autoReconnect=true," +
+ "Username=" + readServerProperties(WFCATALOG_JDBC_USER) + "," +
+ "Password=" + readServerProperties(WFCATALOG_JDBC_PASSWORD) +
+ ",validationQuery=" + readServerProperties(WFCATALOG_VALIDATION_QUERY);
+ System.out.println(connectionProperties);
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+ properties.put("openjpa.ConnectionProperties", connectionProperties);
+ properties.put("openjpa.DynamicEnhancementAgent", "true");
+ properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
+ properties.put("openjpa.RemoteCommitProvider","sjvm");
+ properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+ properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+ properties.put("openjpa.jdbc.QuerySQLCache", "false");
+ properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
+ factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+ }
+ wfCatEntityManager = factory.createEntityManager();
+ return wfCatEntityManager;
+ }
+
+ private static String readServerProperties (String propertyName) throws ApplicationSettingsException {
+ try {
+ return ServerSettings.getSetting(propertyName);
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read airavata-server.properties...", e);
+ throw new ApplicationSettingsException("Unable to read airavata-server.properties...");
+ }
+ }
+
+}

diff:
@@ -22,6 +22,7 @@ package org.apache.airavata.registry.core.utils;
import org.apache.airavata.model.user.UserProfile;
import org.apache.airavata.registry.core.entities.appcatalog.*;
import org.apache.airavata.registry.core.entities.replicacatalog.DataProductEntity;
+import org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowEntity;
public interface QueryConstants {
@@ -113,4 +114,9 @@ public interface QueryConstants {
"WHERE DP.gatewayId LIKE :" + DBConstants.DataProduct.GATEWAY_ID + " AND DP.ownerName LIKE :" +
DBConstants.DataProduct.OWNER_NAME + " AND dp.productName LIKE :" + DBConstants.DataProduct.PRODUCT_NAME;
+ String GET_ALL_WORKFLOWS = "SELECT W FROM " + WorkflowEntity.class.getSimpleName() + " W " +
+ "WHERE W.gatewayId LIKE :" + DBConstants.Workflow.GATEWAY_ID;
+ String GET_WORKFLOW_GIVEN_NAME = "SELECT W FROM " + WorkflowEntity.class.getSimpleName() + " W " +
+ "WHERE W.workflowName LIKE :" + DBConstants.Workflow.WORKFLOW_NAME;
+
}

change_type: RENAME

diff:
-/*
+/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* 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.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;
-
-public class PortRepository extends AbstractRepository<PortModel, PortEntity, PortPK> {
+package org.apache.airavata.registry.core.utils;
- private final static Logger logger = LoggerFactory.getLogger(PortRepository.class);
+import java.util.UUID;
- public PortRepository(Class<PortModel> thriftGenericClass, Class<PortEntity> dbEntityGenericClass) {
- super(thriftGenericClass, dbEntityGenericClass);
+public class WorkflowCatalogUtils {
+ public static String getID (String name){
+ String pro = name.replaceAll("\\s", "");
+ return pro + "_" + UUID.randomUUID();
}
}

license: Apache License 2.0

repo: apache/airavata


message: Add for repcatalog repositories methods

diff:
@@ -85,23 +85,28 @@ public class DataProductRepository extends RepCatAbstractRepository<DataProductM
}
+ @Override
public String registerDataProduct(DataProductModel dataProductModel) throws ReplicaCatalogException {
return saveDataProductModelData(dataProductModel);
}
+ @Override
public boolean updateDataProduct(DataProductModel updatedDataProductModel) throws ReplicaCatalogException {
return (saveDataProductModelData(updatedDataProductModel) != null);
}
+ @Override
public DataProductModel getDataProduct(String productUri) throws ReplicaCatalogException {
return get(productUri);
}
+ @Override
public DataProductModel getParentDataProduct(String productUri) throws ReplicaCatalogException {
DataProductModel dataProductModel = getDataProduct(productUri);
return get(dataProductModel.getParentProductUri());
}
+ @Override
public List<DataProductModel> getChildDataProducts(String parentProductUri) throws ReplicaCatalogException {
Map<String, Object> queryParameters = new HashMap<>();
queryParameters.put(DBConstants.DataProduct.PARENT_PRODUCT_URI, parentProductUri);
@@ -109,6 +114,7 @@ public class DataProductRepository extends RepCatAbstractRepository<DataProductM
return dataProductModelList;
}
+ @Override
public List<DataProductModel> searchDataProductsByName(String gatewayId, String userId, String productName,
int limit, int offset) throws ReplicaCatalogException {
Map<String, Object> queryParameters = new HashMap<>();
@@ -119,10 +125,12 @@ public class DataProductRepository extends RepCatAbstractRepository<DataProductM
return dataProductModelList;
}
+ @Override
public boolean isDataProductExists(String productUri) throws ReplicaCatalogException {
return isExists(productUri);
}
+ @Override
public boolean removeDataProduct(String productUri) throws ReplicaCatalogException {
return delete(productUri);
}

diff:
@@ -66,18 +66,22 @@ public class DataReplicaLocationRepository extends RepCatAbstractRepository<Data
return execute(entityManager -> entityManager.merge(dataReplicaLocationEntity));
}
+ @Override
public String registerReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws ReplicaCatalogException {
return saveDataReplicaLocationModelData(dataReplicaLocationModel);
}
+ @Override
public boolean updateReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws ReplicaCatalogException {
return (saveDataReplicaLocationModelData(dataReplicaLocationModel) != null);
}
+ @Override
public DataReplicaLocationModel getReplicaLocation(String replicaId) throws ReplicaCatalogException {
return get(replicaId);
}
+ @Override
public List<DataReplicaLocationModel> getAllReplicaLocations(String productUri) throws ReplicaCatalogException {
DataProductRepository dataProductRepository = new DataProductRepository();
DataProductModel dataProductModel = dataProductRepository.getDataProduct(productUri);
@@ -85,6 +89,7 @@ public class DataReplicaLocationRepository extends RepCatAbstractRepository<Data
return dataReplicaLocationModelList;
}
+ @Override
public boolean removeReplicaLocation(String replicaId) throws ReplicaCatalogException {
return delete(replicaId);
}

original_message: Add @Override for repcatalog repositories methods


message: Moved appcatalog's Initialize.java to proper folder

diff:
@@ -25,7 +25,7 @@ import org.apache.airavata.model.appcatalog.appdeployment.CommandObject;
import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
import org.apache.airavata.model.parallelism.ApplicationParallelismType;
-import org.apache.airavata.registry.core.repositories.util.Initialize;
+import org.apache.airavata.registry.core.repositories.appcatalog.util.Initialize;
import org.apache.airavata.registry.core.utils.DBConstants;
import org.apache.airavata.registry.cpi.AppCatalogException;
import org.junit.After;

diff:
@@ -26,10 +26,9 @@ import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescr
import org.apache.airavata.model.application.io.InputDataObjectType;
import org.apache.airavata.model.application.io.OutputDataObjectType;
import org.apache.airavata.model.parallelism.ApplicationParallelismType;
-import org.apache.airavata.registry.core.repositories.util.Initialize;
+import org.apache.airavata.registry.core.repositories.appcatalog.util.Initialize;
import org.apache.airavata.registry.core.utils.DBConstants;
import org.apache.airavata.registry.cpi.AppCatalogException;
-import org.apache.airavata.registry.cpi.ApplicationDeployment;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

diff:
@@ -21,7 +21,7 @@ package org.apache.airavata.registry.core.repositories.appcatalog;
import org.apache.airavata.model.appcatalog.computeresource.*;
import org.apache.airavata.model.data.movement.*;
-import org.apache.airavata.registry.core.repositories.util.Initialize;
+import org.apache.airavata.registry.core.repositories.appcatalog.util.Initialize;
import org.apache.airavata.registry.core.utils.DBConstants;
import org.apache.airavata.registry.cpi.AppCatalogException;
import org.junit.After;

diff:
@@ -24,7 +24,7 @@ import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtoco
import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
import org.apache.airavata.model.data.movement.DataMovementProtocol;
-import org.apache.airavata.registry.core.repositories.util.Initialize;
+import org.apache.airavata.registry.core.repositories.appcatalog.util.Initialize;
import org.apache.airavata.registry.cpi.AppCatalogException;
import org.junit.After;
import org.junit.Before;

diff:
@@ -22,7 +22,7 @@ package org.apache.airavata.registry.core.repositories.appcatalog;
import org.apache.airavata.model.appcatalog.computeresource.BatchQueue;
import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
import org.apache.airavata.model.appcatalog.groupresourceprofile.*;
-import org.apache.airavata.registry.core.repositories.util.Initialize;
+import org.apache.airavata.registry.core.repositories.appcatalog.util.Initialize;
import org.apache.airavata.registry.cpi.AppCatalogException;
import org.junit.After;
import org.junit.Before;

diff:
@@ -3,7 +3,7 @@ package org.apache.airavata.registry.core.repositories.appcatalog;
import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
import org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
import org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference;
-import org.apache.airavata.registry.core.repositories.util.Initialize;
+import org.apache.airavata.registry.core.repositories.appcatalog.util.Initialize;
import org.apache.airavata.registry.cpi.AppCatalogException;
import org.junit.After;
import org.junit.Before;

diff:
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.airavata.registry.core.repositories.util;
+package org.apache.airavata.registry.core.repositories.appcatalog.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;


message: Adding SQL resources and test

diff:
+/*
+ *
+ * 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.
+ *
+ */
+
+CREATE TABLE WORKFLOW
+(
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ WORKFLOW_NAME VARCHAR (255) NOT NULL,
+ CREATED_USER VARCHAR (255),
+ GATEWAY_ID VARCHAR (255),
+ GRAPH CLOB,
+ IMAGE BLOB,
+ CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
+ UPDATE_TIME timestamp DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (TEMPLATE_ID)
+);
+
+CREATE TABLE WORKFLOW_INPUT
+(
+ TEMPLATE_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255),
+ INPUT_VALUE CLOB,
+ DATA_TYPE VARCHAR(255),
+ METADATA VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(TEMPLATE_ID,INPUT_KEY),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE WORKFLOW_OUTPUT
+(
+ TEMPLATE_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255),
+ OUTPUT_VALUE VARCHAR(255),
+ DATA_TYPE VARCHAR(255),
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ OUTPUT_STREAMING SMALLINT,
+ PRIMARY KEY(TEMPLATE_ID,OUTPUT_KEY),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE COMPONENT_STATUS
+(
+ STATUS_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ STATE VARCHAR(255),
+ REASON VARCHAR(255),
+ UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (STATUS_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE WORKFLOW_STATUS
+(
+ STATUS_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ STATE VARCHAR(255),
+ REASON VARCHAR(255),
+ UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (STATUS_ID, TEMPLATE_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EDGE
+(
+ EDGE_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ NAME VARCHAR (255),
+ COMPONENT_STATUS_ID VARCHAR(255),
+ DESCRIPTION VARCHAR(500),
+ CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (EDGE_ID, TEMPLATE_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE PORT
+(
+ PORT_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ NAME VARCHAR (255),
+ COMPONENT_STATUS_ID VARCHAR(255),
+ DESCRIPTION VARCHAR(500),
+ CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (PORT_ID, TEMPLATE_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE
+(
+ NODE_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ NAME VARCHAR (255),
+ APPLICATION_ID VARCHAR (255),
+ APPLICATION_NAME VARCHAR (255),
+ COMPONENT_STATUS_ID VARCHAR(255),
+ DESCRIPTION VARCHAR(500),
+ CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (NODE_ID, TEMPLATE_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
\ No newline at end of file

diff:
+/*
+ *
+ * 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.
+ *
+ */
+
+CREATE TABLE WORKFLOW
+(
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ WORKFLOW_NAME VARCHAR (255) NOT NULL,
+ CREATED_USER VARCHAR (255),
+ GATEWAY_ID VARCHAR (255),
+ GRAPH LONGTEXT,
+ IMAGE BLOB,
+ CREATION_TIME timestamp DEFAULT NOW(),
+ UPDATE_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+ PRIMARY KEY (TEMPLATE_ID)
+);
+
+CREATE TABLE WORKFLOW_INPUT
+(
+ TEMPLATE_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255),
+ INPUT_VALUE VARCHAR(255),
+ DATA_TYPE VARCHAR(255),
+ METADATA VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(TEMPLATE_ID,INPUT_KEY),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE WORKFLOW_OUTPUT
+(
+ TEMPLATE_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255),
+ OUTPUT_VALUE LONGTEXT,
+ DATA_TYPE VARCHAR(255),
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ OUTPUT_STREAMING SMALLINT,
+ PRIMARY KEY(TEMPLATE_ID,OUTPUT_KEY),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE COMPONENT_STATUS
+(
+ STATUS_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ STATE VARCHAR(255),
+ REASON VARCHAR(255),
+ UPDATE_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+ PRIMARY KEY (STATUS_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE WORKFLOW_STATUS
+(
+ STATUS_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ STATE VARCHAR(255),
+ REASON VARCHAR(255),
+ UPDATE_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+ PRIMARY KEY (STATUS_ID, TEMPLATE_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EDGE
+(
+ EDGE_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ NAME VARCHAR (255),
+ COMPONENT_STATUS_ID VARCHAR(255),
+ DESCRIPTION VARCHAR(500),
+ CREATED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+ PRIMARY KEY (EDGE_ID, TEMPLATE_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE PORT
+(
+ PORT_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ NAME VARCHAR (255),
+ COMPONENT_STATUS_ID VARCHAR(255),
+ DESCRIPTION VARCHAR(500),
+ CREATED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+ PRIMARY KEY (PORT_ID, TEMPLATE_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE
+(
+ NODE_ID VARCHAR (255) NOT NULL,
+ TEMPLATE_ID VARCHAR (255) NOT NULL,
+ NAME VARCHAR (255),
+ APPLICATION_ID VARCHAR (255),
+ APPLICATION_NAME VARCHAR (255),
+ COMPONENT_STATUS_ID VARCHAR(255),
+ DESCRIPTION VARCHAR(500),
+ CREATED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+ PRIMARY KEY (NODE_ID, TEMPLATE_ID),
+ FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
+);
\ No newline at end of file

diff:
+package org.apache.airavata.registry.core.repositories.workflowcatalog;
+
+public class WorkflowRepositoryTest {
+}

diff:
+package org.apache.airavata.registry.core.repositories.workflowcatalog.util;
+
+public class Initialize {
+}

original_message: Adding SQL resources and test


message: Making necessary changed to appcatalog entities and repositories

diff:
*/
package org.apache.airavata.registry.core.entities.appcatalog;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.io.Serializable;
-
/**
* The persistent class for the globus_gk_endpoint database table.
*
*/
@Entity
@Table(name="GLOBUS_GK_ENDPOINT")
+@IdClass(GlobusGkEndpointPK.class)
public class GlobusGkEndpointEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private GlobusGkEndpointPK id;
-
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionId;
+ @Id
+ @Column(name = "ENDPOINT")
+ private String endpoint;
public GlobusGkEndpointEntity() {
}
- public GlobusGkEndpointPK getId() {
- return id;
+ public String getSubmissionId() {
+ return submissionId;
+ }
+
+ public void setSubmissionId(String submissionId) {
+ this.submissionId = submissionId;
}
- public void setId(GlobusGkEndpointPK id) {
- this.id = id;
+ public String getEndpoint() {
+ return endpoint;
}
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
}
\ No newline at end of file

diff:
@@ -24,17 +24,22 @@ import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
-
/**
* The persistent class for the gridftp_endpoint database table.
*/
@Entity
@Table(name = "GRIDFTP_ENDPOINT")
+@IdClass(GridftpEndpointPK.class)
public class GridftpEndpointEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private GridftpEndpointPK id;
+ @Id
+ @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private String dataMovementInterfaceId;
+
+ @Id
+ @Column(name = "ENDPOINT")
+ private String endpoint;
@Column(name = "CREATION_TIME")
private Timestamp creationTime;
@@ -50,20 +55,28 @@ public class GridftpEndpointEntity implements Serializable {
public GridftpEndpointEntity() {
}
- public GridftpDataMovementEntity getGridftpDataMovement() {
- return gridftpDataMovement;
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
}
- public void setGridftpDataMovement(GridftpDataMovementEntity gridftpDataMovement) {
- this.gridftpDataMovement = gridftpDataMovement;
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId = dataMovementInterfaceId;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
}
- public GridftpEndpointPK getId() {
- return id;
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
}
- public void setId(GridftpEndpointPK id) {
- this.id = id;
+ public GridftpDataMovementEntity getGridftpDataMovement() {
+ return gridftpDataMovement;
+ }
+
+ public void setGridftpDataMovement(GridftpDataMovementEntity gridftpDataMovement) {
+ this.gridftpDataMovement = gridftpDataMovement;
}
public Timestamp getCreationTime() {

diff:
*/
package org.apache.airavata.registry.core.entities.appcatalog;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.io.Serializable;
-
/**
* The persistent class for the gsissh_export database table.
*/
@Entity
@Table(name = "GSISSH_EXPORT")
+@IdClass(GsisshExportPK.class)
public class GsisshExportEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private GsisshExportPK id;
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionId;
+
+ @Id
+ @Column(name = "EXPORT")
+ private String export;
public GsisshExportEntity() {
}
- public GsisshExportPK getId() {
- return id;
+ public String getSubmissionId() {
+ return submissionId;
+ }
+
+ public void setSubmissionId(String submissionId) {
+ this.submissionId = submissionId;
}
- public void setId(GsisshExportPK id) {
- this.id = id;
+ public String getExport() {
+ return export;
}
+
+ public void setExport(String export) {
+ this.export = export;
+ }
+
}
\ No newline at end of file

diff:
*/
package org.apache.airavata.registry.core.entities.appcatalog;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.io.Serializable;
/**
@@ -31,20 +29,35 @@ import java.io.Serializable;
*/
@Entity
@Table(name = "GSISSH_POSTJOBCOMMAND")
+@IdClass(GsisshPostjobcommandPK.class)
public class GsisshPostjobcommandEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private GsisshPostjobcommandPK id;
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionId;
+
+ @Id
+ @Column(name = "COMMAND")
+ private String command;
public GsisshPostjobcommandEntity() {
}
- public GsisshPostjobcommandPK getId() {
- return id;
+ public String getSubmissionId() {
+ return submissionId;
+ }
+
+ public void setSubmissionId(String submissionId) {
+ this.submissionId = submissionId;
}
- public void setId(GsisshPostjobcommandPK id) {
- this.id = id;
+ public String getCommand() {
+ return command;
}
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
}
\ No newline at end of file

diff:
*/
package org.apache.airavata.registry.core.entities.appcatalog;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.io.Serializable;
-
/**
* The persistent class for the gsissh_prejobcommand database table.
*/
@Entity
@Table(name = "GSISSH_PREJOBCOMMAND")
+@IdClass(GsisshPrejobcommandPK.class)
public class GsisshPrejobcommandEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private GsisshPrejobcommandPK id;
+ @Id
+ @Column(name = "SUBMISSION_ID")
+ private String submissionId;
+ @Id
+ @Column(name = "COMMAND")
+ private String command;
public GsisshPrejobcommandEntity() {
}
- public GsisshPrejobcommandPK getId() {
- return id;
+ public String getSubmissionId() {
+ return submissionId;
+ }
+
+ public void setSubmissionId(String submissionId) {
+ this.submissionId = submissionId;
}
- public void setId(GsisshPrejobcommandPK id) {
- this.id = id;
+ public String getCommand() {
+ return command;
}
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
}
\ No newline at end of file

diff:
@@ -28,11 +28,17 @@ import java.io.Serializable;
*/
@Entity
@Table(name = "JOB_MANAGER_COMMAND")
+@IdClass(JobManagerCommandPK.class)
public class JobManagerCommandEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private JobManagerCommandPK id;
+ @Id
+ @Column(name = "RESOURCE_JOB_MANAGER_ID")
+ private String resourceJobManagerId;
+
+ @Id
+ @Column(name = "COMMAND_TYPE")
+ private String commandType;
@Column(name = "COMMAND")
private String command;
@@ -44,20 +50,28 @@ public class JobManagerCommandEntity implements Serializable {
public JobManagerCommandEntity() {
}
- public ResourceJobManagerEntity getResourceJobManager() {
- return resourceJobManager;
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
}
- public void setResourceJobManager(ResourceJobManagerEntity resourceJobManager) {
- this.resourceJobManager = resourceJobManager;
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId = resourceJobManagerId;
+ }
+
+ public String getCommandType() {
+ return commandType;
}
- public JobManagerCommandPK getId() {
- return id;
+ public void setCommandType(String commandType) {
+ this.commandType = commandType;
}
- public void setId(JobManagerCommandPK id) {
- this.id = id;
+ public ResourceJobManagerEntity getResourceJobManager() {
+ return resourceJobManager;
+ }
+
+ public void setResourceJobManager(ResourceJobManagerEntity resourceJobManager) {
+ this.resourceJobManager = resourceJobManager;
}
public String getCommand() {

diff:
@@ -28,11 +28,17 @@ import java.io.Serializable;
*/
@Entity
@Table(name = "PARALLELISM_COMMAND")
+@IdClass(ParallelismCommandPK.class)
public class ParallelismCommandEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private ParallelismCommandPK id;
+ @Id
+ @Column(name = "RESOURCE_JOB_MANAGER_ID")
+ private String resourceJobManagerId;
+
+ @Id
+ @Column(name = "COMMAND_TYPE")
+ private String commandType;
@Column(name = "COMMAND")
private String command;
@@ -44,12 +50,20 @@ public class ParallelismCommandEntity implements Serializable {
public ParallelismCommandEntity() {
}
- public ParallelismCommandPK getId() {
- return id;
+ public String getResourceJobManagerId() {
+ return resourceJobManagerId;
+ }
+
+ public void setResourceJobManagerId(String resourceJobManagerId) {
+ this.resourceJobManagerId = resourceJobManagerId;
+ }
+
+ public String getCommandType() {
+ return commandType;
}
- public void setId(ParallelismCommandPK id) {
- this.id = id;
+ public void setCommandType(String commandType) {
+ this.commandType = commandType;
}
public String getCommand() {

diff:
*/
package org.apache.airavata.registry.core.entities.appcatalog;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
@@ -32,11 +29,17 @@ import java.sql.Timestamp;
*/
@Entity
@Table(name = "STORAGE_INTERFACE")
+@IdClass(StorageInterfacePK.class)
public class StorageInterfaceEntity implements Serializable {
private static final long serialVersionUID = 1L;
- @EmbeddedId
- private StorageInterfacePK id;
+ @Id
+ @Column(name = "STORAGE_RESOURCE_ID")
+ private String storageResourceId;
+
+ @Id
+ @Column(name = "DATA_MOVEMENT_INTERFACE_ID")
+ private String dataMovementInterfaceId;
@Column(name = "CREATION_TIME")
private Timestamp creationTime;
@@ -53,12 +56,20 @@ public class StorageInterfaceEntity implements Serializable {
public StorageInterfaceEntity() {
}
- public StorageInterfacePK getId() {
- return id;
+ public String getStorageResourceId() {
+ return storageResourceId;
+ }
+
+ public void setStorageResourceId(String storageResourceId) {
+ this.storageResourceId = storageResourceId;
+ }
+
+ public String getDataMovementInterfaceId() {
+ return dataMovementInterfaceId;
}
- public void setId(StorageInterfacePK id) {
- this.id = id;
+ public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+ this.dataMovementInterfaceId = dataMovementInterfaceId;
}
public Timestamp getCreationTime() {

diff:
@@ -363,12 +363,10 @@ public class ComputeResourceRepository extends AppCatAbstractRepository<ComputeR
List<String> gridFTPEndPoint = gridFTPDataMovement.getGridFTPEndPoints();
if (gridFTPEndPoint != null && !gridFTPEndPoint.isEmpty()) {
for (String endpoint : gridFTPEndPoint) {
- GridftpEndpointPK gridftpEndpointPK = new GridftpEndpointPK();
- gridftpEndpointPK.setDataMovementInterfaceId(gridFTPDataMovement.getDataMovementInterfaceId());
- gridftpEndpointPK.setEndpoint(endpoint);
GridftpEndpointEntity gridftpEndpointEntity = new GridftpEndpointEntity();
gridftpEndpointEntity.setGridftpDataMovement(gridftpDataMovementEntity);
- gridftpEndpointEntity.setId(gridftpEndpointPK);
+ gridftpEndpointEntity.setDataMovementInterfaceId(gridFTPDataMovement.getDataMovementInterfaceId());
+ gridftpEndpointEntity.setEndpoint(endpoint);
execute(entityManager -> entityManager.merge(gridftpEndpointEntity));
}
}

diff:
@@ -40,13 +40,11 @@ public class ResourceJobManagerRepository extends AppCatAbstractRepository<Resou
public void createJobManagerCommand(Map<JobManagerCommand, String> jobManagerCommands, ResourceJobManagerEntity resourceJobManagerEntity) {
for (JobManagerCommand commandType : jobManagerCommands.keySet()) {
if (jobManagerCommands.get(commandType) != null && !jobManagerCommands.get(commandType).isEmpty()) {
- JobManagerCommandPK jobManagerCommandPK = new JobManagerCommandPK();
- jobManagerCommandPK.setCommandType(commandType.toString());
- jobManagerCommandPK.setResourceJobManagerId(resourceJobManagerEntity.getResourceJobManagerId());
JobManagerCommandEntity jobManagerCommandEntity = new JobManagerCommandEntity();
jobManagerCommandEntity.setCommand(jobManagerCommands.get(commandType));
jobManagerCommandEntity.setResourceJobManager(resourceJobManagerEntity);
- jobManagerCommandEntity.setId(jobManagerCommandPK);
+ jobManagerCommandEntity.setResourceJobManagerId(resourceJobManagerEntity.getResourceJobManagerId());
+ jobManagerCommandEntity.setCommandType(commandType.toString());
execute(entityManager -> entityManager.merge(jobManagerCommandEntity));
}
}
@@ -55,13 +53,11 @@ public class ResourceJobManagerRepository extends AppCatAbstractRepository<Resou
public void createParallesimPrefix(Map<ApplicationParallelismType, String> parallelismPrefix,ResourceJobManagerEntity resourceJobManagerEntity) {
for (ApplicationParallelismType commandType : parallelismPrefix.keySet()) {
if (parallelismPrefix.get(commandType) != null && !parallelismPrefix.get(commandType).isEmpty()) {
- ParallelismCommandPK parallelismCommandPK = new ParallelismCommandPK();
- parallelismCommandPK.setCommandType(commandType.toString());
- parallelismCommandPK.setResourceJobManagerId(resourceJobManagerEntity.getResourceJobManagerId());
ParallelismCommandEntity parallelismCommandEntity = new ParallelismCommandEntity();
parallelismCommandEntity.setCommand(parallelismPrefix.get(commandType));
parallelismCommandEntity.setResourceJobManager(resourceJobManagerEntity);
- parallelismCommandEntity.setId(parallelismCommandPK);
+ parallelismCommandEntity.setCommandType(commandType.toString());
+ parallelismCommandEntity.setResourceJobManagerId(resourceJobManagerEntity.getResourceJobManagerId());
execute(entityManager -> entityManager.merge(parallelismCommandEntity));
}
}
@@ -82,7 +78,7 @@ public class ResourceJobManagerRepository extends AppCatAbstractRepository<Resou
List<JobManagerCommandEntity> jobManagerCommandEntityList = resultSet;
Map<JobManagerCommand, String> jobManagerCommandMap= new HashMap<JobManagerCommand,String>();
for (JobManagerCommandEntity jm: jobManagerCommandEntityList) {
- jobManagerCommandMap.put(JobManagerCommand.valueOf(jm.getId().getCommandType()), jm.getCommand());
+ jobManagerCommandMap.put(JobManagerCommand.valueOf(jm.getCommandType()), jm.getCommand());
}
return jobManagerCommandMap;
}
@@ -102,7 +98,7 @@ public class ResourceJobManagerRepository extends AppCatAbstractRepository<Resou
List<ParallelismCommandEntity> parallelismCommandEntityList = resultSet;
Map<ApplicationParallelismType, String> applicationParallelismTypeMap= new HashMap<ApplicationParallelismType,String>();
for (ParallelismCommandEntity pc: parallelismCommandEntityList) {
- applicationParallelismTypeMap.put(ApplicationParallelismType.valueOf(pc.getId().getCommandType()), pc.getCommand());
+ applicationParallelismTypeMap.put(ApplicationParallelismType.valueOf(pc.getCommandType()), pc.getCommand());
}
return applicationParallelismTypeMap;
}


message: Making changes to the tests

diff:
@@ -32,16 +32,16 @@ public class WorkflowCatalogJPAUtils {
private final static Logger logger = LoggerFactory.getLogger(WorkflowCatalogJPAUtils.class);
private static final String PERSISTENCE_UNIT_NAME = "workflowcatalog_data";
- private static final String WFCATALOG_JDBC_DRIVER = "wfcatalog.jdbc.driver";
- private static final String WFCATALOG_JDBC_URL = "wfcatalog.jdbc.url";
- private static final String WFCATALOG_JDBC_USER = "wfcatalog.jdbc.user";
- private static final String WFCATALOG_JDBC_PASSWORD = "wfcatalog.jdbc.password";
- private static final String WFCATALOG_VALIDATION_QUERY = "wfcatalog.validationQuery";
+ private static final String WFCATALOG_JDBC_DRIVER = "workflowcatalog.jdbc.driver";
+ private static final String WFCATALOG_JDBC_URL = "workflowcatalog.jdbc.url";
+ private static final String WFCATALOG_JDBC_USER = "workflowcatalog.jdbc.user";
+ private static final String WFCATALOG_JDBC_PASSWORD = "workflowcatalog.jdbc.password";
+ private static final String WFCATALOG_VALIDATION_QUERY = "workflowcatalog.validationQuery";
private static final String JPA_CACHE_SIZE = "jpa.cache.size";
private static final String JPA_CACHE_ENABLED = "cache.enable";
- @PersistenceUnit(unitName="workflowcatalog_data")
+ @PersistenceUnit(unitName=PERSISTENCE_UNIT_NAME)
protected static EntityManagerFactory factory;
- @PersistenceContext(unitName="worlkflowcatalog_data")
+ @PersistenceContext(unitName=PERSISTENCE_UNIT_NAME)
private static EntityManager wfCatEntityManager;
public static EntityManager getEntityManager() throws ApplicationSettingsException {
@@ -52,7 +52,7 @@ public class WorkflowCatalogJPAUtils {
"Password=" + readServerProperties(WFCATALOG_JDBC_PASSWORD) +
",validationQuery=" + readServerProperties(WFCATALOG_VALIDATION_QUERY);
System.out.println(connectionProperties);
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
properties.put("openjpa.ConnectionProperties", connectionProperties);
properties.put("openjpa.DynamicEnhancementAgent", "true");

diff:
@@ -200,8 +200,8 @@ public class Initialize {
executeSQL(sql.toString(), conn);
}
}catch (IOException e){
- logger.error("Error occurred while executing SQL script for creating Airavata Data Catalog database", e);
- throw new Exception("Error occurred while executing SQL script for creating Airavata Data Catalog database", e);
+ logger.error("Error occurred while executing SQL script for creating Airavata Replica Catalog database", e);
+ throw new Exception("Error occurred while executing SQL script for creating Airavata Replica Catalog database", e);
}finally {
if (reader != null) {
reader.close();

diff:
*/
package org.apache.airavata.registry.core.repositories.workflowcatalog;
+import org.apache.airavata.model.WorkflowModel;
+import org.apache.airavata.model.application.io.OutputDataObjectType;
import org.apache.airavata.registry.core.repositories.workflowcatalog.util.Initialize;
import org.apache.airavata.registry.cpi.WorkflowCatalogException;
import org.junit.After;
@@ -27,6 +29,11 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
public class WorkflowRepositoryTest {
private static Initialize initialize;
@@ -53,7 +60,45 @@ public class WorkflowRepositoryTest {
@Test
public void WorkflowRepositoryTest() throws WorkflowCatalogException {
+ WorkflowModel workflowModel1 = new WorkflowModel();
+ workflowModel1.setName("workflow1");
+ String templateId1 = workflowRepository.registerWorkflow(workflowModel1, gatewayId);
+ assertTrue(templateId1 != null);
+
+ workflowModel1.setCreatedUser("user1");
+ workflowRepository.updateWorkflow(templateId1, workflowModel1);
+
+ OutputDataObjectType outputDataObjectType1 = new OutputDataObjectType();
+ outputDataObjectType1.setName("outputKey1");
+ OutputDataObjectType outputDataObjectType2 = new OutputDataObjectType();
+ outputDataObjectType2.setName("outputKey2");
+ List<OutputDataObjectType> outputDataObjectTypeList = new ArrayList<>();
+ outputDataObjectTypeList.add(outputDataObjectType1);
+ outputDataObjectTypeList.add(outputDataObjectType2);
+ workflowRepository.updateWorkflowOutputs(templateId1, outputDataObjectTypeList);
+
+ WorkflowModel retrievedWorkflowModel = workflowRepository.getWorkflow(templateId1);
+ assertEquals(gatewayId, retrievedWorkflowModel.getGatewayId());
+ assertEquals(workflowModel1.getCreatedUser(), retrievedWorkflowModel.getCreatedUser());
+ assertTrue(retrievedWorkflowModel.getWorkflowOutputs().size() == 2);
+
+ WorkflowModel workflowModel2 = new WorkflowModel();
+ workflowModel2.setName("workflow2");
+ String templateId2 = workflowRepository.registerWorkflow(workflowModel2, gatewayId);
+ assertTrue(templateId2 != null);
+
+ List<String> workflows = workflowRepository.getAllWorkflows(gatewayId);
+ assertTrue(workflows.size() == 2);
+
+ String retrievedTemplateId = workflowRepository.getWorkflowTemplateId(workflowModel1.getName());
+ assertEquals(templateId1, retrievedTemplateId);
+
+ assertTrue(workflowRepository.isWorkflowExistWithName(workflowModel2.getName()));
+
+ workflowRepository.deleteWorkflow(templateId1);
+ assertFalse(workflowRepository.isWorkflowExistWithName(workflowModel1.getName()));
+ workflowRepository.deleteWorkflow(templateId2);
}
}

diff:
@@ -36,7 +36,7 @@ import java.sql.*;
import java.util.StringTokenizer;
public class Initialize {
- private static final Logger logger = LoggerFactory.getLogger(org.apache.airavata.registry.core.repositories.workflowcatalog.util.Initialize.class);
+ private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
public String scriptName = "workflowcatalog-derby.sql";
private NetworkServerControl server;
@@ -200,8 +200,8 @@ public class Initialize {
executeSQL(sql.toString(), conn);
}
}catch (IOException e){
- logger.error("Error occurred while executing SQL script for creating Airavata Data Catalog database", e);
- throw new Exception("Error occurred while executing SQL script for creating Airavata Data Catalog database", e);
+ logger.error("Error occurred while executing SQL script for creating Airavata Workflow Catalog database", e);
+ throw new Exception("Error occurred while executing SQL script for creating Airavata Workflow Catalog database", e);
}finally {
if (reader != null) {
reader.close();

original_message: Making changes to the tests


message: Making changes to method calls in RegistryServerHandler

diff:
@@ -74,6 +74,7 @@ import org.apache.airavata.registry.core.repositories.appcatalog.GwyResourceProf
import org.apache.airavata.registry.core.repositories.replicacatalog.DataProductRepository;
import org.apache.airavata.registry.core.repositories.replicacatalog.DataReplicaLocationRepository;
import org.apache.airavata.registry.core.repositories.appcatalog.UserResourceProfileRepository;
+import org.apache.airavata.registry.core.repositories.workflowcatalog.WorkflowRepository;
import org.apache.airavata.registry.cpi.*;
import org.apache.airavata.registry.cpi.utils.Constants;
import org.apache.thrift.TException;
@@ -87,12 +88,12 @@ public class RegistryServerHandler implements RegistryService.Iface {
private ExperimentCatalog experimentCatalog;
private AppCatalog appCatalog;
- private WorkflowCatalog workflowCatalog;
private ApplicationDeploymentRepository applicationDeploymentRepository = new ApplicationDeploymentRepository();
private ApplicationInterfaceRepository applicationInterfaceRepository = new ApplicationInterfaceRepository();
private UserResourceProfileRepository userResourceProfileRepository = new UserResourceProfileRepository();
private DataProductRepository dataProductRepository = new DataProductRepository();
private DataReplicaLocationRepository dataReplicaLocationRepository = new DataReplicaLocationRepository();
+ private WorkflowRepository workflowRepository = new WorkflowRepository();
/**
* Fetch Apache Registry API version
@@ -2034,7 +2035,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
}
- appCatalog = RegistryFactory.getAppCatalog();
GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
ComputeResourceRepository computeResourceRepository = new ComputeResourceRepository();
if (!gwyResourceProfileRepository.isGatewayResourceProfileExists(gatewayID)){
@@ -2075,7 +2075,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
}
- appCatalog = RegistryFactory.getAppCatalog();
GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
if (!gwyResourceProfileRepository.isGatewayResourceProfileExists(gatewayID)){
logger.error(gatewayID, "Given gateway profile does not exist in the system. Please provide a valid gateway id...");
@@ -2226,7 +2225,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
}
try {
- return getWorkflowCatalog().getAllWorkflows(gatewayId);
+ return workflowRepository.getAllWorkflows(gatewayId);
} catch (WorkflowCatalogException e) {
String msg = "Error in retrieving all workflow template Ids.";
logger.error(msg, e);
@@ -2244,7 +2243,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
@Override
public WorkflowModel getWorkflow(String workflowTemplateId) throws RegistryServiceException, TException {
try {
- return getWorkflowCatalog().getWorkflow(workflowTemplateId);
+ return workflowRepository.getWorkflow(workflowTemplateId);
} catch (WorkflowCatalogException e) {
String msg = "Error in retrieving the workflow "+workflowTemplateId+".";
logger.error(msg, e);
@@ -2257,7 +2256,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
@Override
public void deleteWorkflow(String workflowTemplateId) throws RegistryServiceException, TException {
try {
- getWorkflowCatalog().deleteWorkflow(workflowTemplateId);
+ workflowRepository.deleteWorkflow(workflowTemplateId);
} catch (WorkflowCatalogException e) {
String msg = "Error in deleting the workflow "+workflowTemplateId+".";
logger.error(msg, e);
@@ -2270,7 +2269,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
@Override
public String getWorkflowTemplateId(String workflowName) throws RegistryServiceException, TException {
try {
- return getWorkflowCatalog().getWorkflowTemplateId(workflowName);
+ return workflowRepository.getWorkflowTemplateId(workflowName);
} catch (WorkflowCatalogException e) {
String msg = "Error in retrieving the workflow template id for "+workflowName+".";
logger.error(msg, e);
@@ -2283,7 +2282,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
@Override
public boolean isWorkflowExistWithName(String workflowName) throws RegistryServiceException, TException {
try {
- return getWorkflowCatalog().isWorkflowExistWithName(workflowName);
+ return workflowRepository.isWorkflowExistWithName(workflowName);
} catch (WorkflowCatalogException e) {
String msg = "Error in veriying the workflow for workflow name "+workflowName+".";
logger.error(msg, e);
@@ -2627,7 +2626,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
@Override
public void updateWorkflow(String workflowTemplateId, WorkflowModel workflow) throws RegistryServiceException, TException {
try {
- getWorkflowCatalog().updateWorkflow(workflowTemplateId, workflow);
+ workflowRepository.updateWorkflow(workflowTemplateId, workflow);
} catch (WorkflowCatalogException e) {
String msg = "Error in updating the workflow "+workflow.getName()+".";
logger.error(msg, e);
@@ -2644,7 +2643,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
}
try {
- return getWorkflowCatalog().registerWorkflow(workflow, gatewayId);
+ return workflowRepository.registerWorkflow(workflow, gatewayId);
} catch (WorkflowCatalogException e) {
String msg = "Error in registering the workflow "+workflow.getName()+".";
logger.error(msg, e);
@@ -4293,17 +4292,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
return computeResource.addDataMovementProtocol(computeResourceId, dmType, dataMovementInterface);
}
- private WorkflowCatalog getWorkflowCatalog() {
- if (workflowCatalog == null) {
- try {
- workflowCatalog = RegistryFactory.getAppCatalog().getWorkflowCatalog();
- } catch (Exception e) {
- logger.error("Unable to create Workflow Catalog", e);
- }
- }
- return workflowCatalog;
- }
-
/**
* Register a User Resource Profile.
*