From df993e4e7a2b5af0c8e0907a80e1a4cef10ee56d Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Thu, 11 Feb 2016 14:17:18 +0000
Subject: [PATCH] OPENDJSDK-42 cli arguments fluent builder

---
 opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/TaskScheduleArgs.java |   85 +++++++++++++++++++++---------------------
 1 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/TaskScheduleArgs.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/TaskScheduleArgs.java
index 70cce69..42a851b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/TaskScheduleArgs.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/TaskScheduleArgs.java
@@ -108,50 +108,49 @@
 
   private void createTaskArguments() throws ArgumentException
   {
-    startArg = new StringArgument(OPTION_LONG_START_DATETIME,
-        OPTION_SHORT_START_DATETIME, OPTION_LONG_START_DATETIME, false, false,
-        true, INFO_START_DATETIME_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_START_DATETIME.get());
+    startArg =
+            StringArgument.builder(OPTION_LONG_START_DATETIME)
+                    .shortIdentifier(OPTION_SHORT_START_DATETIME)
+                    .description(INFO_DESCRIPTION_START_DATETIME.get())
+                    .valuePlaceholder(INFO_START_DATETIME_PLACEHOLDER.get())
+                    .buildArgument();
+    recurringArg =
+            StringArgument.builder(OPTION_LONG_RECURRING_TASK)
+                    .shortIdentifier(OPTION_SHORT_RECURRING_TASK)
+                    .description(INFO_DESCRIPTION_RECURRING_TASK.get())
+                    .valuePlaceholder(INFO_RECURRING_TASK_PLACEHOLDER.get())
+                    .buildArgument();
+    completionNotificationArg =
+            StringArgument.builder(OPTION_LONG_COMPLETION_NOTIFICATION_EMAIL)
+                    .shortIdentifier(OPTION_SHORT_COMPLETION_NOTIFICATION_EMAIL)
+                    .description(INFO_DESCRIPTION_TASK_COMPLETION_NOTIFICATION.get())
+                    .multiValued()
+                    .valuePlaceholder(INFO_EMAIL_ADDRESS_PLACEHOLDER.get())
+                    .buildArgument();
+    errorNotificationArg =
+            StringArgument.builder(OPTION_LONG_ERROR_NOTIFICATION_EMAIL)
+                    .shortIdentifier(OPTION_SHORT_ERROR_NOTIFICATION_EMAIL)
+                    .description(INFO_DESCRIPTION_TASK_ERROR_NOTIFICATION.get())
+                    .multiValued()
+                    .valuePlaceholder(INFO_EMAIL_ADDRESS_PLACEHOLDER.get())
+                    .buildArgument();
+    dependencyArg =
+            StringArgument.builder(OPTION_LONG_DEPENDENCY)
+                    .shortIdentifier(OPTION_SHORT_DEPENDENCY)
+                    .description(INFO_DESCRIPTION_TASK_DEPENDENCY_ID.get())
+                    .multiValued()
+                    .valuePlaceholder(INFO_TASK_ID_PLACEHOLDER.get())
+                    .buildArgument();
 
-    recurringArg = new StringArgument(OPTION_LONG_RECURRING_TASK,
-        OPTION_SHORT_RECURRING_TASK, OPTION_LONG_RECURRING_TASK, false, false,
-        true, INFO_RECURRING_TASK_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_RECURRING_TASK.get());
-
-    completionNotificationArg = new StringArgument(
-        OPTION_LONG_COMPLETION_NOTIFICATION_EMAIL,
-        OPTION_SHORT_COMPLETION_NOTIFICATION_EMAIL,
-        OPTION_LONG_COMPLETION_NOTIFICATION_EMAIL, false, true, true,
-        INFO_EMAIL_ADDRESS_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_TASK_COMPLETION_NOTIFICATION.get());
-
-    errorNotificationArg = new StringArgument(
-        OPTION_LONG_ERROR_NOTIFICATION_EMAIL,
-        OPTION_SHORT_ERROR_NOTIFICATION_EMAIL,
-        OPTION_LONG_ERROR_NOTIFICATION_EMAIL, false, true, true,
-        INFO_EMAIL_ADDRESS_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_TASK_ERROR_NOTIFICATION.get());
-
-    dependencyArg = new StringArgument(OPTION_LONG_DEPENDENCY,
-        OPTION_SHORT_DEPENDENCY, OPTION_LONG_DEPENDENCY, false, true, true,
-        INFO_TASK_ID_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_TASK_DEPENDENCY_ID.get());
-
-    Set<FailedDependencyAction> fdaValSet =
-      EnumSet.allOf(FailedDependencyAction.class);
-    failedDependencyActionArg = new StringArgument(
-        OPTION_LONG_FAILED_DEPENDENCY_ACTION,
-        OPTION_SHORT_FAILED_DEPENDENCY_ACTION,
-        OPTION_LONG_FAILED_DEPENDENCY_ACTION, false, true, true,
-        INFO_ACTION_PLACEHOLDER.get(), null, null,
-        INFO_DESCRIPTION_TASK_FAILED_DEPENDENCY_ACTION.get(
-            Utils.joinAsString(",", fdaValSet),
-            FailedDependencyAction.defaultValue().name()));
-
-    for (Argument arg : getArguments())
-    {
-      arg.setPropertyName(arg.getLongIdentifier());
-    }
+    final Set<FailedDependencyAction> fdaValSet = EnumSet.allOf(FailedDependencyAction.class);
+    failedDependencyActionArg =
+            StringArgument.builder(OPTION_LONG_FAILED_DEPENDENCY_ACTION)
+            .shortIdentifier(OPTION_SHORT_FAILED_DEPENDENCY_ACTION)
+            .description(INFO_DESCRIPTION_TASK_FAILED_DEPENDENCY_ACTION.get(
+                    Utils.joinAsString(",", fdaValSet), FailedDependencyAction.defaultValue().name()))
+            .multiValued()
+            .valuePlaceholder(INFO_ACTION_PLACEHOLDER.get())
+            .buildArgument();
   }
 
   /**

--
Gitblit v1.10.0