diff options
author | Steve Smokowski <ss835w@att.com> | 2020-06-07 09:25:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-06-07 09:25:54 +0000 |
commit | 9b78caf92e4a362850a242f04871644dafc20f62 (patch) | |
tree | 534a7d8bfabfb7b08a1b677ffde873ae81c97a70 /bpmn/so-bpmn-tasks/src/main/java | |
parent | a3b0c74345d2dbf981d49493ef498e28e867a144 (diff) | |
parent | 6bf6e8513cf347e0ee4d55a7f54ac21a1b0ee0f6 (diff) |
Merge "Add ChangeModelVnfBB and"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java | 25 |
1 files changed, 25 insertions, 0 deletions
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<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + + List<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> 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); |