summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/Constants.java1
-rw-r--r--framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java16
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java16
-rw-r--r--framework/src/test/resources/sample-test-schema.yaml1
4 files changed, 34 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;
}
}
diff --git a/framework/src/test/resources/sample-test-schema.yaml b/framework/src/test/resources/sample-test-schema.yaml
index d77cb114..37623dde 100644
--- a/framework/src/test/resources/sample-test-schema.yaml
+++ b/framework/src/test/resources/sample-test-schema.yaml
@@ -14,6 +14,7 @@ parameters:
long_option: bool
is_optional: true
default_value: false
+ is_include: true
- name: secure-param
type: string
description: Onap secure param such as password