summaryrefslogtreecommitdiffstats
path: root/models/src
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-04-27 15:22:50 +0100
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-05-03 16:48:44 +0100
commit5c921c62ef5fd97ae86efe28e932619546966907 (patch)
treea8fa5a2ad5c52f41e12e43750aee7ff026e245bf /models/src
parentb619e00e3dbb4c7e2d5a484be8cae4db29afe149 (diff)
Add participant properties capability to acm/participants
Add statusProperties support in acm acm/participants. Issue-ID: POLICY-4652 Change-Id: I6dd37c9be58fce36def022364abe46c791e98a77 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeployAck.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java11
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java2
4 files changed, 19 insertions, 1 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeployAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeployAck.java
index 611336058..39bbdd173 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeployAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeployAck.java
@@ -20,6 +20,8 @@
package org.onap.policy.clamp.models.acm.concepts;
+import java.util.LinkedHashMap;
+import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@@ -41,6 +43,8 @@ public class AcElementDeployAck {
private String useState;
+ private Map<String, Object> statusProperties = new LinkedHashMap<>();
+
// Result: Success/Fail.
private Boolean result;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
index edc9e1c5f..208766ebb 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
@@ -64,6 +64,8 @@ public class AutomationCompositionElement {
// which can be deserialized into an instance of the type of the property.
private Map<String, Object> properties = new LinkedHashMap<>();
+ private Map<String, Object> statusProperties = new LinkedHashMap<>();
+
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
@@ -75,6 +77,7 @@ public class AutomationCompositionElement {
this.participantId = otherElement.participantId;
this.description = otherElement.description;
this.properties = PfUtils.mapMap(otherElement.properties, UnaryOperator.identity());
+ this.statusProperties = PfUtils.mapMap(otherElement.statusProperties, UnaryOperator.identity());
this.deployState = otherElement.deployState;
this.lockState = otherElement.lockState;
this.operationalState = otherElement.operationalState;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
index 4ba336edf..9956a471b 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
@@ -107,6 +107,12 @@ public class JpaAutomationCompositionElement extends Validated
@Convert(converter = StringToMapConverter.class)
private Map<String, Object> properties;
+ @Lob
+ @NotNull
+ @Valid
+ @Convert(converter = StringToMapConverter.class)
+ private Map<String, Object> statusProperties;
+
/**
* The Default Constructor creates a {@link JpaAutomationCompositionElement} object with a null key.
*/
@@ -156,6 +162,9 @@ public class JpaAutomationCompositionElement extends Validated
this.participantId = copyConcept.participantId;
this.description = copyConcept.description;
this.properties = (copyConcept.properties != null ? new LinkedHashMap<>(copyConcept.properties) : null);
+ this.statusProperties =
+ (copyConcept.statusProperties != null ? new LinkedHashMap<>(copyConcept.statusProperties)
+ : null);
this.deployState = copyConcept.deployState;
this.lockState = copyConcept.lockState;
this.operationalState = copyConcept.operationalState;
@@ -180,6 +189,7 @@ public class JpaAutomationCompositionElement extends Validated
element.setParticipantId(UUID.fromString(participantId));
element.setDescription(description);
element.setProperties(PfUtils.mapMap(properties, UnaryOperator.identity()));
+ element.setStatusProperties(PfUtils.mapMap(statusProperties, UnaryOperator.identity()));
element.setDeployState(deployState);
element.setLockState(lockState);
element.setOperationalState(operationalState);
@@ -194,6 +204,7 @@ public class JpaAutomationCompositionElement extends Validated
this.participantId = element.getParticipantId().toString();
this.description = element.getDescription();
this.properties = PfUtils.mapMap(element.getProperties(), UnaryOperator.identity());
+ this.statusProperties = PfUtils.mapMap(element.getStatusProperties(), UnaryOperator.identity());
this.deployState = element.getDeployState();
this.lockState = element.getLockState();
this.operationalState = element.getOperationalState();
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java
index 95a169960..b74b94932 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java
@@ -50,7 +50,7 @@ class AutomationCompositionDeployAckTest {
// verify with all values
orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(CommonTestData.getParticipantId());
- var acElementResult = new AcElementDeployAck(DeployState.DEPLOYED, LockState.LOCKED, "", "",
+ var acElementResult = new AcElementDeployAck(DeployState.DEPLOYED, LockState.LOCKED, "", "", Map.of(),
true, "AutomationCompositionElement result");
final var automationCompositionResultMap = Map.of(UUID.randomUUID(), acElementResult);
orig.setAutomationCompositionResultMap(automationCompositionResultMap);