aboutsummaryrefslogtreecommitdiffstats
path: root/runtime-acm
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2023-01-27 14:58:05 +0000
committersaul.gill <saul.gill@est.tech>2023-01-31 09:58:41 +0000
commit777a186248a2bcef1ab9ffc8b16a7190860302e2 (patch)
tree19adf958820a36d45aadc1850b1dd7d720086ab2 /runtime-acm
parent934f7bd443225a6945b0542fa5cb7c043deac426 (diff)
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 <saul.gill@est.tech>
Diffstat (limited to 'runtime-acm')
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java26
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;
+ }
}