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>
(cherry picked from commit 11f667ee4453fcd4013b67257550e65d075f2b0c)
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
old mode 100644
new mode 100755
index cba6a93..dd01004
--- 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 @@
// 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 @@
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
old mode 100644
new mode 100755
index add4f10..cbe7ef0
--- 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 @@
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 @@
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
old mode 100644
new mode 100755
index 809e139..60d339c
--- 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 @@
@Column
private String message;
+ @Lob
+ @NotNull
+ @Valid
+ @Convert(converter = StringToMapConverter.class)
+ private Map<String, Object> outProperties;
+
/**
* The Default Constructor.
*/
@@ -104,6 +116,7 @@
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 @@
nodeTemplateState.setRestarting(this.restarting);
nodeTemplateState.setState(this.state);
nodeTemplateState.setMessage(this.message);
+ nodeTemplateState.setOutProperties(PfUtils.mapMap(outProperties, UnaryOperator.identity()));
return nodeTemplateState;
}
}