aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2020-03-20 15:55:09 +0100
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2020-03-20 15:56:26 +0100
commit7e5054eb95756feb5aa770c751994c27368333ac (patch)
tree06a6b27fa8ee51add73162e38a44da4e4eb1fc12 /bpmn/so-bpmn-tasks/src/main
parenta1403e188b01e2c10aded4a6cb7bcd9313147ed9 (diff)
workflowAction refactor
- move variable declaration to the place where it is used - simplify the code Issue-ID: SO-2634 Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com> Change-Id: I7da1dac5c24907358f0949e361edc502fe6b7092
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java41
1 files changed, 15 insertions, 26 deletions
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 f8a4d910f4..eead1761ea 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
@@ -169,12 +169,7 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
- final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
- final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
- final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
- String uri = (String) execution.getVariable(BBConstants.G_URI);
final String vnfType = (String) execution.getVariable(VNF_TYPE);
String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
final String createInstanceAction = "createInstance";
@@ -183,40 +178,34 @@ public class WorkflowAction {
List<OrchestrationFlow> orchFlows =
(List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
try {
- ObjectMapper mapper = new ObjectMapper();
- execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
- ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
+ ServiceInstancesRequest sIRequest =
+ new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- boolean suppressRollback = false;
- try {
- suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
- } catch (Exception ex) {
- logger.warn("Exception in getSuppressRollback", ex);
- suppressRollback = false;
- }
- execution.setVariable("suppressRollback", suppressRollback);
- boolean isResume = false;
- if (isUriResume(uri)) {
- isResume = true;
- if (!aLaCarte) {
- logger.debug("replacing URI {}", uri);
- uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
- logger.debug("for RESUME with original value {}", uri);
- }
+ execution.setVariable("suppressRollback", requestDetails.getRequestInfo().getSuppressRollback());
+ 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);
+ boolean isResume = isUriResume(uri);
+ if (!aLaCarte && isResume) {
+ logger.debug("replacing URI {}", uri);
+ uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
+ logger.debug("for RESUME with original value {}", uri);
}
Resource resource = extractResourceIdAndTypeFromUri(uri);
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
+ final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction)
&& sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
@@ -230,7 +219,7 @@ public class WorkflowAction {
}
execution.setVariable("resourceId", resourceId);
execution.setVariable("resourceType", resourceType);
-
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
if (flowsToExecute == null) {