diff options
author | Liam Fallon <liam.fallon@est.tech> | 2023-02-01 14:17:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2023-02-01 14:17:21 +0000 |
commit | ec24e733cdcdeec9d9d02cc71aa104d891a7f5d0 (patch) | |
tree | 8ae87163d7cd5ee4e8151cef7d7383f96f202779 /runtime-acm/src | |
parent | f12bbee7b1ecf93a265d94da7a6f0dbb72ddf2cb (diff) | |
parent | 777a186248a2bcef1ab9ffc8b16a7190860302e2 (diff) |
Merge "Add element and definition map to ppnt endpoints"
Diffstat (limited to 'runtime-acm/src')
-rw-r--r-- | runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java | 26 |
1 files changed, 26 insertions, 0 deletions
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<UUID, AutomationCompositionElement> getAutomationCompositionElementsForParticipant(UUID participantId) { + var automationCompositionElements = participantProvider + .getAutomationCompositionElements(participantId); + Map<UUID, AutomationCompositionElement> map = new HashMap<>(); + MapUtils.populateMap(map, automationCompositionElements, AutomationCompositionElement::getId); + + return map; + } + + private Map<UUID, NodeTemplateState> getNodeTemplateStatesForParticipant(UUID participantId) { + var acNodeTemplateStates = participantProvider.getAcNodeTemplateStates(participantId); + Map<UUID, NodeTemplateState> map = new HashMap<>(); + MapUtils.populateMap(map, acNodeTemplateStates, NodeTemplateState::getNodeTemplateStateId); + + return map; + } } |