diff options
author | saul.gill <saul.gill@est.tech> | 2023-01-13 17:24:23 +0000 |
---|---|---|
committer | saul.gill <saul.gill@est.tech> | 2023-01-19 13:07:33 +0000 |
commit | 46964ab900060a560b9b41f7d34ab0e26ac7fd61 (patch) | |
tree | d4d15350f492cc19ee657df6cb926349bd724919 /runtime-acm/src/main/java | |
parent | 48df549e1fd90c2768a78c0c88e87dc3834b6222 (diff) |
Add supported ac elements to participants
Added new supported elements table
Added supported element names and versions
to participant application.yaml files
Issue-ID: POLICY-4512
Change-Id: I97d7f571f2906846514ac0804b4827f0601177d7
Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'runtime-acm/src/main/java')
-rw-r--r-- | runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java index 2c9e84ba7..6f0f5cc7b 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java @@ -21,11 +21,17 @@ package org.onap.policy.clamp.acm.runtime.supervision; import io.micrometer.core.annotation.Timed; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import lombok.AllArgsConstructor; +import org.apache.commons.collections4.MapUtils; import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantDeregisterAckPublisher; import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantRegisterAckPublisher; import org.onap.policy.clamp.models.acm.concepts.Participant; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; +import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister; @@ -98,11 +104,14 @@ public class SupervisionParticipantHandler { var participantOpt = participantProvider.findParticipant(participantMessage.getParticipantId()); if (participantOpt.isEmpty()) { + ParticipantRegister registerMessage = (ParticipantRegister) participantMessage; var participant = new Participant(); - participant.setName(participantMessage.getParticipantId().getName()); - participant.setVersion(participantMessage.getParticipantId().getVersion()); - participant.setDefinition(participantMessage.getParticipantId()); - participant.setParticipantType(participantMessage.getParticipantType()); + participant.setName(registerMessage.getParticipantId().getName()); + participant.setVersion(registerMessage.getParticipantId().getVersion()); + participant.setDefinition(registerMessage.getParticipantId()); + participant.setParticipantType(registerMessage.getParticipantType()); + participant.setParticipantSupportedElementTypes(listToMap(registerMessage + .getParticipantSupportedElementType())); participant.setParticipantState(ParticipantState.ON_LINE); participantProvider.saveParticipant(participant); @@ -113,4 +122,10 @@ public class SupervisionParticipantHandler { participantProvider.updateParticipant(participant); } } + + private Map<UUID, ParticipantSupportedElementType> listToMap(List<ParticipantSupportedElementType> elementList) { + Map<UUID, ParticipantSupportedElementType> map = new HashMap<>(); + MapUtils.populateMap(map, elementList, ParticipantSupportedElementType::getId); + return map; + } } |