diff options
Diffstat (limited to 'common-be')
3 files changed, 27 insertions, 3 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java index 4a4a7a4b75..5354d31eb2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java @@ -20,6 +20,10 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @@ -57,6 +61,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { setSourceModelUuid(dataDefinition.getSourceModelUuid()); setSourceModelUid(dataDefinition.getSourceModelUid()); setIsProxy(dataDefinition.getIsProxy()); + setDirectives(dataDefinition.getDirectives()); setOriginArchived(dataDefinition.isOriginArchived()); } @@ -273,11 +278,29 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { } } + public List<String> getDirectives() { + return ( List<String>) getToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES); + } + + public void setDirectives(List<String> directives) { + if (directives == null){ + directives = new ArrayList<>(); + } + setToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES, directives); + } + public Boolean isOriginArchived() { Boolean originArchived = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED); return ( originArchived != null ) ? originArchived : false; } + private String getDirectivesString(){ + if (CollectionUtils.isEmpty(getDirectives())){ + return ""; + } + return getDirectives().stream().collect(Collectors.joining(",")); + } + @Override public String toString() { return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" @@ -288,7 +311,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition { + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType=" + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" - + getToscaComponentName() + "]"; + + getToscaComponentName() + ", directives =" + getDirectivesString() +"]"; } } 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 4d39ec1355..7a4c3d4af7 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 @@ -190,7 +190,7 @@ public enum JsonPresentationFields { CI_SOURCE_MODEL_INVARIANT("sourceModelInvariant", null), CI_SOURCE_MODEL_NAME("sourceModelName", null), CI_IS_PROXY("isProxy", null), - + CI_DIRECTIVES("directives", null), //path FORWARDING_PATH("forwardingPath", 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 d4524d9882..7d21afb609 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 @@ -27,11 +27,12 @@ public class TypeUtils { CAPABILITIES("capabilities"), VALID_SOURCE_TYPES("valid_source_types"), // Requirements REQUIREMENTS("requirements"), NODE("node"), RELATIONSHIP("relationship"), CAPABILITY("capability"), INTERFACES("interfaces"), + NODE_FILTER("node_filter"), TOSCA_ID("tosca_id"), // Heat env Validation PARAMETERS("parameters"), // Import Validations TOSCA_VERSION("tosca_definitions_version"), TOPOLOGY_TEMPLATE("topology_template"), NODE_TYPES("node_types"), OCCURRENCES("occurrences"), NODE_TEMPLATES("node_templates"), GROUPS("groups"), INPUTS("inputs"), - SUBSTITUTION_MAPPINGS("substitution_mappings"), NODE_TYPE("node_type"), + SUBSTITUTION_MAPPINGS("substitution_mappings"), NODE_TYPE("node_type"), DIRECTIVES("directives"), // Attributes ATTRIBUTES("attributes"), LABEL("label"), HIDDEN("hidden"), IMMUTABLE("immutable"), GET_INPUT("get_input"), ANNOTATIONS("annotations"); |