From 4c756557229bbb489cefa048d265c5454b20a4ce Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Thu, 17 Aug 2017 16:27:29 +0530 Subject: Add UUID param type CLI-13 Change-Id: Ia312119a9bf6b5075d482d28008569658c76ae58 Signed-off-by: Kanagaraj Manickam k00365106 --- .../src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java | 3 +++ framework/src/main/java/org/onap/cli/fw/input/ParameterType.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'framework') 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); } -- cgit 1.2.3-korg