aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-08-17 16:27:29 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-08-17 16:27:57 +0530
commit4c756557229bbb489cefa048d265c5454b20a4ce (patch)
treec0083a6bbe04d12f4846d05129586cb6f58d179b
parenta2b0adac6b2d29011e543e460a3286ed51a49aa4 (diff)
Add UUID param type
CLI-13 Change-Id: Ia312119a9bf6b5075d482d28008569658c76ae58 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
-rw-r--r--framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java3
-rw-r--r--framework/src/main/java/org/onap/cli/fw/input/ParameterType.java4
2 files changed, 6 insertions, 1 deletions
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 167b353d..31b83abb 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
@@ -26,6 +26,7 @@ import org.onap.cli.fw.error.OnapCommandParameterMissing;
import java.io.File;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
/**
* Onap Command's input parameter.
@@ -130,6 +131,8 @@ public class OnapCommandParameter {
} else if (this.getParameterType().equals(ParameterType.BOOL)) {
// For bool type always the default param is false
this.defaultValue = "false";
+ } else if (this.defaultValue.isEmpty() && this.getParameterType().equals(ParameterType.UUID)) {
+ this.defaultValue = UUID.randomUUID().toString();
}
return defaultValue;
diff --git a/framework/src/main/java/org/onap/cli/fw/input/ParameterType.java b/framework/src/main/java/org/onap/cli/fw/input/ParameterType.java
index ec76e0b4..c93d92fe 100644
--- a/framework/src/main/java/org/onap/cli/fw/input/ParameterType.java
+++ b/framework/src/main/java/org/onap/cli/fw/input/ParameterType.java
@@ -34,7 +34,7 @@ public enum ParameterType {
/**
* URL location.
*/
- URL, BOOL, ARRAY, MAP, BINARY;
+ URL, BOOL, ARRAY, MAP, BINARY, UUID;
/**
* Get parameter type.
@@ -64,6 +64,8 @@ public enum ParameterType {
return MAP;
} else if (BINARY.name().equalsIgnoreCase(name)) {
return BINARY;
+ } else if (UUID.name().equalsIgnoreCase(name)) {
+ return UUID;
} else {
throw new OnapCommandInvalidParameterType(name);
}