aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-08-01 15:49:22 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2023-08-01 14:59:26 +0000
commit11f667ee4453fcd4013b67257550e65d075f2b0c (patch)
tree351460c8c04c4f0e6716d6af219e41e7fb24b277
parentd944ef408f099cbd5e3644e4abb37886d16c985e (diff)
Add composition outProperties to AC Definition and Status Message
Add new hashMap to AC Definition and Status Message for priming properties. Issue-ID: POLICY-4780 Change-Id: I3d62bf84b5c32a7fadfa6bba21e583046f814da1 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
-rwxr-xr-x[-rw-r--r--]models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java9
-rwxr-xr-x[-rw-r--r--]models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java7
-rwxr-xr-x[-rw-r--r--]models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java14
3 files changed, 29 insertions, 1 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java
index cba6a93bd..dd010045f 100644..100755
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,14 @@
package org.onap.policy.clamp.models.acm.concepts;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.UnaryOperator;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
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;
@@ -41,6 +45,8 @@ public class AutomationCompositionElementDefinition {
// The definition of the Automation Composition Element in TOSCA
private ToscaNodeTemplate automationCompositionElementToscaNodeTemplate;
+ private Map<String, Object> outProperties = new LinkedHashMap<>();
+
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
@@ -50,5 +56,6 @@ public class AutomationCompositionElementDefinition {
this.acElementDefinitionId = acElementDefinition.acElementDefinitionId;
this.automationCompositionElementToscaNodeTemplate =
new ToscaNodeTemplate(acElementDefinition.automationCompositionElementToscaNodeTemplate);
+ this.outProperties = PfUtils.mapMap(acElementDefinition.outProperties, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java
index add4f1078..cbe7ef04c 100644..100755
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java
@@ -20,10 +20,14 @@
package org.onap.policy.clamp.models.acm.concepts;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.UUID;
+import java.util.function.UnaryOperator;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
+import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@NoArgsConstructor
@@ -44,6 +48,8 @@ public class NodeTemplateState {
private String message;
+ private Map<String, Object> outProperties = new LinkedHashMap<>();
+
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
@@ -56,5 +62,6 @@ public class NodeTemplateState {
this.restarting = copyConstructor.restarting;
this.state = copyConstructor.state;
this.message = copyConstructor.message;
+ this.outProperties = PfUtils.mapMap(copyConstructor.outProperties, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java
index 809e13911..60d339cca 100644..100755
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java
@@ -20,22 +20,28 @@
package org.onap.policy.clamp.models.acm.persistence.concepts;
+import java.util.Map;
import java.util.UUID;
+import java.util.function.UnaryOperator;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
+import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
+import javax.persistence.Lob;
import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.NodeTemplateState;
import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.base.Validated;
import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -76,6 +82,12 @@ public class JpaNodeTemplateState extends Validated implements PfAuthorative<Nod
@Column
private String message;
+ @Lob
+ @NotNull
+ @Valid
+ @Convert(converter = StringToMapConverter.class)
+ private Map<String, Object> outProperties;
+
/**
* The Default Constructor.
*/
@@ -104,6 +116,7 @@ public class JpaNodeTemplateState extends Validated implements PfAuthorative<Nod
this.restarting = copyConcept.getRestarting();
this.state = copyConcept.getState();
this.message = copyConcept.getMessage();
+ this.outProperties = PfUtils.mapMap(copyConcept.getOutProperties(), UnaryOperator.identity());
}
@Override
@@ -117,6 +130,7 @@ public class JpaNodeTemplateState extends Validated implements PfAuthorative<Nod
nodeTemplateState.setRestarting(this.restarting);
nodeTemplateState.setState(this.state);
nodeTemplateState.setMessage(this.message);
+ nodeTemplateState.setOutProperties(PfUtils.mapMap(outProperties, UnaryOperator.identity()));
return nodeTemplateState;
}
}