diff options
author | andre.schmid <andre.schmid@est.tech> | 2021-02-02 19:18:22 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-02-25 12:20:17 +0000 |
commit | 0aa493c70aebd63244beeddf0ef22147196c5489 (patch) | |
tree | 6557463275234f84d05d40c89c1bcfc7134298fc /catalog-model/src/main | |
parent | 70f93dfdd2b3a7c682b341223b6f63af43feb280 (diff) |
Improve import and export VFC TOSCA attributes
Improve the import and export VFC TOSCA attributes, addressing the
following concerns:
- brings the import and export logic very close to the properties logic,
as they are very similar structures
- fix import/export default values for complex types and list of simple
or complex types
- fix export of unnecessary/empty attribute entries
- creation of attributes during the initialization (base types)
- inheritance of parent attributes
Change-Id: Ic733e3455fc256595b5c2b1f48e19a13be27b5cc
Issue-ID: SDC-3466
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-model/src/main')
3 files changed, 21 insertions, 32 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java index ee819310c1..1cf3baaac7 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java @@ -19,55 +19,40 @@ */ package org.openecomp.sdc.be.model; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.sdc.tosca.datatypes.model.EntrySchema; +import lombok.NoArgsConstructor; import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition; -@Getter -@Setter -@ToString +@NoArgsConstructor public class AttributeDefinition extends AttributeDataDefinition implements IOperationParameter, IComplexDefaultValue { - // All names are according to TOSCA spec from - // https://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.3/os/TOSCA-Simple-Profile-YAML-v1.3-os.html#DEFN_ELEMENT_ATTRIBUTE_DEFN - private String type; - private String description; - private Object _default; - private String status; - private EntrySchema entry_schema; - - public AttributeDefinition() { - toscaPresentation = null; - } - public AttributeDefinition(final AttributeDataDefinition attributeDataDefinition) { super(attributeDataDefinition); } - public AttributeDefinition(final AttributeDefinition attributeDefinition) { - super(attributeDefinition); - this.type = attributeDefinition.getType(); - this.description = attributeDefinition.getDescription(); - this._default = attributeDefinition.get_default(); - this.status = attributeDefinition.getStatus(); - this.entry_schema = attributeDefinition.getEntry_schema(); - this.toscaPresentation = attributeDefinition.toscaPresentation; - } - @Override public String getDefaultValue() { - return _default == null ? null : String.valueOf(_default); + return get_default() == null ? null : String.valueOf(get_default()); } @Override public void setDefaultValue(final String value) { - this._default = value; + set_default(value); } @Override public boolean isDefinition() { return false; } + + @Override + public String toString() { + return "AttributeDefinition{" + + "name=" + getName() + + "uniqueId=" + getUniqueId() + + "ownerId=" + getOwnerId() + + "type=" + getType() + + "description=" + getDescription() + + "default=" + getDefaultValue() + + '}'; + } } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java index e8aba6dcb6..10c58ba697 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java @@ -547,6 +547,11 @@ public class NodeTypeOperation extends ToscaElementOperation { ToscaDataDefinition.mergeDataMaps(attributesAll, attributes); } if (!attributesAll.isEmpty()) { + log.debug("Creating vertex for attributes {}:{}", nodeType.getName(), nodeType.getUniqueId()); + attributesAll.forEach((s, attributeDataDefinition) -> { + log.debug("Attribute {}:{}", s, attributeDataDefinition.getUniqueId()); + }); + Either<GraphVertex, StorageOperationStatus> assosiateElementToData = associateElementToData(nodeTypeVertex, VertexTypeEnum.ATTRIBUTES, EdgeLabelEnum.ATTRIBUTES, attributesAll); if (assosiateElementToData.isRight()) { return assosiateElementToData.right().value(); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java index 32f7e14e00..8c8245e87f 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java @@ -922,7 +922,6 @@ public abstract class ToscaElementOperation extends BaseOperation { switch (label) { case NODE_TYPE: toscaElement = new NodeType(); - toscaElement.setAttributes(getAttributesFromComponentV(componentV)); break; case TOPOLOGY_TEMPLATE: toscaElement = new TopologyTemplate(); |