diff options
author | 2016-12-15 19:44:24 +0800 | |
---|---|---|
committer | 2016-12-15 19:44:24 +0800 | |
commit | 4fb454c59d38b7748b678d5a58dd13c409d34962 (patch) | |
tree | 4643bb0ea3b9a6651a7bdae780c5a7051a1e9f8f /catalog-core/catalog-mgr/src/main/java/org/openo/commontosca | |
parent | 3e702870b6e2ae56e6db8304d80bef785e8ef9c6 (diff) |
Co-debug 'SubstitutionMapping' with tosca-yaml-parser.
Change-Id: Ia7702741acbbdccd193d0f3ac5edde15d3ed9715
Issue-id: TOSCA-191
Signed-off-by: 10090474 <yuan.hu1@zte.com.cn>
Diffstat (limited to 'catalog-core/catalog-mgr/src/main/java/org/openo/commontosca')
2 files changed, 15 insertions, 32 deletions
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/ToscaYamlModelParser.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/ToscaYamlModelParser.java index b02a6b23..632d60c4 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/ToscaYamlModelParser.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/ToscaYamlModelParser.java @@ -229,7 +229,7 @@ public class ToscaYamlModelParser extends AbstractModelParser { if (result.getTopologyTemplate().getSubstitutionMappings() == null) { return null; } - return result.getTopologyTemplate().getSubstitutionMappings().getNodeType(); + return result.getTopologyTemplate().getSubstitutionMappings().getNode_type(); } } diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/entity/ParseYamlResult.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/entity/ParseYamlResult.java index 5bdab1c2..4fc2d825 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/entity/ParseYamlResult.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/entity/ParseYamlResult.java @@ -463,17 +463,16 @@ public class ParseYamlResult { } public class SubstitutionMapping { - private String nodeType; + private String node_type; private JsonObject requirements; private JsonObject capabilities; - private JsonObject properties; - - public String getNodeType() { - return nodeType; + + public String getNode_type() { + return node_type; } - public void setNodeType(String nodeType) { - this.nodeType = nodeType; + public void setNode_type(String node_type) { + this.node_type = node_type; } public JsonObject getRequirements() { @@ -489,8 +488,11 @@ public class ParseYamlResult { } private Map<String, String[]> jsonObjects2Requirements(JsonObject requirements) { + if (requirements == null) { + return new HashMap<String, String[]>(); + } + Map<String, String[]> ret = new HashMap<String, String[]>(); - Iterator<Entry<String, JsonElement>> iterator = requirements.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, JsonElement> next = iterator.next(); @@ -529,8 +531,11 @@ public class ParseYamlResult { } private Map<String, String[]> jsonObject2Capabilities(JsonObject capabilities) { + if (capabilities == null) { + return new HashMap<String, String[]>(); + } + Map<String, String[]> ret = new HashMap<String, String[]>(); - Iterator<Entry<String, JsonElement>> iterator = capabilities.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, JsonElement> next = iterator.next(); @@ -547,28 +552,6 @@ public class ParseYamlResult { return ret; } - - public JsonObject getProperties() { - return properties; - } - - public void setProperties(JsonObject properties) { - this.properties = properties; - } - - public Map<String, Object> getPropertyList() { - return jsonObject2Properties(properties); - } - - private Map<String, Object> jsonObject2Properties(JsonObject properties) { - Map<String, Object> ret = new HashMap<>(); - Iterator<Entry<String, JsonElement>> iterator = properties.entrySet().iterator(); - while (iterator.hasNext()) { - Entry<String, JsonElement> next = iterator.next(); - ret.put(next.getKey(), ToolUtil.getAsString(next.getValue())); - } - return ret; - } } } |