summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-06-30 17:37:54 +0000
committerGerrit Code Review <gerrit@onap.org>2020-06-30 17:37:54 +0000
commit0072098e9f28c124080c6b94e6f5aceb9eb2c608 (patch)
tree34255f13c6562fb14c5c027c3abd73eb7c3ebfd5 /bpmn
parent670f246573516471bc8e76c51fd5fd17a24d3e43 (diff)
parent71d87a36d125d6df59caab045553efa58125c508 (diff)
Merge "merged ONAP refactor and fluent builder method"
Diffstat (limited to 'bpmn')
-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
6 files changed, 131 insertions, 179 deletions
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 09c7a661e0..cc89d00e29 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;