diff options
author | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2017-10-04 10:27:42 +0530 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2017-11-14 14:39:54 +0530 |
commit | 01dbd2dc5ac04c7018d3a474c329b40f33d3c400 (patch) | |
tree | 2c51c783cfd1c046f93ffedbb75b23767eea5be4 /framework/src/main/java | |
parent | de0dcbad873481bee88eb68e2c03a82bdad85781 (diff) |
Add is_include to parameter
Issue-Id: CLI-66
Change-Id: I91c513709c40808f720ace049b28e8e1ba798e33
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/main/java')
3 files changed, 33 insertions, 0 deletions
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 64747bf9..c379a879 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 @@ -109,6 +109,7 @@ public class Constants { public static final String IS_OPTIONAL = "is_optional"; public static final String DEFAULT_VALUE = "default_value"; public static final String IS_SECURED = "is_secured"; + public static final String IS_INCLUDE = "is_include"; public static final String DIRECTION = "direction"; public static final String ATTRIBUTES = "attributes"; diff --git a/framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java b/framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java index 3ba15ff4..2a91f8d9 100644 --- a/framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java +++ b/framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java @@ -87,9 +87,17 @@ public class OnapCommandParameter { /* * raw value, get stored as its without processing it. + * it will have same value as stored in yaml template */ private Object rawValue = null; + /* + * to support include concepts of templates, new variable + * called is_include is introduced and default its always + * true. + */ + private boolean isInclude = true; + public String getName() { return cmdName; } @@ -236,6 +244,14 @@ public class OnapCommandParameter { this.isSecured = isSecured; } + public boolean isInclude() { + return isInclude; + } + + public void setInclude(boolean isInclude) { + this.isInclude = isInclude; + } + public static String printShortOption(String option) { return "-" + option; } diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java index 2261766d..29e00b0f 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java @@ -64,6 +64,7 @@ import static org.onap.cli.fw.conf.Constants.INPUT_PARAMS_LIST; import static org.onap.cli.fw.conf.Constants.INPUT_PARAMS_MANDATORY_LIST; import static org.onap.cli.fw.conf.Constants.IS_OPTIONAL; import static org.onap.cli.fw.conf.Constants.IS_SECURED; +import static org.onap.cli.fw.conf.Constants.IS_INCLUDE; import static org.onap.cli.fw.conf.Constants.LONG_OPTION; import static org.onap.cli.fw.conf.Constants.METHOD; import static org.onap.cli.fw.conf.Constants.METHOD_TYPE; @@ -674,6 +675,21 @@ public class OnapCommandUtils { param.setSecured(false); } break; + + case IS_INCLUDE: + if (validate) { + if (!validateBoolean(String.valueOf(parameter.get(key2)))) { + exceptionList.add(invalidBooleanValueMessage(parameter.get(NAME), + IS_INCLUDE, parameter.get(key2))); + } + } + + if ("true".equalsIgnoreCase(String.valueOf(parameter.get(key2)))) { + param.setInclude(true); + } else { + param.setInclude(false); + } + break; } } |