Lior Vernia has posted comments on this change.
Change subject: webadmin: Added overloaded method for RunMultipleActions()
......................................................................
Patch Set 1: (3 inline comments)
Sorry Daniel, didn't notice your comments! Two are fixed in coming patchset.
....................................................
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) {
No problem, I'll add it, I just never used it myself so I didn't know it was
useful. Will leave an overload without it though.
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));
No problem. I did it with LinkedList because that's a better data structure
from which head to remove items. But for readability I'll give that up :)
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);
How strongly do you feel about it? :) Because it's definitely a lot shorter,
code-wise, than writing from scratch. And I think it's good that there's one
path of code, etc.
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