summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin, Max <max.benjamin@att.com>2020-06-24 10:44:53 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-06-30 09:38:04 -0400
commit71d87a36d125d6df59caab045553efa58125c508 (patch)
treef8a60d00096b5851d15fa912c255b2170b9d47b1
parent4e708254b1914cee9b3a375374b9b1e486625c1b (diff)
merged ONAP refactor and fluent builder method
WorkflowAction refactoring merged ONAP refactor and fluent builder method types Issue-ID: SO-3005 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I5c2a7dbcdf645efe408f81c1abbc7bfe8770fe9e
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml16
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java101
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java86
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml2
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java91
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml2
-rw-r--r--pom.xml4
12 files changed, 145 insertions, 193 deletions
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 0201dd6776..bfb600f3ba 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -73,14 +73,14 @@
</plugin>
</plugins>
<pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 9cee2882be..893f50c458 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -263,7 +263,7 @@
<artifactId>openstack4j-jersey2</artifactId>
<version>3.2.0</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22.1</version>
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index ba179b6717..55e59d134e 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -280,7 +280,7 @@
</ignore>
</action>
</pluginExecution>
- <pluginExecution>
+ <pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 0c320faf8a..8bc9501fbd 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -16,7 +16,7 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
- <pluginManagement>
+ <pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java
new file mode 100644
index 0000000000..5be06f9be2
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java
@@ -0,0 +1,101 @@
+package org.onap.so.bpmn.servicedecomposition.entities;
+
+import java.io.Serializable;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+
+public abstract class BuildingBlockBase<T extends BuildingBlockBase<T>> implements Serializable {
+
+ private static final long serialVersionUID = 4671883098039479717L;
+
+ private Boolean aLaCarte;
+ private String apiVersion;
+ private Boolean isResume;
+ private String resourceId;
+ private String requestId;
+ private String requestAction;
+ private RequestDetails requestDetails;
+ private WorkflowResourceIds workflowResourceIds;
+ private String vnfType;
+
+ public T setaLaCarte(Boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ return (T) this;
+ }
+
+ public T setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ return (T) this;
+ }
+
+ public T setResume(Boolean resume) {
+ isResume = resume;
+ return (T) this;
+ }
+
+ public T setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ return (T) this;
+ }
+
+ public T setRequestId(String requestId) {
+ this.requestId = requestId;
+ return (T) this;
+ }
+
+ public T setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ return (T) this;
+ }
+
+ public T setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ return (T) this;
+ }
+
+ public T setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
+ this.workflowResourceIds = workflowResourceIds;
+ return (T) this;
+ }
+
+ public T setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ return (T) this;
+ }
+
+ public Boolean isResume() {
+ return isResume;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public String getRequestAction() {
+ return requestAction;
+ }
+
+ public Boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public WorkflowResourceIds getWorkflowResourceIds() {
+ return workflowResourceIds;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
index abd301fa4d..e867b670b7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
@@ -23,20 +23,12 @@ package org.onap.so.bpmn.servicedecomposition.entities;
import java.io.Serializable;
import org.onap.so.serviceinstancebeans.RequestDetails;
-public class ExecuteBuildingBlock implements Serializable {
+public class ExecuteBuildingBlock extends BuildingBlockBase<ExecuteBuildingBlock> implements Serializable {
- private static final long serialVersionUID = 2L;
private BuildingBlock buildingBlock;
- private String requestId;
- private String apiVersion;
- private String resourceId;
- private String requestAction;
- private String vnfType;
- private Boolean aLaCarte;
- private Boolean homing = false;
- private WorkflowResourceIds workflowResourceIds;
- private RequestDetails requestDetails;
private ConfigurationResourceKeys configurationResourceKeys;
+ private Boolean homing = false;
+ private static final long serialVersionUID = 3L;
public BuildingBlock getBuildingBlock() {
return buildingBlock;
@@ -47,60 +39,6 @@ public class ExecuteBuildingBlock implements Serializable {
return this;
}
- public String getRequestId() {
- return requestId;
- }
-
- public ExecuteBuildingBlock setRequestId(String requestId) {
- this.requestId = requestId;
- return this;
- }
-
- public String getApiVersion() {
- return apiVersion;
- }
-
- public ExecuteBuildingBlock setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- return this;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public ExecuteBuildingBlock setResourceId(String resourceId) {
- this.resourceId = resourceId;
- return this;
- }
-
- public String getRequestAction() {
- return requestAction;
- }
-
- public ExecuteBuildingBlock setRequestAction(String requestAction) {
- this.requestAction = requestAction;
- return this;
- }
-
- public Boolean isaLaCarte() {
- return aLaCarte;
- }
-
- public ExecuteBuildingBlock setaLaCarte(Boolean aLaCarte) {
- this.aLaCarte = aLaCarte;
- return this;
- }
-
- public String getVnfType() {
- return vnfType;
- }
-
- public ExecuteBuildingBlock setVnfType(String vnfType) {
- this.vnfType = vnfType;
- return this;
- }
-
public Boolean isHoming() {
return homing;
}
@@ -110,24 +48,6 @@ public class ExecuteBuildingBlock implements Serializable {
return this;
}
- public WorkflowResourceIds getWorkflowResourceIds() {
- return workflowResourceIds;
- }
-
- public ExecuteBuildingBlock setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
- this.workflowResourceIds = workflowResourceIds;
- return this;
- }
-
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
-
- public ExecuteBuildingBlock setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- return this;
- }
-
public ConfigurationResourceKeys getConfigurationResourceKeys() {
return configurationResourceKeys;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 92bf43f982..075f6f8fdd 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -55,7 +55,7 @@
</plugins>
<pluginManagement>
<plugins>
- <plugin>
+ <plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index dec9560574..f7a4e5e357 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -210,7 +210,7 @@
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
- <exclusion>
+ <exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
index 1852485083..e154375d3d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
@@ -22,25 +22,22 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.List;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlockBase;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import java.io.Serializable;
+import java.util.List;
-public class ConfigBuildingBlocksDataObject {
+public class ConfigBuildingBlocksDataObject extends BuildingBlockBase<ConfigBuildingBlocksDataObject>
+ implements Serializable {
- private ServiceInstancesRequest sIRequest;
+ private static final long serialVersionUID = 3L;
+ private DelegateExecution execution;
private List<OrchestrationFlow> orchFlows;
- private String requestId;
private Resource resourceKey;
- private String apiVersion;
- private String resourceId;
- private String requestAction;
- private boolean aLaCarte;
- private String vnfType;
- private WorkflowResourceIds workflowResourceIds;
- private RequestDetails requestDetails;
- private DelegateExecution execution;
+ private ServiceInstancesRequest sIRequest;
public ServiceInstancesRequest getsIRequest() {
return sIRequest;
@@ -60,15 +57,6 @@ public class ConfigBuildingBlocksDataObject {
return this;
}
- public String getRequestId() {
- return requestId;
- }
-
- public ConfigBuildingBlocksDataObject setRequestId(String requestId) {
- this.requestId = requestId;
- return this;
- }
-
public Resource getResourceKey() {
return resourceKey;
}
@@ -78,69 +66,6 @@ public class ConfigBuildingBlocksDataObject {
return this;
}
- public String getApiVersion() {
- return apiVersion;
- }
-
- public ConfigBuildingBlocksDataObject setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- return this;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public ConfigBuildingBlocksDataObject setResourceId(String resourceId) {
- this.resourceId = resourceId;
- return this;
- }
-
- public String getRequestAction() {
- return requestAction;
- }
-
- public ConfigBuildingBlocksDataObject setRequestAction(String requestAction) {
- this.requestAction = requestAction;
- return this;
- }
-
- public boolean isaLaCarte() {
- return aLaCarte;
- }
-
- public ConfigBuildingBlocksDataObject setaLaCarte(boolean aLaCarte) {
- this.aLaCarte = aLaCarte;
- return this;
- }
-
- public String getVnfType() {
- return vnfType;
- }
-
- public ConfigBuildingBlocksDataObject setVnfType(String vnfType) {
- this.vnfType = vnfType;
- return this;
- }
-
- public WorkflowResourceIds getWorkflowResourceIds() {
- return workflowResourceIds;
- }
-
- public ConfigBuildingBlocksDataObject setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
- this.workflowResourceIds = workflowResourceIds;
- return this;
- }
-
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
-
- public ConfigBuildingBlocksDataObject setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- return this;
- }
-
public DelegateExecution getExecution() {
return execution;
}
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 a057fe0102..25c22867fa 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
@@ -176,25 +176,32 @@ public class WorkflowAction {
final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
ServiceInstancesRequest sIRequest =
new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
- RequestDetails requestDetails = sIRequest.getRequestDetails();
- String uri = (String) execution.getVariable(BBConstants.G_URI);
+
final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
- final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+
+ String uri = (String) execution.getVariable(BBConstants.G_URI);
boolean isResume = isUriResume(uri);
- String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
+
+ final boolean isALaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ Resource resource = getResource(bbInputSetupUtils, isResume, isALaCarte, uri, requestId);
+
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
- Resource resource = getResource(bbInputSetupUtils, isResume, aLaCarte, uri, requestId);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
String resourceId = getResourceId(resource, requestAction, requestDetails, workflowResourceIds);
WorkflowType resourceType = resource.getResourceType();
+
String serviceInstanceId = getServiceInstanceId(execution, resourceId, resourceType);
+
fillExecution(execution, requestDetails.getRequestInfo().getSuppressRollback(), resourceId, resourceType);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
- if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
+
+ if (isRequestMacroServiceResume(isALaCarte, resourceType, requestAction, serviceInstanceId)) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
if (flowsToExecute == null) {
buildAndThrowException(execution, "Could not resume Macro flow. Error loading execution path.");
}
- } else if (aLaCarte && isResume) {
+ } else if (isALaCarte && isResume) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
if (flowsToExecute == null) {
buildAndThrowException(execution,
@@ -208,14 +215,13 @@ public class WorkflowAction {
final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
final String serviceType =
Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
- if (aLaCarte) {
+ if (isALaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, true,
cloudOwner, serviceType);
}
Resource resourceKey = getResourceKey(sIRequest, resourceType);
- boolean isConfiguration = isConfiguration(orchFlows);
- if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ if (isConfiguration(orchFlows) && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
.setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
@@ -319,7 +325,7 @@ public class WorkflowAction {
logger.info("Found {}", foundObjects);
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, isALaCarte,
cloudOwner, serviceType);
}
boolean vnfReplace = false;
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index 2f25d409d2..afb734d46e 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -265,7 +265,7 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
- <pluginManagement>
+ <pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
diff --git a/pom.xml b/pom.xml
index b2fd0d5898..ae743ac383 100644
--- a/pom.xml
+++ b/pom.xml
@@ -535,7 +535,7 @@
</plugins>
<pluginManagement>
<plugins>
- <plugin>
+ <plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
@@ -555,7 +555,7 @@
<execute />
</action>
</pluginExecution>
- <pluginExecution>
+ <pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>