aboutsummaryrefslogtreecommitdiffstats
path: root/models/src/main/java/org
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2021-09-23 14:45:33 +0000
committerGerrit Code Review <gerrit@onap.org>2021-09-23 14:45:33 +0000
commit6bcadaa32d556a623fb1908f08c8611786d615d6 (patch)
tree38609e9e8a5ff444c11a9ce888fb57410344aaf6 /models/src/main/java/org
parent4143155d835d2fcb291143e6863147dedfe367f4 (diff)
parent9b982666d6ddb6c964a1e539fea97231b5053f5b (diff)
Merge "Add participantType to participant class"
Diffstat (limited to 'models/src/main/java/org')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java5
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java15
4 files changed, 24 insertions, 3 deletions
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<String, String> commonPropertiesMap = new LinkedHashMap<>();
+ private Map<String, ToscaProperty> 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<String, String> commonPropertiesMap = new LinkedHashMap<>();
+ private Map<String, ToscaProperty> 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<Participant>
@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<Participant>
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<Participa
private PfConceptKey definition;
// @formatter:on
+ @NotNull
+ @AttributeOverride(name = "name", column = @Column(name = "participant_type_name"))
+ @AttributeOverride(name = "version", column = @Column(name = "participant_type_version"))
+ private PfConceptKey participantType;
+
@Column
@NotNull
private ParticipantState participantState;
@@ -125,6 +130,7 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
this.participantState = copyConcept.participantState;
this.healthStatus = copyConcept.healthStatus;
this.description = copyConcept.description;
+ this.participantType = copyConcept.participantType;
}
/**
@@ -146,6 +152,7 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
participant.setParticipantState(participantState);
participant.setHealthStatus(healthStatus);
participant.setDescription(description);
+ participant.setParticipantType(new ToscaConceptIdentifier(participantType));
return participant;
}
@@ -160,6 +167,7 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
this.setParticipantState(participant.getParticipantState());
this.setHealthStatus(participant.getHealthStatus());
this.setDescription(participant.getDescription());
+ this.participantType = participant.getParticipantType().asConceptKey();
}
@Override
@@ -167,6 +175,7 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
List<PfKey> keyList = getKey().getKeys();
keyList.add(definition);
+ keyList.add(participantType);
return keyList;
}
@@ -176,6 +185,7 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
key.clean();
definition.clean();
description = (description == null ? null : description.trim());
+ participantType.clean();
}
@Override
@@ -211,6 +221,11 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
return result;
}
+ result = ObjectUtils.compare(participantType, other.participantType);
+ if (result != 0) {
+ return result;
+ }
+
return ObjectUtils.compare(description, other.description);
}
}