diff options
Diffstat (limited to 'jython-tosca-parser/src')
4 files changed, 21 insertions, 8 deletions
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java index 30de2a8..e962a4a 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java @@ -9,6 +9,7 @@ import java.util.Objects; import org.openecomp.sdc.toscaparser.api.elements.NodeType; import org.openecomp.sdc.toscaparser.api.parameters.Input; import org.openecomp.sdc.toscaparser.jython.JyGroup; +import org.openecomp.sdc.toscaparser.jython.JyNodeTemplate; import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings; import org.openecomp.sdc.toscaparser.jython.parameters.JyInput; @@ -23,10 +24,11 @@ public class SubstitutionMappings { } public List<NodeTemplate> getNodeTemplates() { - return jySubstitutionMappings.getJyNodeTemplates() + List<JyNodeTemplate> jyNodeTemplates = jySubstitutionMappings.getJyNodeTemplates(); + return jyNodeTemplates != null ? jyNodeTemplates .stream() .map(NodeTemplate::new) - .collect(toImmutableList()); + .collect(toImmutableList()) : new ArrayList<>(); } public List<Group> getGroups() { @@ -49,12 +51,17 @@ public class SubstitutionMappings { return new NodeType(jySubstitutionMappings.getJyNodeDefinition()); } + public Metadata getMetadata(){ + return jySubstitutionMappings.getJyMetadata() != null ? new Metadata(jySubstitutionMappings.getJyMetadata()) : null; + } + @Override public String toString() { return MoreObjects.toStringHelper(this) .add("nodeTemplates", getNodeTemplates()) .add("inputs", getInputs()) .add("nodeDefinition", getNodeDefinition()) + .add("metadata", getMetadata()) .toString(); } } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java index 1130e8c..537aa89 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java @@ -1,6 +1,7 @@ package org.openecomp.sdc.toscaparser.jython; import java.util.List; +import java.util.Map; import org.openecomp.sdc.toscaparser.jython.elements.JyNodeType; import org.openecomp.sdc.toscaparser.jython.parameters.JyInput; @@ -11,4 +12,5 @@ public interface JySubstitutionMappings { List<JyInput> getJyInputs(); List<JyGroup> getJyGroups(); JyNodeType getJyNodeDefinition(); + Map<String, Object> getJyMetadata(); } diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py index 9a14f6f..ce21203 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py @@ -38,17 +38,17 @@ class SubstitutionMappings(JySubstitutionMappings): OPTIONAL_OUTPUTS = ['tosca_id', 'tosca_name', 'state'] - def __init__(self, sub_mapping_def, nodetemplates, inputs, outputs, groups, #ATT - sub_mapped_node_template, custom_defs): + def __init__(self, sub_mapping_def, nodetemplates, inputs, outputs, groups, + sub_mapped_node_template, custom_defs, metadata): self.nodetemplates = nodetemplates self.sub_mapping_def = sub_mapping_def self.inputs = inputs or [] self.outputs = outputs or [] - self.groups = groups or [] #ATT + self.groups = groups or [] self.sub_mapped_node_template = sub_mapped_node_template self.custom_defs = custom_defs or {} self._validate() - + self.metadata = metadata self._capabilities = None self._requirements = None @@ -58,12 +58,15 @@ class SubstitutionMappings(JySubstitutionMappings): def getJyInputs(self): return self.inputs - def getJyGroups(self): #ATT + def getJyGroups(self): return self.groups def getJyNodeDefinition(self): return self.node_definition + def getJyMetadata(self): + return self.metadata + @property def type(self): if self.sub_mapping_def: diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py index a64c561..d314e00 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py @@ -148,7 +148,8 @@ class TopologyTemplate(JyTopologyTemplate): self.outputs, self.groups, #ATT self.sub_mapped_node_template, - self.custom_defs) + self.custom_defs, + self.meta_data) def _policies(self): policies = [] |