From 6bf6e8513cf347e0ee4d55a7f54ac21a1b0ee0f6 Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat" Date: Thu, 4 Jun 2020 17:20:37 -0400 Subject: Add ChangeModelVnfBB and Add ChangeModelVnfBB and ChangeModelServiceInstanceBB as part of fallout for vfmodule replace flow Update to execute the ChangeModelVnfBB and ChangeModelServiceInstanceBB flows for fallout in vfmodule replace flow Update the logic to the ChangeBB list Issue-ID: SO-2976 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Id50d7ecd2abdd18178fbe2566c247e0c57b54353 --- .../workflow/tasks/WorkflowActionBBTasks.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'bpmn/so-bpmn-tasks/src/main/java/org') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 0ddafa0b44..9d68b5a3f0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -74,6 +74,8 @@ public class WorkflowActionBBTasks { private static final String COMPLETED = "completed"; private static final String HANDLINGCODE = "handlingCode"; private static final String ROLLBACKTOCREATED = "RollbackToCreated"; + private static final String REPLACEINSTANCE = "replaceInstance"; + private static final String VFMODULE = "VfModule"; protected String maxRetries = "mso.rainyDay.maxRetries"; private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @@ -286,12 +288,23 @@ public class WorkflowActionBBTasks { * working on. */ public void rollbackExecutionPath(DelegateExecution execution) { + final String action = (String) execution.getVariable(G_ACTION); + final String resourceName = (String) execution.getVariable("resourceName"); if (!(boolean) execution.getVariable("isRollback")) { List flowsToExecute = (List) execution.getVariable("flowsToExecute"); + + List flowsToExecuteChangeBBs = new ArrayList(); + for (int i = 0; i < flowsToExecute.size(); i++) { + if (flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName().startsWith("Change")) { + flowsToExecuteChangeBBs.add(flowsToExecute.get(i)); + } + } + List rollbackFlows = new ArrayList(); int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); int listSize = flowsToExecute.size(); + for (int i = listSize - 1; i >= 0; i--) { if (i > currentSequence - 1) { flowsToExecute.remove(i); @@ -340,6 +353,18 @@ public class WorkflowActionBBTasks { } } + List rollbackFlowsFilteredNonChangeBBs = new ArrayList(); + if (action.equals(REPLACEINSTANCE) && resourceName.equals(VFMODULE)) { + for (int i = 0; i < rollbackFlowsFiltered.size(); i++) { + if (!rollbackFlowsFiltered.get(i).getBuildingBlock().getBpmnFlowName().startsWith("Change")) { + rollbackFlowsFilteredNonChangeBBs.add(rollbackFlowsFiltered.get(i)); + } + } + rollbackFlowsFiltered.clear(); + rollbackFlowsFiltered.addAll(flowsToExecuteChangeBBs); + rollbackFlowsFiltered.addAll(rollbackFlowsFilteredNonChangeBBs); + } + workflowActionBBFailure.updateRequestErrorStatusMessage(execution); if (rollbackFlows.isEmpty()) execution.setVariable("isRollbackNeeded", false); -- cgit 1.2.3-korg