From 777a186248a2bcef1ab9ffc8b16a7190860302e2 Mon Sep 17 00:00:00 2001 From: "saul.gill" Date: Fri, 27 Jan 2023 14:58:05 +0000 Subject: Add element and definition map to ppnt endpoints Add element instance map Add node template state map Issue-ID: POLICY-4540 Change-Id: I6e7c2b27db78a090b0a1303c49e57d8675316f9b Signed-off-by: saul.gill --- .../participants/AcmParticipantProvider.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'runtime-acm') diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java index 18a8e8a26..de3fc753b 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java @@ -21,10 +21,15 @@ package org.onap.policy.clamp.acm.runtime.participants; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.UUID; import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.MapUtils; import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusReqPublisher; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; +import org.onap.policy.clamp.models.acm.concepts.NodeTemplateState; import org.onap.policy.clamp.models.acm.concepts.ParticipantInformation; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider; @@ -69,6 +74,10 @@ public class AcmParticipantProvider { var participant = this.participantProvider.getParticipantById(participantId); var participantInformation = new ParticipantInformation(); participantInformation.setParticipant(participant); + + participantInformation.setAcElementInstanceMap(getAutomationCompositionElementsForParticipant(participantId)); + participantInformation.setAcNodeTemplateStateDefinitionMap(getNodeTemplateStatesForParticipant(participantId)); + return participantInformation; } @@ -93,4 +102,21 @@ public class AcmParticipantProvider { public void sendAllParticipantStatusRequest() { this.participantStatusReqPublisher.send((UUID) null); } + + private Map getAutomationCompositionElementsForParticipant(UUID participantId) { + var automationCompositionElements = participantProvider + .getAutomationCompositionElements(participantId); + Map map = new HashMap<>(); + MapUtils.populateMap(map, automationCompositionElements, AutomationCompositionElement::getId); + + return map; + } + + private Map getNodeTemplateStatesForParticipant(UUID participantId) { + var acNodeTemplateStates = participantProvider.getAcNodeTemplateStates(participantId); + Map map = new HashMap<>(); + MapUtils.populateMap(map, acNodeTemplateStates, NodeTemplateState::getNodeTemplateStateId); + + return map; + } } -- cgit 1.2.3-korg