diff options
Diffstat (limited to 'jython-tosca-parser/src/main')
6 files changed, 57 insertions, 38 deletions
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java index 97563fb..abf1b53 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.toscaparser.api; +import static com.google.common.collect.ImmutableList.toImmutableList; + import java.util.List; import java.util.Objects; @@ -10,40 +12,47 @@ import com.google.common.base.MoreObjects; public class ToscaTemplate { - private final JyToscaTemplate jyToscaTemplate; - private final TopologyTemplate topologyTemplate; - - public ToscaTemplate(JyToscaTemplate jyToscaTemplate, TopologyTemplate topologyTemplate) { - this.jyToscaTemplate = Objects.requireNonNull(jyToscaTemplate); - this.topologyTemplate = Objects.requireNonNull(topologyTemplate); - } - - public String getVersion() { - return jyToscaTemplate.getJyVersion(); - } - - public String getDescription() { - return jyToscaTemplate.getJyDescription(); - } - - public TopologyTemplate getTopologyTemplate() { - return topologyTemplate; - } - - public List<NodeTemplate> getNodeTemplates() { - return topologyTemplate.getNodeTemplates(); - } - - public List<Input> getInputs() { - return topologyTemplate.getInputs(); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("version", getVersion()) - .add("description", getDescription()) - .add("topologyTemplate", topologyTemplate) - .toString(); - } + private final JyToscaTemplate jyToscaTemplate; + private final TopologyTemplate topologyTemplate; + + public ToscaTemplate(JyToscaTemplate jyToscaTemplate, TopologyTemplate topologyTemplate) { + this.jyToscaTemplate = Objects.requireNonNull(jyToscaTemplate); + this.topologyTemplate = Objects.requireNonNull(topologyTemplate); + } + + public String getVersion() { + return jyToscaTemplate.getJyVersion(); + } + + public String getDescription() { + return jyToscaTemplate.getJyDescription(); + } + + public TopologyTemplate getTopologyTemplate() { + return topologyTemplate; + } + + public List<NodeTemplate> getNodeTemplates() { + return topologyTemplate.getNodeTemplates(); + } + + public List<TopologyTemplate> getNestedTopologyTemplates() { + return jyToscaTemplate.getNestedTopologyTemplates() + .stream() + .map(TopologyTemplate::new) + .collect(toImmutableList()); + } + + public List<Input> getInputs() { + return topologyTemplate.getInputs(); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("version", getVersion()) + .add("description", getDescription()) + .add("topologyTemplate", topologyTemplate) + .toString(); + } }
\ No newline at end of file diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java index b700c47..0b9ad7d 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java @@ -22,6 +22,8 @@ public class Input { return jyInput.getJyType(); } + + public boolean isRequired() { return jyInput.isJyRequired(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java index c58a042..7cba568 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java @@ -7,5 +7,6 @@ public interface JyToscaTemplate { String getJyVersion(); String getJyDescription(); List<JyNodeTemplate> getJyNodeTemplates(); + List<JyTopologyTemplate> getNestedTopologyTemplates(); JyTopologyTemplate getJyTopologyTemplate(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java index 320e91b..253805b 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java @@ -4,6 +4,7 @@ public interface JyInput { String getJyName(); String getJyType(); + String getJyDefault(); boolean isJyRequired(); String getJyDescription(); } diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py index 7a4acd9..1bb58be 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py @@ -50,7 +50,10 @@ class Input(JyInput): return self.required def getJyDescription(self): - return self.description + return self.description + + def getJyDefault(self): + return self.default @property def type(self): diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py index 55485f0..6b3ea87 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py @@ -119,8 +119,11 @@ class ToscaTemplate(JyToscaTemplate): return self.description def getJyTopologyTemplate(self): - return self.topology_template + return self.topology_template + def getJyNestedTopologyTemplates(self): + return self.nested_tosca_templates_with_topology + def _topology_template(self): return TopologyTemplate(self._tpl_topology_template(), self._get_all_custom_defs(), |