Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Added a couple of overloads to RunMultipleActions
......................................................................

webadmin: Added a couple of overloads to RunMultipleActions

For the sake of convenience.

Change-Id: I1d1bc2950c26e858076fc5df0a6f10d0cad9477e
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/Frontend.java
1 file changed, 44 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/18269/1

diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/Frontend.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/Frontend.java
index 5b7c8eb..a2fab70 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/Frontend.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/Frontend.java
@@ -651,9 +651,17 @@
     }
 
     /**
-     * A convenience method that calls
-     * {@link #RunMultipleActions(List, List, List, 
IFrontendActionAsyncCallback, Object)} with just the one
-     * VdcActionType for all actions, and a single callback to be called when 
all actions have succeeded.
+     * Overloaded method for {@link #RunMultipleActions(VdcActionType, List, 
List, Object)} with state = null.
+     */
+    public static void RunMultipleActions(VdcActionType actionType,
+            List<VdcActionParametersBase> parameters,
+            List<IFrontendActionAsyncCallback> callbacks) {
+        RunMultipleActions(actionType, parameters, callbacks, null);
+    }
+
+    /**
+     * A convenience method that calls {@link 
#RunMultipleActions(VdcActionType, List, List, Object)} with just a single
+     * callback to be called when all actions have succeeded.
      *
      * @param actionType
      *            the action to be repeated.
@@ -661,6 +669,8 @@
      *            the parameters of each action.
      * @param successCallback
      *            the callback to be executed when all actions have succeeded.
+     * @param state
+     *            the state.
      */
     public static void RunMultipleActions(VdcActionType actionType,
             List<VdcActionParametersBase> parameters,
@@ -671,13 +681,41 @@
             return;
         }
         int n = parameters.size();
-        VdcActionType[] actionTypes = new VdcActionType[n];
         IFrontendActionAsyncCallback[] callbacks = new 
IFrontendActionAsyncCallback[n];
-        Arrays.fill(actionTypes, actionType);
         callbacks[n-1] = successCallback;
-        RunMultipleActions(new 
LinkedList<VdcActionType>(Arrays.asList(actionTypes)),
+        RunMultipleActions(actionType,
                 parameters,
                 new 
LinkedList<IFrontendActionAsyncCallback>(Arrays.asList(callbacks)),
+                state);
+    }
+
+    /**
+     * A convenience method that calls
+     * {@link #RunMultipleActions(List, List, List, 
IFrontendActionAsyncCallback, Object)} with just the one
+     * VdcActionType for all actions.
+     *
+     * @param actionType
+     *            the action to be repeated.
+     * @param parameters
+     *            the parameters of each action.
+     * @param callbacks
+     *            the callback to be executed upon the success of each action.
+     * @param state
+     *            the state.
+     */
+    public static void RunMultipleActions(VdcActionType actionType,
+            List<VdcActionParametersBase> parameters,
+            List<IFrontendActionAsyncCallback> callbacks,
+            Object state) {
+
+        if (parameters == null || parameters.isEmpty()) {
+            return;
+        }
+        VdcActionType[] actionTypes = new VdcActionType[parameters.size()];
+        Arrays.fill(actionTypes, actionType);
+        RunMultipleActions(new 
LinkedList<VdcActionType>(Arrays.asList(actionTypes)),
+                parameters,
+                callbacks,
                 null,
                 state);
     }


-- 
To view, visit http://gerrit.ovirt.org/18269
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d1bc2950c26e858076fc5df0a6f10d0cad9477e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <lver...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to