From b39509088a320c5c60b26f74ced3f420d217c376 Mon Sep 17 00:00:00 2001 From: Manamohan Date: Thu, 12 Dec 2019 15:15:46 +0530 Subject: Implementing scope and action values from SO-DB to SO-Backend Issue-ID: SO-2513 Change-Id: I002a35a2a8ff4730d45c23d54f0acd4496b8b585 Signed-off-by: Manamohan --- ...ndActionColumnsInOrchestrationFlowReference.sql | 5 ++++ .../src/test/resources/schema.sql | 2 ++ asdc-controller/src/test/resources/schema.sql | 2 ++ .../entities/BuildingBlock.java | 21 ++++++++++++++ .../workflow/tasks/WorkflowAction.java | 5 ++++ .../db/catalog/beans/macro/OrchestrationFlow.java | 33 +++++++++++++++++++--- mso-catalog-db/src/test/resources/schema.sql | 2 ++ 7 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.2__AddScopeAndActionColumnsInOrchestrationFlowReference.sql diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.2__AddScopeAndActionColumnsInOrchestrationFlowReference.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.2__AddScopeAndActionColumnsInOrchestrationFlowReference.sql new file mode 100644 index 0000000000..19bfb0f1e1 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.2__AddScopeAndActionColumnsInOrchestrationFlowReference.sql @@ -0,0 +1,5 @@ +use catalogdb; + +ALTER TABLE orchestration_flow_reference +ADD SCOPE VARCHAR (200) DEFAULT NULL, +ADD ACTION VARCHAR (200) DEFAULT NULL; \ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql index b96d58f419..6b791e789c 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -735,6 +735,8 @@ CREATE TABLE `orchestration_flow_reference` ( `SEQ_NO` int(11) NOT NULL, `FLOW_NAME` varchar(200) NOT NULL, `FLOW_VERSION` double NOT NULL, + `SCOPE` varchar(200) DEFAULT NULL, + `ACTION` varchar(200) DEFAULT NULL, `NB_REQ_REF_LOOKUP_ID` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`), diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index ed6cb89bf6..0821ebc97c 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -738,6 +738,8 @@ CREATE TABLE `orchestration_flow_reference` ( `SEQ_NO` int(11) NOT NULL, `FLOW_NAME` varchar(200) NOT NULL, `FLOW_VERSION` double NOT NULL, + `SCOPE` varchar(200) DEFAULT NULL, + `ACTION` varchar(200) DEFAULT NULL, `NB_REQ_REF_LOOKUP_ID` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`), diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java index 1f689e97e3..c1591ad984 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -39,6 +39,10 @@ public class BuildingBlock implements Serializable { private Boolean isVirtualLink; @JsonProperty("virtual-link-key") private String virtualLinkKey; + @JsonProperty("scope") + private String bpmnScope; + @JsonProperty("action") + private String bpmnAction; public String getBpmnFlowName() { return bpmnFlowName; @@ -79,4 +83,21 @@ public class BuildingBlock implements Serializable { public void setVirtualLinkKey(String virtualLinkKey) { this.virtualLinkKey = virtualLinkKey; } + + public String getBpmnScope() { + return bpmnScope; + } + + public void setBpmnScope(String scope) { + this.bpmnScope = scope; + } + + public String getBpmnAction() { + return bpmnAction; + } + + public void setBpmnAction(String action) { + this.bpmnAction = action; + } + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 58bf17f08b..92dd03289c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -1511,6 +1511,11 @@ public class WorkflowAction { boolean isVirtualLink, String virtualLinkKey, boolean isConfiguration) { ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); BuildingBlock buildingBlock = new BuildingBlock(); + + Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(action -> buildingBlock.setBpmnAction(action)); + Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(scope -> buildingBlock.setBpmnScope(scope)); + + buildingBlock.setBpmnFlowName(orchFlow.getFlowName()); buildingBlock.setMsoId(UUID.randomUUID().toString()); if (resource == null) { diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java index b74ade1e1f..91b74d4d6a 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java @@ -34,7 +34,6 @@ import javax.persistence.Table; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; -import org.onap.so.db.catalog.beans.BuildingBlockDetail; import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; @@ -65,6 +64,14 @@ public class OrchestrationFlow implements Serializable { @Column(name = "FLOW_VERSION") private Double flowVersion; + @BusinessKey + @Column(name = "ACTION") + private String bpmnAction; + + @BusinessKey + @Column(name = "SCOPE") + private String bpmnScope; + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "NB_REQ_REF_LOOKUP_ID") private NorthBoundRequest northBoundRequest; @@ -73,7 +80,8 @@ public class OrchestrationFlow implements Serializable { public String toString() { return new ToStringBuilder(this).append("id", id).append("action", action) .append("sequenceNumber", sequenceNumber).append("flowName", flowName) - .append("flowVersion", flowVersion).toString(); + .append("flowVersion", flowVersion).append("bpmnAction", bpmnAction).append("bpmnScope", bpmnScope) + .toString(); } @Override @@ -83,13 +91,14 @@ public class OrchestrationFlow implements Serializable { } OrchestrationFlow castOther = (OrchestrationFlow) other; return new EqualsBuilder().append(action, castOther.action).append(sequenceNumber, castOther.sequenceNumber) - .append(flowName, castOther.flowName).append(flowVersion, castOther.flowVersion).isEquals(); + .append(flowName, castOther.flowName).append(flowVersion, castOther.flowVersion) + .append(bpmnAction, castOther.bpmnAction).append(bpmnScope, castOther.bpmnScope).isEquals(); } @Override public int hashCode() { return new HashCodeBuilder().append(action).append(sequenceNumber).append(flowName).append(flowVersion) - .toHashCode(); + .append(bpmnAction).append(bpmnScope).toHashCode(); } public String getAction() { @@ -132,6 +141,22 @@ public class OrchestrationFlow implements Serializable { this.id = id; } + public String getBpmnAction() { + return bpmnAction; + } + + public void setBpmnAction(String bpmnAction) { + this.bpmnAction = bpmnAction; + } + + public String getBpmnScope() { + return bpmnScope; + } + + public void setBpmnScope(String bpmnScope) { + this.bpmnScope = bpmnScope; + } + @LinkedResource public NorthBoundRequest getNorthBoundRequest() { return northBoundRequest; diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index 67584133f8..573d391980 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -736,6 +736,8 @@ CREATE TABLE `orchestration_flow_reference` ( `SEQ_NO` int(11) NOT NULL, `FLOW_NAME` varchar(200) NOT NULL, `FLOW_VERSION` double NOT NULL, + `SCOPE` varchar(200) DEFAULT NULL, + `ACTION` varchar(200) DEFAULT NULL, `NB_REQ_REF_LOOKUP_ID` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`), -- cgit 1.2.3-korg