aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src/main/java
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2022-11-24 10:41:40 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2022-11-24 14:52:18 +0000
commit933f1325044e6233ca0da1eecf223bc5bbb06b36 (patch)
tree77ab10ee6fa109b53294e328ead2df12aee78a73 /participant/participant-intermediary/src/main/java
parenta2e99e7df02837d8270228c330bed4915043b996 (diff)
Link the AutomationComposition with AutomationCompositionDefinition
In AutomationComposition replace the link to ToscaNodeTemplate whit a link to AutomationCompositionDefinition using compositionId. Issue-ID: POLICY-4464 Change-Id: I66878f04ef93fb0754d0066e78bd074ce082f891 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src/main/java')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java20
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java19
2 files changed, 20 insertions, 19 deletions
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 e4d921af7..cf7a93fb4 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
@@ -60,14 +60,14 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp
* @param automationCompositionHandler AutomationCompositionHandler
*/
public ParticipantIntermediaryApiImpl(ParticipantHandler participantHandler,
- AutomationCompositionHandler automationCompositionHandler) {
+ AutomationCompositionHandler automationCompositionHandler) {
this.participantHandler = participantHandler;
this.automationCompositionHandler = automationCompositionHandler;
}
@Override
public void registerAutomationCompositionElementListener(
- AutomationCompositionElementListener automationCompositionElementListener) {
+ AutomationCompositionElementListener automationCompositionElementListener) {
automationCompositionHandler.registerAutomationCompositionElementListener(automationCompositionElementListener);
}
@@ -93,11 +93,11 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp
@Override
public Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version) {
- List<AutomationComposition> automationCompositions =
- automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
+ var automationCompositions =
+ automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
- for (AutomationComposition automationComposition : automationCompositions) {
- if (name.equals(automationComposition.getDefinition().getName())) {
+ for (var automationComposition : automationCompositions) {
+ if (name.equals(automationComposition.getName())) {
return automationComposition.getElements();
}
}
@@ -107,7 +107,7 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp
@Override
public AutomationCompositionElement getAutomationCompositionElement(UUID id) {
List<AutomationComposition> automationCompositions =
- automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
+ automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
for (AutomationComposition automationComposition : automationCompositions) {
AutomationCompositionElement acElement = automationComposition.getElements().get(id);
@@ -120,9 +120,9 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp
@Override
public AutomationCompositionElement updateAutomationCompositionElementState(
- ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState currentState,
- AutomationCompositionState newState, ParticipantMessageType messageType) {
+ ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState currentState,
+ AutomationCompositionState newState, ParticipantMessageType messageType) {
return automationCompositionHandler.updateAutomationCompositionElementState(automationCompositionId, id,
- currentState, newState);
+ 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 4c74e50fe..451215515 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
@@ -202,7 +202,7 @@ public class AutomationCompositionHandler {
break;
default:
LOGGER.debug("StateChange message has no state, state is null {}",
- automationComposition.getDefinition());
+ automationComposition.getKey());
break;
}
}
@@ -255,11 +255,11 @@ public class AutomationCompositionHandler {
return;
}
+ automationComposition = new AutomationComposition();
+ automationComposition.setName(updateMsg.getAutomationCompositionId().getName());
+ automationComposition.setVersion(updateMsg.getAutomationCompositionId().getVersion());
var acElements = storeElementsOnThisParticipant(updateMsg.getParticipantUpdatesList());
-
var acElementMap = prepareAcElementMap(acElements);
- automationComposition = new AutomationComposition();
- automationComposition.setDefinition(updateMsg.getAutomationCompositionId());
automationComposition.setElements(acElementMap);
automationCompositionMap.put(updateMsg.getAutomationCompositionId(), automationComposition);
@@ -347,7 +347,7 @@ public class AutomationCompositionHandler {
.filter(element -> !AutomationCompositionState.UNINITIALISED.equals(element.getState())).findAny()
.isEmpty();
if (isAllUninitialised) {
- automationCompositionMap.remove(automationComposition.getDefinition());
+ automationCompositionMap.remove(automationComposition.getKey().asIdentifier());
automationComposition.getElements().values()
.forEach(element -> elementsOnThisParticipant.remove(element.getId()));
}
@@ -400,7 +400,7 @@ public class AutomationCompositionHandler {
automationCompositionAck.setParticipantType(participantType);
automationCompositionAck.setMessage("Automation composition is already in state " + orderedState);
automationCompositionAck.setResult(false);
- automationCompositionAck.setAutomationCompositionId(automationComposition.getDefinition());
+ automationCompositionAck.setAutomationCompositionId(automationComposition.getKey().asIdentifier());
publisher.sendAutomationCompositionAck(automationCompositionAck);
return;
}
@@ -419,11 +419,12 @@ public class AutomationCompositionHandler {
if (startPhaseMsg.equals(startPhase)) {
for (var acElementListener : listeners) {
try {
- acElementListener.automationCompositionElementStateChange(automationComposition.getDefinition(),
- acElement.getId(), acElement.getState(), orderedState);
+ acElementListener.automationCompositionElementStateChange(
+ automationComposition.getKey().asIdentifier(), acElement.getId(), acElement.getState(),
+ orderedState);
} catch (PfModelException e) {
LOGGER.debug("Automation composition element update failed {}",
- automationComposition.getDefinition());
+ automationComposition.getKey().asIdentifier());
}
}
}