From 9b982666d6ddb6c964a1e539fea97231b5053f5b Mon Sep 17 00:00:00 2001 From: Sirisha_Manchikanti Date: Mon, 20 Sep 2021 16:08:25 +0100 Subject: Add participantType to participant class Add participantType to participant class, cascade common and instance properties from runtime to participants Issue-ID: POLICY-3576 Signed-off-by: Sirisha_Manchikanti Change-Id: Ic9205aafe269ccc6dae0b3463fc6df5c47129e5d --- .../models/controlloop/concepts/ControlLoopElement.java | 5 +++-- .../concepts/ControlLoopElementDefinition.java | 3 ++- .../models/controlloop/concepts/Participant.java | 4 ++++ .../controlloop/persistence/concepts/JpaParticipant.java | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) (limited to 'models/src/main') diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java index 67bcb5348..c7d85e4b6 100644 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java @@ -31,6 +31,7 @@ import lombok.ToString; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfUtils; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** @@ -66,7 +67,7 @@ public class ControlLoopElement { // A map indexed by the property name. Each map entry is the serialized value of the property, // which can be deserialized into an instance of the type of the property. - private Map commonPropertiesMap = new LinkedHashMap<>(); + private Map propertiesMap = new LinkedHashMap<>(); /** * Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy. @@ -83,6 +84,6 @@ public class ControlLoopElement { this.toscaServiceTemplateFragment = otherElement.toscaServiceTemplateFragment; this.description = otherElement.description; this.clElementStatistics = otherElement.clElementStatistics; - this.commonPropertiesMap = PfUtils.mapMap(otherElement.commonPropertiesMap, UnaryOperator.identity()); + this.propertiesMap = PfUtils.mapMap(otherElement.propertiesMap, UnaryOperator.identity()); } } diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java index b9f4d6904..ae50b40ce 100644 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java @@ -30,6 +30,7 @@ import lombok.ToString; import org.onap.policy.models.base.PfUtils; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty; /** * Class to represent a control loop element definition instance. @@ -47,7 +48,7 @@ public class ControlLoopElementDefinition { // A map indexed by the property name. Each map entry is the serialized value of the property, // which can be deserialized into an instance of the type of the property. - private Map commonPropertiesMap = new LinkedHashMap<>(); + private Map commonPropertiesMap = new LinkedHashMap<>(); /** * Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy. diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java index 3130b6c2f..198cf1a16 100644 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java @@ -44,6 +44,9 @@ public class Participant extends ToscaEntity implements Comparable @NonNull private ParticipantHealthStatus healthStatus = ParticipantHealthStatus.UNKNOWN; + @NonNull + private ToscaConceptIdentifier participantType = new ToscaConceptIdentifier(); + @Override public String getType() { return definition.getName(); @@ -69,5 +72,6 @@ public class Participant extends ToscaEntity implements Comparable this.definition = new ToscaConceptIdentifier(otherParticipant.definition); this.participantState = otherParticipant.participantState; this.healthStatus = otherParticipant.healthStatus; + this.participantType = otherParticipant.participantType; } } diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java index 4d49683bf..c8c26a8de 100644 --- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java +++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java @@ -70,6 +70,11 @@ public class JpaParticipant extends PfConcept implements PfAuthorative keyList = getKey().getKeys(); keyList.add(definition); + keyList.add(participantType); return keyList; } @@ -176,6 +185,7 @@ public class JpaParticipant extends PfConcept implements PfAuthorative