diff options
author | Kanagaraj Manickam <kanagaraj.manickam@huawei.com> | 2020-07-31 14:45:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-07-31 14:45:37 +0000 |
commit | fc9af3118881c83a0928e9a21135641808288f84 (patch) | |
tree | b10870dbe873fd7aee7e45f29c034eb72db6491d /framework/src/main/java/org/onap | |
parent | 53a2a014e9ab8654b35104e7de6a5de80fb3073d (diff) | |
parent | 124caf6d7e77a1e8253eccfa6b6971644ca01317 (diff) |
Merge "code improvements- incorporating comments"
Diffstat (limited to 'framework/src/main/java/org/onap')
3 files changed, 61 insertions, 61 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java index 7de56025..aa45f58e 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java @@ -160,7 +160,7 @@ public class OnapCommandSchemaLoader { errors.addAll(parseSchema(cmd, defaultParameterMap, validateSchema)); } - Map<String, ?> commandYamlMap = validateSchemaVersion(schemaName, cmd.getSchemaVersion()); + Map<String, Object> commandYamlMap = validateSchemaVersion(schemaName, cmd.getSchemaVersion()); errors.addAll(parseSchema(cmd, commandYamlMap, validateSchema)); diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java index 6ad0274e..c2ae189b 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java @@ -116,26 +116,26 @@ public class OnapCommandSchemaMerger { //Name should be existing in the map, otherwise continue as don't know how to compare if (nameN != null) { - boolean existing = false; - for (Object e: originalList) { - Map<String, Object> oE = (Map) e; - String nameE = (String)oE.getOrDefault(OnapCommandConstants.NAME, null); - - //Name should be existing in the map, otherwise continue as don't know how to compare - if (nameN.equals(nameE)) { - for (Entry<String, Object> oNe : oN.entrySet()) { - oE.put(oNe.getKey(), oNe.getValue()); + boolean existing = false; + for (Object e: originalList) { + Map<String, Object> oE = (Map) e; + String nameE = (String)oE.getOrDefault(OnapCommandConstants.NAME, null); + + //Name should be existing in the map, otherwise continue as don't know how to compare + if (nameN.equals(nameE)) { + for (Entry<String, Object> oNe : oN.entrySet()) { + oE.put(oNe.getKey(), oNe.getValue()); + } + existing = true; + break; } - existing = true; - break; } - } - if (!existing) { - originalList.add(o); + if (!existing) { + originalList.add(o); + } } } - } } } diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java index b866db09..614eb2a9 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java @@ -337,65 +337,65 @@ public class OnapCommandDiscoveryUtils { OnapCommandUtils.log.info("Invalid Schema yaml {}" + schema.getSchemaURI()); } else{ - schema.setVersion(obj.toString()); + schema.setVersion(obj.toString()); - if (!schema.getVersion().equalsIgnoreCase(OnapCommandConstants.OPEN_CLI_SCHEMA_VERSION_VALUE_1_0)) { - OnapCommandUtils.log.info("Unsupported Schema version found {} " + schema.getSchemaURI()); - } - else{ + if (!schema.getVersion().equalsIgnoreCase(OnapCommandConstants.OPEN_CLI_SCHEMA_VERSION_VALUE_1_0)) { + OnapCommandUtils.log.info("Unsupported Schema version found {} " + schema.getSchemaURI()); + } + else{ - //There are schema like default input parameters and does not have command name - if (resourceMap.get(NAME) != null) { - schema.setSchemaName(resource.getFilename()); - schema.setCmdName((String) resourceMap.get(NAME)); + //There are schema like default input parameters and does not have command name + if (resourceMap.get(NAME) != null) { + schema.setSchemaName(resource.getFilename()); + schema.setCmdName((String) resourceMap.get(NAME)); - schema.setDescription((String) resourceMap.get(DESCRIPTION)); + schema.setDescription((String) resourceMap.get(DESCRIPTION)); - Map<String, ?> infoMap = (Map<String, ?>) resourceMap.get(OnapCommandConstants.INFO); - if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_TYPE) != null) { - schema.setType(infoMap.get(OnapCommandConstants.INFO_TYPE).toString()); - } + Map<String, ?> infoMap = (Map<String, ?>) resourceMap.get(OnapCommandConstants.INFO); + if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_TYPE) != null) { + schema.setType(infoMap.get(OnapCommandConstants.INFO_TYPE).toString()); + } - if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_PRODUCT) != null) { - schema.setProduct(infoMap.get(OnapCommandConstants.INFO_PRODUCT).toString()); - } + if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_PRODUCT) != null) { + schema.setProduct(infoMap.get(OnapCommandConstants.INFO_PRODUCT).toString()); + } - if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_IGNORE) != null) { - schema.setIgnore(infoMap.get(OnapCommandConstants.INFO_IGNORE).toString()); - } + if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_IGNORE) != null) { + schema.setIgnore(infoMap.get(OnapCommandConstants.INFO_IGNORE).toString()); + } - if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_STATE) != null) { - schema.setState(infoMap.get(OnapCommandConstants.INFO_STATE).toString()); - } + if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_STATE) != null) { + schema.setState(infoMap.get(OnapCommandConstants.INFO_STATE).toString()); + } - if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_SERVICE) != null) { - schema.setService(infoMap.get(OnapCommandConstants.INFO_SERVICE).toString()); - } + if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_SERVICE) != null) { + schema.setService(infoMap.get(OnapCommandConstants.INFO_SERVICE).toString()); + } - if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_AUTHOR) != null) { - schema.setAuthor(infoMap.get(OnapCommandConstants.INFO_AUTHOR).toString()); - } + if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_AUTHOR) != null) { + schema.setAuthor(infoMap.get(OnapCommandConstants.INFO_AUTHOR).toString()); + } - if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_METADATA) != null) { - schema.setMetadata((Map<String, String>)infoMap.get(OnapCommandConstants.INFO_METADATA)); - } + if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_METADATA) != null) { + schema.setMetadata((Map<String, String>)infoMap.get(OnapCommandConstants.INFO_METADATA)); + } - schema.setSchemaProfile(identitySchemaProfileType(resourceMap)); + schema.setSchemaProfile(identitySchemaProfileType(resourceMap)); - if (resourceMap.containsKey(PARAMETERS)) { - schema.setInputs((List<Object>)resourceMap.get(PARAMETERS)); - if (defaultInputs.get(schema.getSchemaProfile()) != null) { - schema.getInputs().addAll(defaultInputs.get(schema.getSchemaProfile())); - } - } + if (resourceMap.containsKey(PARAMETERS)) { + schema.setInputs((List<Object>)resourceMap.get(PARAMETERS)); + if (defaultInputs.get(schema.getSchemaProfile()) != null) { + schema.getInputs().addAll(defaultInputs.get(schema.getSchemaProfile())); + } + } - if (resourceMap.containsKey(RESULTS)) { - schema.setOutputs((List<Object>)((Map<String, Object>)resourceMap.get(RESULTS)).get(ATTRIBUTES)); - } + if (resourceMap.containsKey(RESULTS)) { + schema.setOutputs((List<Object>)((Map<String, Object>)resourceMap.get(RESULTS)).get(ATTRIBUTES)); + } - extSchemas.add(schema); - } - } + extSchemas.add(schema); + } + } } } } |