diff options
author | talio <tali.orenbach@amdocs.com> | 2019-04-14 15:37:20 +0300 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2019-04-14 16:07:26 +0000 |
commit | fe4afd47955705bb377583649cb53e2cf4508493 (patch) | |
tree | 335f4555155fbeb1085e7ab554ad8406a3ad68be /common-be/src/main/java/org/openecomp | |
parent | b08309847c24bd3c060839a335a20cb3f750ed30 (diff) |
Declare properties as policies
Change-Id: I54dc7b444e08117097c314cf5f51bd356ac5287d
Issue-ID: SDC-2240
Signed-off-by: talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'common-be/src/main/java/org/openecomp')
4 files changed, 68 insertions, 33 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java new file mode 100644 index 0000000000..bf552741a5 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java @@ -0,0 +1,17 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.Objects; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + + +@Getter +@Setter +@EqualsAndHashCode +public class GetPolicyValueDataDefinition { + private String policyId; + private String propertyName; + private String origPropertyValue; + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java index 1e0d5935da..64efe8fd15 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java @@ -1,12 +1,10 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import static java.util.Collections.emptyList; import java.util.List; import java.util.Map; - -import static java.util.Collections.emptyList; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; /** * public class representing the component policy, @@ -27,7 +25,7 @@ import static java.util.Collections.emptyList; * targets * isFromCsar */ -public class PolicyDataDefinition extends ToscaDataDefinition { +public class PolicyDataDefinition extends PropertyDataDefinition { /** * public constructor by default @@ -36,6 +34,10 @@ public class PolicyDataDefinition extends ToscaDataDefinition { super(); } + public PolicyDataDefinition(PropertyDataDefinition propertyDataDefinition) { + super(propertyDataDefinition); + } + /** * public constructor from superclass * @@ -51,6 +53,7 @@ public class PolicyDataDefinition extends ToscaDataDefinition { * @param other */ public PolicyDataDefinition(PolicyDataDefinition other) { + super(other); this.setName(other.getName()); this.setUniqueId(other.getUniqueId()); this.setPolicyTypeName(other.getPolicyTypeName()); @@ -63,6 +66,11 @@ public class PolicyDataDefinition extends ToscaDataDefinition { this.setInvariantName(other.getInvariantName()); this.setComponentName(other.getComponentName()); this.setIsFromCsar(other.getIsFromCsar()); + this.setValue(other.getValue()); + this.setOwnerId(other.getOwnerId()); + this.setType(other.getType()); + this.setInstanceUniqueId(other.getInstanceUniqueId()); + this.setInputPath(other.getInputPath()); if (other.getProperties() != null) { this.setProperties(other.getProperties()); } @@ -100,22 +108,6 @@ public class PolicyDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName); } - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - - public void setName(String name) { - setToscaPresentationValue(JsonPresentationFields.NAME, name); - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - public String getPolicyTypeName() { return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index 88863b2cf5..fed728dade 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -20,13 +20,18 @@ package org.openecomp.sdc.be.datatypes.elements; +import static org.apache.commons.collections.CollectionUtils.isNotEmpty; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.util.*; - -import static org.apache.commons.collections.CollectionUtils.isNotEmpty; - public class PropertyDataDefinition extends ToscaDataDefinition { private String uniqueId; @@ -59,8 +64,8 @@ public class PropertyDataDefinition extends ToscaDataDefinition { private String inputId; private String instanceUniqueId; private String propertyId; - private String parentPropertyType; - private String subPropertyInputPath; + private String parentPropertyType; + private String subPropertyInputPath; private List<Annotation> annotations; /** @@ -70,6 +75,8 @@ public class PropertyDataDefinition extends ToscaDataDefinition { private List<GetInputValueDataDefinition> getInputValues; + private List<GetPolicyValueDataDefinition> getPolicyValues; + public PropertyDataDefinition() { super(); } @@ -97,32 +104,33 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.setParentUniqueId(p.getParentUniqueId()); this.setOwnerId(p.getOwnerId()); this.setGetInputValues(p.getGetInputValues()); + this.setGetPolicyValues(p.getGetPolicyValues()); this.setInputPath(p.getInputPath()); this.setStatus(p.getStatus()); this.setInputId(p.getInputId()); this.setInstanceUniqueId(p.getInstanceUniqueId()); this.setPropertyId(p.getPropertyId()); - this.setParentPropertyType(p.getParentPropertyType()); - this.setSubPropertyInputPath(p.getSubPropertyInputPath()); + this.parentPropertyType = p.getParentPropertyType(); + this.subPropertyInputPath = p.getSubPropertyInputPath(); if(isNotEmpty(p.annotations)){ this.setAnnotations(p.annotations); } } public String getParentPropertyType() { - return parentPropertyType; + return parentPropertyType; } public void setParentPropertyType(String parentPropertyType) { - this.parentPropertyType = parentPropertyType; + this.parentPropertyType = parentPropertyType; } public String getSubPropertyInputPath() { - return subPropertyInputPath; + return subPropertyInputPath; } public void setSubPropertyInputPath(String subPropertyInputPath) { - this.subPropertyInputPath = subPropertyInputPath; + this.subPropertyInputPath = subPropertyInputPath; } public String getInputPath() { @@ -269,6 +277,18 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.getInputValues = getInputValues; } + public List<GetPolicyValueDataDefinition> safeGetGetPolicyValues() { + return CollectionUtils.isEmpty(getPolicyValues) ? new ArrayList<>() : getPolicyValues; + } + + public List<GetPolicyValueDataDefinition> getGetPolicyValues() { + return getPolicyValues; + } + + public void setGetPolicyValues(List<GetPolicyValueDataDefinition> getPolicyValues) { + this.getPolicyValues = getPolicyValues; + } + public String getStatus() { return status; } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java new file mode 100644 index 0000000000..7b78ff9893 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java @@ -0,0 +1,6 @@ +package org.openecomp.sdc.be.datatypes.enums; + +public enum DeclarationTypeEnum { + INPUT, + POLICY; +} |