diff options
Diffstat (limited to 'runtime-acm/src/main/java')
2 files changed, 34 insertions, 1 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 f8bc233e9..ebccc2f66 100755 --- 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 @@ -35,6 +35,7 @@ import org.onap.policy.clamp.models.acm.concepts.AcTypeState; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition; import org.onap.policy.clamp.models.acm.concepts.Participant; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; 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.concepts.StateChangeResult; @@ -130,6 +131,29 @@ public class SupervisionParticipantHandler { if (!participantStatusMsg.getAutomationCompositionInfoList().isEmpty()) { automationCompositionProvider.upgradeStates(participantStatusMsg.getAutomationCompositionInfoList()); } + if (!participantStatusMsg.getParticipantDefinitionUpdates().isEmpty() + && participantStatusMsg.getCompositionId() != null) { + updateAcDefinitionOutProperties(participantStatusMsg.getCompositionId(), + participantStatusMsg.getParticipantDefinitionUpdates()); + } + } + + private void updateAcDefinitionOutProperties(UUID composotionId, List<ParticipantDefinition> list) { + var acDefinitionOpt = acDefinitionProvider.findAcDefinition(composotionId); + if (acDefinitionOpt.isEmpty()) { + LOGGER.error("Ac Definition with id {} not found", composotionId); + return; + } + var acDefinition = acDefinitionOpt.get(); + for (var acElements : list) { + for (var element : acElements.getAutomationCompositionElementDefinitionList()) { + var state = acDefinition.getElementStateMap().get(element.getAcElementDefinitionId().getName()); + if (state != null) { + state.setOutProperties(element.getOutProperties()); + } + } + } + acDefinitionProvider.updateAcDefinition(acDefinition); } private void checkOnline(Participant participant) { diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java index b086b1914..c00116e3b 100644..100755 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java @@ -100,6 +100,15 @@ public class ParticipantRestartPublisher extends AbstractParticipantPublisher<Pa elementList.add(elementEntry); } } - return AcmUtils.prepareParticipantPriming(elementList, supportedElementMap); + var list = AcmUtils.prepareParticipantPriming(elementList, supportedElementMap); + for (var participantDefinition : list) { + for (var elementDe : participantDefinition.getAutomationCompositionElementDefinitionList()) { + var state = acmDefinition.getElementStateMap().get(elementDe.getAcElementDefinitionId().getName()); + if (state != null) { + elementDe.setOutProperties(state.getOutProperties()); + } + } + } + return list; } } |