aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/main/java/org/onap
diff options
context:
space:
mode:
authorpriyanka.akhade <priyanka.akhade@huawei.com>2020-07-17 23:47:09 +0530
committerpriyanka.akhade <priyanka.akhade@huawei.com>2020-07-17 23:49:11 +0530
commit124caf6d7e77a1e8253eccfa6b6971644ca01317 (patch)
treeda900fcb1b25d45ea83c235af67a286da95c2997 /framework/src/main/java/org/onap
parent9a08d687e48312beef47bce357d374ede2ce0dc7 (diff)
code improvements- incorporating comments
Signed-off-by: priyanka.akhade <priyanka.akhade@huawei.com> Issue-ID: CLI-270 Change-Id: I656eab21336ba224917ac5df022f59697330b132
Diffstat (limited to 'framework/src/main/java/org/onap')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java30
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java90
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);
+ }
+ }
}
}
}