aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2020-11-12 18:58:01 +0100
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2020-11-12 18:58:54 +0100
commit6b92778120393c34d2df84ccaa2dc9f6fa8068fd (patch)
treee463302e22c38e8f2d44be7372dc7b6ae8f41342
parent7bf89598ae02ddc799eb240c1a1d0d7319dadda9 (diff)
FlowManipulatorListenerRunner bug fix
Issue-ID: SO-3375 Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com> Change-Id: Ib63c3a93ab191720924805fcd5e72f1bc51c2ba8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
index ea7de687ee..c02afc3327 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2020 Nokia.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,6 +28,7 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
+import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.listener.ListenerRunner;
@@ -49,17 +52,21 @@ public class FlowManipulatorListenerRunner extends ListenerRunner {
}
public void modifyFlows(List<ExecuteBuildingBlock> flowsToExecute, BuildingBlockExecution execution) {
+ int sequenceBeforeFlowManipulator;
+ do {
+ sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
+ List<FlowManipulator> filtered = filterListeners(flowManipulators,
+ (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
+ execution.getCurrentSequence() == 0, execution)));
- ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
- List<FlowManipulator> filtered = filterListeners(flowManipulators,
- (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
- execution.getCurrentSequence() == 0, execution)));
-
- logger.info("Running flow manipulators:\n{}",
- filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
- filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution));
-
+ logger.info("Running flow manipulators:\n{}",
+ filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
+ filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution));
+ } while (isBuildingBlockSkipped(sequenceBeforeFlowManipulator, execution));
}
-
+ private boolean isBuildingBlockSkipped(int sequenceBeforeFlowManipulator, BuildingBlockExecution execution) {
+ return sequenceBeforeFlowManipulator != (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ }
}