From b741e69ad9a60a128d1994a6fcf65f0b6aeee7ee Mon Sep 17 00:00:00 2001 From: Sirisha_Manchikanti Date: Fri, 10 Sep 2021 15:38:07 +0100 Subject: Add Priming flag per controlloop This commit adds a Priming flag per controlloop which indicates whether a controlLoop is primed or deprimed. There is a rest end-point added to depict in GUI Issue-ID: POLICY-3577 Signed-off-by: Sirisha_Manchikanti Change-Id: Ie81a41505ab1eafda9515733e0b895421803ea8a --- .../intermediary/handler/ControlLoopHandler.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'participant/participant-intermediary/src/main') diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java index 8bdf91824..30a06ba22 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java @@ -103,9 +103,11 @@ public class ControlLoopHandler { return null; } + // Update states of ControlLoopElement in controlLoopMap for (var controlLoop : controlLoopMap.values()) { var element = controlLoop.getElements().get(id); if (element != null) { + element.setOrderedState(orderedState); element.setState(newState); } var checkOpt = controlLoop.getElements().values().stream() @@ -116,6 +118,7 @@ public class ControlLoopHandler { } } + // Update states of ControlLoopElement in elementsOnThisParticipant var clElement = elementsOnThisParticipant.get(id); if (clElement != null) { var controlLoopStateChangeAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK); @@ -339,16 +342,16 @@ public class ControlLoopHandler { return; } - for (var clElementListener : listeners) { - try { - for (var element : controlLoop.getElements().values()) { - clElementListener.controlLoopElementStateChange(controlLoop.getDefinition(), element.getId(), - element.getState(), orderedState); + controlLoop.getElements().values().stream().forEach(clElement -> { + for (var clElementListener : listeners) { + try { + clElementListener.controlLoopElementStateChange(controlLoop.getDefinition(), + clElement.getId(), clElement.getState(), orderedState); + } catch (PfModelException e) { + LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition()); } - } catch (PfModelException e) { - LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition()); } - } + }); } /** -- cgit 1.2.3-korg