diff options
Diffstat (limited to 'jython-tosca-parser/src/main/java/org/openecomp')
4 files changed, 49 insertions, 36 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(); } |