summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN
diff options
context:
space:
mode:
authorBENJAMIN, MAX <max.benjamin@att.com>2021-03-04 10:07:33 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2021-03-04 11:41:43 -0500
commitf57d65ca73dc1080d0228b5ca979a9b41bd85543 (patch)
tree617ad56464a23371fd471c0b5faf825d586043d2 /bpmn/MSOCommonBPMN
parentcd6d26a641122eb2daf51f51ed2d9ec39ec271f8 (diff)
create post flow manipulator
create post flow manipulator Issue-ID: SO-3568 Signed-off-by: AT&T Open Source <g22940@att.com> Change-Id: I8afe9cb0184c1f52754097f9912e123e56cfab98 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java5
3 files changed, 34 insertions, 4 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 c02afc3327..054cc378ef 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
@@ -41,13 +41,18 @@ public class FlowManipulatorListenerRunner extends ListenerRunner {
private static Logger logger = LoggerFactory.getLogger(FlowManipulatorListenerRunner.class);
- protected List<FlowManipulator> flowManipulators;
+ protected List<PreFlowManipulator> flowManipulators;
+
+ protected List<PostFlowManipulator> postflowManipulators;
@PostConstruct
protected void init() {
flowManipulators = new ArrayList<>(
- Optional.ofNullable(context.getBeansOfType(FlowManipulator.class)).orElse(new HashMap<>()).values());
+ Optional.ofNullable(context.getBeansOfType(PreFlowManipulator.class)).orElse(new HashMap<>()).values());
+
+ postflowManipulators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PostFlowManipulator.class))
+ .orElse(new HashMap<>()).values());
}
@@ -56,11 +61,26 @@ public class FlowManipulatorListenerRunner extends ListenerRunner {
do {
sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
- List<FlowManipulator> filtered = filterListeners(flowManipulators,
+ List<PreFlowManipulator> filtered = filterListeners(flowManipulators,
+ (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
+ execution.getCurrentSequence() == 0, execution)));
+
+ logger.info("Running pre 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));
+ }
+
+ public void postModifyFlows(List<ExecuteBuildingBlock> flowsToExecute, BuildingBlockExecution execution) {
+ int sequenceBeforeFlowManipulator;
+ do {
+ sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence() - 1);
+ List<PostFlowManipulator> filtered = filterListeners(postflowManipulators,
(item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
execution.getCurrentSequence() == 0, execution)));
- logger.info("Running flow manipulators:\n{}",
+ logger.info("Running post 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));
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java
new file mode 100644
index 0000000000..b0e259b801
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java
@@ -0,0 +1,5 @@
+package org.onap.so.bpmn.common.listener.flowmanipulator;
+
+public interface PostFlowManipulator extends FlowManipulator {
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java
new file mode 100644
index 0000000000..1020f65695
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java
@@ -0,0 +1,5 @@
+package org.onap.so.bpmn.common.listener.flowmanipulator;
+
+public interface PreFlowManipulator extends FlowManipulator {
+
+}