diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2022-12-13 13:57:47 +0000 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2022-12-13 16:45:51 +0000 |
commit | a01c89adfa3a6fe0918d77282759295a7f0514e5 (patch) | |
tree | f5885152f94b408e3b3634ab600471e035d72da0 /participant/participant-intermediary/src/main | |
parent | 04ffb73ae3fcd3c666030d5c867febd88ef6537c (diff) |
Replace ToscaConceptIdentifier with UUID in Participant Messages ACM
Replace in all messages the reference to Automation Composition
ToscaConceptIdentifier(name, version) with instanceId(UUID).
Issue-ID: POLICY-4479
Change-Id: I7bc9a7494103b9c1752a1e2c6f6d5a527196913d
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src/main')
4 files changed, 20 insertions, 20 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java index f2832c5b5..ee769f481 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java @@ -20,13 +20,12 @@ package org.onap.policy.clamp.acm.participant.intermediary.api; +import java.util.Map; import java.util.UUID; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; import org.onap.policy.models.base.PfModelException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; /** * This interface is implemented by participant implementations to receive updates on automation composition elements. @@ -40,18 +39,18 @@ public interface AutomationCompositionElementListener { * @param newState the state to which the automation composition element is changing to * @throws PfModelException in case of a model exception */ - public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId, + public void automationCompositionElementStateChange(UUID automationCompositionId, UUID automationCompositionElementId, AutomationCompositionState currentState, AutomationCompositionOrderedState newState) throws PfModelException; /** * Handle an update on a automation composition element. * + * @param automationCompositionId the automationComposition Id * @param element the information on the automation composition element - * @param automationCompositionElementDefinition toscaNodeTemplate + * @param properties properties Map * @throws PfModelException from Policy framework */ - public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId, - AutomationCompositionElement element, ToscaNodeTemplate automationCompositionElementDefinition) - throws PfModelException; + public void automationCompositionElementUpdate(UUID automationCompositionId, + AutomationCompositionElement element, Map<String, Object> properties) throws PfModelException; } diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java index 754a8305f..367215a29 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java @@ -107,7 +107,7 @@ public interface ParticipantIntermediaryApi { * @param newState the state of the automation composition element * @return AutomationCompositionElement updated automation composition element */ - AutomationCompositionElement updateAutomationCompositionElementState(ToscaConceptIdentifier automationCompositionId, + AutomationCompositionElement updateAutomationCompositionElementState(UUID automationCompositionId, UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState, ParticipantMessageType messageType); } diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java index cf7a93fb4..6dfc82791 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java @@ -120,7 +120,7 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp @Override public AutomationCompositionElement updateAutomationCompositionElementState( - ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState currentState, + UUID automationCompositionId, UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState, ParticipantMessageType messageType) { return automationCompositionHandler.updateAutomationCompositionElementState(automationCompositionId, id, currentState, newState); diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java index cb5b572a5..66ac0c1dc 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java @@ -22,6 +22,7 @@ package org.onap.policy.clamp.acm.participant.intermediary.handler; import java.util.ArrayList; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -63,7 +64,7 @@ public class AutomationCompositionHandler { private final ParticipantMessagePublisher publisher; @Getter - private final Map<ToscaConceptIdentifier, AutomationComposition> automationCompositionMap = new LinkedHashMap<>(); + private final Map<UUID, AutomationComposition> automationCompositionMap = new LinkedHashMap<>(); @Getter private final Map<UUID, AutomationCompositionElement> elementsOnThisParticipant = new LinkedHashMap<>(); @@ -97,7 +98,7 @@ public class AutomationCompositionHandler { * @return automationCompositionElement the updated automation composition element */ public AutomationCompositionElement updateAutomationCompositionElementState( - ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState orderedState, + UUID automationCompositionId, UUID id, AutomationCompositionOrderedState orderedState, AutomationCompositionState newState) { if (id == null) { @@ -254,8 +255,7 @@ public class AutomationCompositionHandler { } automationComposition = new AutomationComposition(); - automationComposition.setName(updateMsg.getAutomationCompositionId().getName()); - automationComposition.setVersion(updateMsg.getAutomationCompositionId().getVersion()); + automationComposition.setInstanceId(updateMsg.getAutomationCompositionId()); var acElements = storeElementsOnThisParticipant(updateMsg.getParticipantUpdatesList()); var acElementMap = prepareAcElementMap(acElements); automationComposition.setElements(acElementMap); @@ -278,7 +278,7 @@ public class AutomationCompositionHandler { private void handleAutomationCompositionElementUpdate(List<AutomationCompositionElement> acElements, List<AutomationCompositionElementDefinition> acElementDefinitions, Integer startPhaseMsg, - ToscaConceptIdentifier automationCompositionId) { + UUID automationCompositionId) { try { for (var element : acElements) { var acElementNodeTemplate = getAcElementNodeTemplate(acElementDefinitions, element.getDefinition()); @@ -286,8 +286,9 @@ public class AutomationCompositionHandler { int startPhase = ParticipantUtils.findStartPhase(acElementNodeTemplate.getProperties()); if (startPhaseMsg.equals(startPhase)) { for (var acElementListener : listeners) { - acElementListener.automationCompositionElementUpdate(automationCompositionId, element, - acElementNodeTemplate); + var map = new HashMap<>(acElementNodeTemplate.getProperties()); + map.putAll(element.getProperties()); + acElementListener.automationCompositionElementUpdate(automationCompositionId, element, map); } } } @@ -345,7 +346,7 @@ public class AutomationCompositionHandler { .filter(element -> !AutomationCompositionState.UNINITIALISED.equals(element.getState())).findAny() .isEmpty(); if (isAllUninitialised) { - automationCompositionMap.remove(automationComposition.getKey().asIdentifier()); + automationCompositionMap.remove(automationComposition.getInstanceId()); automationComposition.getElements().values() .forEach(element -> elementsOnThisParticipant.remove(element.getId())); } @@ -398,7 +399,7 @@ public class AutomationCompositionHandler { automationCompositionAck.setParticipantType(participantType); automationCompositionAck.setMessage("Automation composition is already in state " + orderedState); automationCompositionAck.setResult(false); - automationCompositionAck.setAutomationCompositionId(automationComposition.getKey().asIdentifier()); + automationCompositionAck.setAutomationCompositionId(automationComposition.getInstanceId()); publisher.sendAutomationCompositionAck(automationCompositionAck); return; } @@ -418,11 +419,11 @@ public class AutomationCompositionHandler { for (var acElementListener : listeners) { try { acElementListener.automationCompositionElementStateChange( - automationComposition.getKey().asIdentifier(), acElement.getId(), acElement.getState(), + automationComposition.getInstanceId(), acElement.getId(), acElement.getState(), orderedState); } catch (PfModelException e) { LOGGER.debug("Automation composition element update failed {}", - automationComposition.getKey().asIdentifier()); + automationComposition.getInstanceId()); } } } |