Tal Nisan has uploaded a new change for review. Change subject: webadmin: Cleanup of Frontend class ......................................................................
webadmin: Cleanup of Frontend class - Remove of unused methods and members - Remove return types from unsupported sync methods and mark them as deprecated Change-Id: I2799eed79b4534d103fbbc53a6658ecc950c43f0 Signed-off-by: Tal Nisan <tni...@redhat.com> --- M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/Frontend.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/roles_ui/RoleListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java D frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/FindDesktopModel.java 5 files changed, 23 insertions(+), 129 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/11268/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 1d3b829..bc6bd37 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 @@ -20,8 +20,6 @@ import org.ovirt.engine.core.compat.Event; import org.ovirt.engine.core.compat.EventArgs; import org.ovirt.engine.core.compat.EventDefinition; -import org.ovirt.engine.core.compat.Guid; -import org.ovirt.engine.core.compat.NotImplementedException; import org.ovirt.engine.ui.frontend.gwtservices.GenericApiGWTServiceAsync; import org.ovirt.engine.ui.uicompat.ConstantsManager; import org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult; @@ -78,8 +76,6 @@ return queryKey; } } - - private static final String RPC_TIMEOUT_EXCEPTION_STATUS_CODE_PREFIX = "120"; //$NON-NLS-1$ private static Logger logger = Logger.getLogger(Frontend.class.getName()); private static IFrontendEventsHandler eventsHandler; @@ -282,11 +278,6 @@ queryWrapper.getParameters() instanceof SearchParameters; } - public static VdcQueryReturnValue RunQuery(VdcQueryType queryType, VdcQueryParametersBase parameters) { - logger.fine("Sync RunQuery is invoked, this is not supported! replace the call with the async method!"); //$NON-NLS-1$ - return null; - } - public static void RunPublicQuery(final VdcQueryType queryType, final VdcQueryParametersBase parameters, final AsyncQuery callback) { @@ -341,11 +332,6 @@ } } }); - } - - public static VdcQueryReturnValue RunPublicQuery(VdcQueryType queryType, VdcQueryParametersBase parameters) { - logger.warning("Frontend: RunPublicQuery -sync- was executed, this method is not supported!"); //$NON-NLS-1$ - return null; } public static void RunMultipleQueries(final ArrayList<VdcQueryType> queryTypeList, @@ -487,7 +473,11 @@ }); } - public static VdcReturnValueBase RunAction(final VdcActionType actionType, final VdcActionParametersBase parameters) { + /** + * @deprecated Please use async runAction instead, sync operations are not supported + */ + @Deprecated + public static void RunAction(final VdcActionType actionType, final VdcActionParametersBase parameters) { logger.warning("Sync RunAction is invoked, this is not supported! replace the call with the async method!"); //$NON-NLS-1$ dumpActionDetails(actionType, parameters); @@ -510,8 +500,6 @@ handleActionResult(actionType, parameters, result, null, null); } }); - - return new VdcReturnValueBase(); } public static void RunMultipleAction(final VdcActionType actionType, @@ -567,10 +555,13 @@ }); } - public static ArrayList<VdcReturnValueBase> RunMultipleAction(VdcActionType actionType, + /** + * @deprecated Please use async RunMultipleAction instead, sync operations are not supported + */ + @Deprecated + public static void RunMultipleAction(VdcActionType actionType, ArrayList<VdcActionParametersBase> parameters) { RunMultipleAction(actionType, parameters, null, null); - return null; } public static void RunMultipleActions(final ArrayList<VdcActionType> actionTypes, @@ -608,10 +599,6 @@ } } }, state); - } - - public static void UnregisterQuery(Guid asyncSearchId) { - throw new NotImplementedException("UnregisterQuery is not implemented!"); //$NON-NLS-1$ } public static void LoginAsync(final String userName, final String password, final String domain, final AsyncQuery callback) { @@ -798,12 +785,20 @@ } } + /** + * @deprecated Not supported + */ + @Deprecated public static RegistrationResult RegisterQuery(VdcQueryType queryType, VdcQueryParametersBase paramenters) { // TODO Auto-generated method stub return null; } + /** + * @deprecated Not supported + */ + @Deprecated public static RegistrationResult RegisterSearch(String searchString, SearchType entityType, int searchPageSize) { // TODO Auto-generated method stub diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java index 6fdab73..8882d62 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java @@ -816,7 +816,6 @@ getTimer().stop(); if (getAsyncResult() != null && !getAsyncResult().getId().equals(NGuid.Empty)) { - Frontend.UnregisterQuery(getAsyncResult().getId()); setAsyncResult(null); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/roles_ui/RoleListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/roles_ui/RoleListModel.java index 223583e..12b6a6f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/roles_ui/RoleListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/roles_ui/RoleListModel.java @@ -11,8 +11,8 @@ import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.businessentities.ActionGroup; -import org.ovirt.engine.core.common.businessentities.RoleType; import org.ovirt.engine.core.common.businessentities.Role; +import org.ovirt.engine.core.common.businessentities.RoleType; import org.ovirt.engine.core.common.queries.MultilevelAdministrationByRoleIdParameters; import org.ovirt.engine.core.common.queries.MultilevelAdministrationsQueriesParameters; import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; @@ -591,14 +591,14 @@ ActionGroupsToRoleParameter tempVar2 = new ActionGroupsToRoleParameter(); tempVar2.setActionGroups(roleListModel.detachActionGroup); tempVar2.setRoleId(roleListModel.role.getId()); - retVal = Frontend.RunAction(VdcActionType.DetachActionGroupsFromRole, tempVar2); + Frontend.RunAction(VdcActionType.DetachActionGroupsFromRole, tempVar2); } if (roleListModel.attachActionGroup.size() > 0) { ActionGroupsToRoleParameter tempVar3 = new ActionGroupsToRoleParameter(); tempVar3.setActionGroups(roleListModel.attachActionGroup); tempVar3.setRoleId(roleListModel.role.getId()); - retVal = Frontend.RunAction(VdcActionType.AttachActionGroupsToRole, tempVar3); + Frontend.RunAction(VdcActionType.AttachActionGroupsToRole, tempVar3); } roleListModel.getWindow().StopProgress(); roleListModel.Cancel(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java index ee6348e..5c19e87 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java @@ -233,17 +233,12 @@ private void ChangePassword() { - VdcReturnValueBase returnValue = - Frontend.RunAction(VdcActionType.ChangeUserPassword, + // TODO: Invoke the async query and handle failure correctly + Frontend.RunAction(VdcActionType.ChangeUserPassword, new ChangeUserPasswordParameters((String) getUserName().getEntity(), (String) getPassword().getEntity(), (String) getNewPassword().getEntity(), (String) getDomain().getSelectedItem())); - - if (returnValue != null && returnValue.getSucceeded()) - { - // TODO: - } } @Override diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/FindDesktopModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/FindDesktopModel.java deleted file mode 100644 index 354ede2..0000000 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/FindDesktopModel.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.ovirt.engine.ui.uicommonweb.models.users; - -import org.ovirt.engine.core.common.businessentities.IVdcQueryable; -import org.ovirt.engine.core.common.businessentities.VM; -import org.ovirt.engine.core.common.interfaces.SearchType; -import org.ovirt.engine.core.common.queries.SearchParameters; -import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; -import org.ovirt.engine.core.common.queries.VdcQueryType; -import org.ovirt.engine.core.compat.Guid; -import org.ovirt.engine.ui.frontend.Frontend; -import org.ovirt.engine.ui.uicommonweb.models.EntityModel; -import org.ovirt.engine.ui.uicommonweb.models.SearchableListModel; - -import java.util.ArrayList; -import java.util.HashSet; - -@SuppressWarnings("unused") -public class FindDesktopModel extends SearchableListModel -{ - - private Iterable privateExcludeItems; - - public Iterable getExcludeItems() - { - return privateExcludeItems; - } - - public void setExcludeItems(Iterable value) - { - privateExcludeItems = value; - } - - public FindDesktopModel() - { - setIsTimerDisabled(true); - } - - @Override - protected void SyncSearch() - { - // List<VM> exclude = ExcludeItems != null ? Linq.Cast<VM>(ExcludeItems) : new List<VM>(); - - HashSet<Guid> exludeGuids = new HashSet<Guid>(); - if (getExcludeItems() != null) - { - for (Object item : getExcludeItems()) - { - VM vm = (VM) item; - exludeGuids.add(vm.getId()); - } - } - - VdcQueryReturnValue returnValue = - Frontend.RunQuery(VdcQueryType.Search, - new SearchParameters("Vms: pool=null type=desktop " + getSearchString(), //$NON-NLS-1$ - SearchType.VM)); - if (returnValue != null && returnValue.getSucceeded()) - { - // List<EntityModel> items = ((List<IVdcQueryable>)returnValue.ReturnValue) - // .Cast<VM>() - // .Where(a => !exclude.Any(b => b.vm_guid == a.vm_guid)) - // .Select(a => new EntityModel() { Entity = a }) - // .ToList(); - ArrayList<EntityModel> items = new ArrayList<EntityModel>(); - for (IVdcQueryable item : (ArrayList<IVdcQueryable>) returnValue.getReturnValue()) - { - VM vm = (VM) item; - if (!exludeGuids.contains(vm.getId())) - { - EntityModel tempVar = new EntityModel(); - tempVar.setEntity(vm); - items.add(tempVar); - } - } - - setItems(items); - } - else - { - setItems(null); - } - } - - @Override - protected void AsyncSearch() - { - super.AsyncSearch(); - SyncSearch(); - } - - @Override - protected String getListName() { - return "FindDesktopModel"; //$NON-NLS-1$ - } -} -- To view, visit http://gerrit.ovirt.org/11268 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2799eed79b4534d103fbbc53a6658ecc950c43f0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tal Nisan <tni...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches