aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-12 14:10:30 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-11-20 14:07:05 +0530
commit7ed4d73221126eeb6d02f8f577123c8362b0afd7 (patch)
treea968d255d9dd51d6d300dff00a3a4fbc5ff0f9c4 /framework/src
parent14880ec3b183f52ea3f3fea460adf807c8643b70 (diff)
Add type to schema-refresh command
Issue-Id: CLI-66 Change-Id: I2f6ff7b2eb0584aedb796dc814f6294e26f1f407 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java38
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/Constants.java4
-rw-r--r--framework/src/main/resources/open-cli-schema/schema-refresh.yaml6
4 files changed, 16 insertions, 34 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java b/framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java
index d7254fb2..16b53ea6 100644
--- a/framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java
+++ b/framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java
@@ -20,8 +20,6 @@ import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import org.onap.cli.fw.cmd.CommandType;
-
/**
* Provide command name and schema file location, which is placed in the main resources folder (in classpath). It is
* recommended to keep the name for schema, in the form of oclip-[command-name]-schema.yaml, considered this format as
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java
index 0ea4ef08..53d01a50 100644
--- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java
+++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java
@@ -16,15 +16,13 @@
package org.onap.cli.fw.cmd;
+import java.util.List;
+
import org.onap.cli.fw.OnapCommand;
import org.onap.cli.fw.OnapCommandSchema;
import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.output.OnapCommandResultAttribute;
-import org.onap.cli.fw.utils.SchemaInfo;
import org.onap.cli.fw.utils.OnapCommandUtils;
-
-import java.util.ArrayList;
-import java.util.List;
+import org.onap.cli.fw.utils.SchemaInfo;
/**
* Refresh external schema.
@@ -40,32 +38,14 @@ public class OnapSchemaRefreshCommand extends OnapCommand {
// Will override the existing json file
OnapCommandUtils.persistSchemaInfo(schemas);
- List<String> slNumbers = new ArrayList<>();
- List<String> cmdNames = new ArrayList<>();
- List<String> cmdFiles = new ArrayList<>();
- List<String> versions = new ArrayList<>();
- List<String> cmdVersions = new ArrayList<>();
-
for (int i = 0; i < schemas.size(); i++) {
SchemaInfo schema = schemas.get(i);
- slNumbers.add(String.valueOf(i + 1));
- cmdNames.add(schema.getCmdName());
- cmdFiles.add(schema.getSchemaName());
- versions.add(schema.getVersion());
- cmdVersions.add(schema.getProduct());
- }
- for (OnapCommandResultAttribute attribute : this.getResult().getRecords()) {
- if ("sl-no".equals(attribute.getName())) {
- attribute.setValues(slNumbers);
- } else if ("command".equals(attribute.getName())) {
- attribute.setValues(cmdNames);
- } else if ("product".equals(attribute.getName())) {
- attribute.setValues(cmdVersions);
- } else if ("schema".equals(attribute.getName())) {
- attribute.setValues(cmdFiles);
- } else if ("ocs-version".equals(attribute.getName())) {
- attribute.setValues(versions);
- }
+ this.getResult().getRecordsMap().get("sr.no").getValues().add(String.valueOf(i + 1));
+ this.getResult().getRecordsMap().get("command").getValues().add(schema.getCmdName());
+ this.getResult().getRecordsMap().get("schema").getValues().add(schema.getSchemaName());
+ this.getResult().getRecordsMap().get("ocs-version").getValues().add(schema.getVersion());
+ this.getResult().getRecordsMap().get("product").getValues().add(schema.getProduct());
+ this.getResult().getRecordsMap().get("type").getValues().add(schema.getSchemaProfile());
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
index a0133404..a43dec2b 100644
--- a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
+++ b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
@@ -134,8 +134,8 @@ public class Constants {
public static final String PARAM_CACHE_FILE_NAME = "global-profile";
//normal
- public static final String BASIC_SCHEMA_PROFILE = "basic-schema";
- public static final String HTTP_SCHEMA_PROFILE = "http-schema";
+ public static final String BASIC_SCHEMA_PROFILE = "basic";
+ public static final String HTTP_SCHEMA_PROFILE = "http";
//http
public static final String HTTP = "http";
diff --git a/framework/src/main/resources/open-cli-schema/schema-refresh.yaml b/framework/src/main/resources/open-cli-schema/schema-refresh.yaml
index 349554b0..86829534 100644
--- a/framework/src/main/resources/open-cli-schema/schema-refresh.yaml
+++ b/framework/src/main/resources/open-cli-schema/schema-refresh.yaml
@@ -11,7 +11,7 @@ info:
results:
direction: landscape
attributes:
- - name: sl-no
+ - name: sr.no
description: Serial Number
scope: short
type: string
@@ -30,4 +30,8 @@ results:
- name: ocs-version
description: Schema version
scope: short
+ type: string
+ - name: type
+ description: Command type
+ scope: short
type: string \ No newline at end of file