Daniel Erez has posted comments on this change.
Change subject: webadmin: Added overloaded method for RunMultipleActions()
......................................................................
Patch Set 1: (3 inline comments)
....................................................
File
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/Frontend.java
Line 629: * the callback to be executed when all actions have
succeeded.
Line 630: */
Line 631: public static void RunMultipleActions(VdcActionType actionType,
Line 632: List<VdcActionParametersBase> parameters,
Line 633: IFrontendActionAsyncCallback successCallback) {
'state' is usually quite useful... why not allow passing it?
Line 634:
Line 635: if (parameters == null || parameters.isEmpty()) {
Line 636: return;
Line 637: }
Line 638: int n = parameters.size();
Line 639: List<VdcActionType> actionTypes = new
LinkedList<VdcActionType>(Collections.nCopies(n, actionType));
Line 640: List<IFrontendActionAsyncCallback> callbacks =
Line 641: new
LinkedList<IFrontendActionAsyncCallback>(Collections.<IFrontendActionAsyncCallback>
nCopies(n - 1,
Line 642: null));
I think it's more readable to just create a new ArrayList(n) and .set(n-1,
successCallback);
Line 643: callbacks.add(successCallback);
Line 644: RunMultipleActions(actionTypes, parameters, callbacks, null,
null);
Line 645: }
Line 646:
Line 640: List<IFrontendActionAsyncCallback> callbacks =
Line 641: new
LinkedList<IFrontendActionAsyncCallback>(Collections.<IFrontendActionAsyncCallback>
nCopies(n - 1,
Line 642: null));
Line 643: callbacks.add(successCallback);
Line 644: RunMultipleActions(actionTypes, parameters, callbacks, null,
null);
It's a rather hacky way of reusing the current RunMultipleActions method :) Not
sure it's not simpler to write a new one from scratch... (i.e. just use the
specified 'actionType' and 'successCallback' vars)
Line 645: }
Line 646:
Line 647: public static void RunMultipleActions(final List<VdcActionType>
actionTypes,
Line 648: final List<VdcActionParametersBase> parameters,
--
To view, visit http://gerrit.ovirt.org/15859
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifbe1f99f72238714028b7f7762d67109559c473e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <[email protected]>
Gerrit-Reviewer: Alona Kaplan <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Lior Vernia <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches