diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2020-11-17 10:52:41 +0000 |
---|---|---|
committer | S�bastien Determe <sebastien.determe@intl.att.com> | 2020-11-17 16:01:54 +0000 |
commit | 5eb632de67f90a92e3032f97da1dcc25d53e8110 (patch) | |
tree | d1b504d09cb517dd614c344f83a21a68f771c882 /common-be/src | |
parent | 8adf8aa4772b282133e053a21fc8de65973d37e5 (diff) |
Fix import VFC with attributes1.7.3
Fix import VFC with default attribute value
Fix Update, create and delete attribute action
Make attribute definition tosca compliant
Issue-ID: SDC-3381
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: Ibbd36b105b8c86d1e750f3b6d55752d63fe6530e
(cherry picked from commit 2f74a4ac81f228bdb0bf0f509e9c0ef296d28d82)
Diffstat (limited to 'common-be/src')
4 files changed, 105 insertions, 17 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java index b619c66ee0..27bd6635fb 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java @@ -19,34 +19,98 @@ */ package org.openecomp.sdc.be.datatypes.elements; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; +import java.io.Serializable; +import org.onap.sdc.tosca.datatypes.model.EntrySchema; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor -public class AttributeDataDefinition extends ToscaDataDefinition{ +public class AttributeDataDefinition extends ToscaDataDefinition implements Serializable { - private String uniqueId; - private String name; - private SchemaDefinition schema; - private String value; + public AttributeDataDefinition() { + } public AttributeDataDefinition(final AttributeDataDefinition attributeDataDefinition) { super(); this.setUniqueId(attributeDataDefinition.getUniqueId()); + this.setOwnerId(attributeDataDefinition.getOwnerId()); this.setName(attributeDataDefinition.getName()); + this.setType(attributeDataDefinition.getType()); + this.setDescription(attributeDataDefinition.getDescription()); + this.set_default(attributeDataDefinition.get_default()); + this.setStatus(attributeDataDefinition.getStatus()); + this.setEntry_schema(attributeDataDefinition.getEntry_schema()); this.setSchema(attributeDataDefinition.getSchema()); - this.setValue(attributeDataDefinition.getValue()); } - public String getParentUniqueId() { - return getOwnerId(); + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + @Override + public String getOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); + } + + @Override + public void setOwnerId(String ownerId) { + setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + @Override + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + public Object get_default() { + return getToscaPresentationValue(JsonPresentationFields.DEFAULT); + } + + public void set_default(Object _default) { + setToscaPresentationValue(JsonPresentationFields.DEFAULT, _default); + } + + public String getStatus() { + return (String) getToscaPresentationValue(JsonPresentationFields.STATUS); + } + + public void setStatus(String status) { + setToscaPresentationValue(JsonPresentationFields.STATUS, status); + } + + public EntrySchema getEntry_schema() { + return (EntrySchema) getToscaPresentationValue(JsonPresentationFields.SCHEMA); + } + + public void setEntry_schema(EntrySchema entrySchema) { + setToscaPresentationValue(JsonPresentationFields.SCHEMA, entrySchema); } - public void setParentUniqueId(final String parentUniqueId) { - setOwnerId(parentUniqueId); + public SchemaDefinition getSchema() { + return (SchemaDefinition) getToscaPresentationValue(JsonPresentationFields.SCHEMA); } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/EntrySchemaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/EntrySchemaDataDefinition.java new file mode 100644 index 0000000000..36e3452e53 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/EntrySchemaDataDefinition.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.sdc.tosca.datatypes.model.Constraint; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class EntrySchemaDataDefinition extends ToscaDataDefinition { + + private String description; + private String type; + private List<Constraint> constraints; + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java index 41c04e77b2..76697a7223 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java @@ -108,6 +108,7 @@ public enum JsonPresentationFields { //property DEFINITION("definition", null), DEFAULT_VALUE("defaultValue", null), + DEFAULT("default", null), REQUIRED("required", null), PASSWORD("password", null), CONSTRAINTS("constraints", null), diff --git a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java index 66c64bd05f..a1b14b70ca 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java @@ -45,7 +45,9 @@ public class TypeUtils { public enum ToscaTagNamesEnum { DERIVED_FROM("derived_from"), IS_PASSWORD("is_password"), // Properties - PROPERTIES("properties"), TYPE("type"), STATUS("status"), ENTRY_SCHEMA("entry_schema"), REQUIRED("required"), DESCRIPTION("description"), DEFAULT_VALUE("default"), VALUE("value"), CONSTRAINTS("constraints"), + PROPERTIES("properties"), TYPE("type"), STATUS("status"), + ENTRY_SCHEMA("entry_schema"), REQUIRED("required"), DESCRIPTION("description"), + DEFAULT_VALUE("default"), VALUE("value"), CONSTRAINTS("constraints"), // Group Types MEMBERS("members"), METADATA("metadata"), // Policy Types |