diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org/onap')
2 files changed, 25 insertions, 94 deletions
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; |