Search in sources :

Example 11 with SearchParameters

use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.

the class GuideModel method checkVdsClusterChangeSucceeded.

protected void checkVdsClusterChangeSucceeded(final String searchStr, final List<ActionParametersBase> changeVdsParameterList, final List<ActionParametersBase> activateVdsParameterList) {
    final Map<Guid, Guid> hostClusterIdMap = new HashMap<>();
    for (ActionParametersBase param : changeVdsParameterList) {
        hostClusterIdMap.put(((ChangeVDSClusterParameters) param).getVdsId(), ((ChangeVDSClusterParameters) param).getClusterId());
    }
    Frontend.getInstance().runQuery(QueryType.Search, new SearchParameters(searchStr, SearchType.VDS), new AsyncQuery<QueryReturnValue>(returnValue -> {
        List<VDS> hosts = returnValue.getReturnValue();
        boolean succeeded = true;
        for (VDS host : hosts) {
            if (!host.getClusterId().equals(hostClusterIdMap.get(host.getId()))) {
                succeeded = false;
            }
        }
        if (!succeeded) {
            getWindow().stopProgress();
            cancel();
            errorPopupManager.show(ConstantsManager.getInstance().getConstants().hostChangeClusterTimeOut());
        } else {
            activateHostsAfterClusterChange(searchStr, activateVdsParameterList);
        }
    }));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) QueryType(org.ovirt.engine.core.common.queries.QueryType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) MoveHostData(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHostData) Guid(org.ovirt.engine.core.compat.Guid) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HashMap(java.util.HashMap) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) MoveHost(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHost) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) ErrorPopupManager(org.ovirt.engine.ui.uicommonweb.ErrorPopupManager) TypeResolver(org.ovirt.engine.ui.uicommonweb.TypeResolver) Map(java.util.Map) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VDS(org.ovirt.engine.core.common.businessentities.VDS) ObservableCollection(org.ovirt.engine.ui.uicompat.ObservableCollection) Timer(com.google.gwt.user.client.Timer) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VDS(org.ovirt.engine.core.common.businessentities.VDS) HashMap(java.util.HashMap) List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 12 with SearchParameters

use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.

the class SessionListModel method syncSearch.

@Override
protected void syncSearch() {
    SearchParameters searchParameters = new SearchParameters(applySortOptions(getSearchString()), SearchType.Session, isCaseSensitiveSearch());
    searchParameters.setMaxCount(getSearchPageSize());
    super.syncSearch(QueryType.Search, searchParameters);
}
Also used : SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters)

Example 13 with SearchParameters

use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.

the class VmListModel method syncSearch.

@Override
protected void syncSearch() {
    SearchParameters tempVar = new SearchParameters(applySortOptions(getModifiedSearchString()), SearchType.VM, isCaseSensitiveSearch());
    tempVar.setMaxCount(getSearchPageSize());
    super.syncSearch(QueryType.Search, tempVar);
}
Also used : SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters)

Example 14 with SearchParameters

use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.

the class AbstractBackendCollectionResource method getSearchParameters.

private SearchParameters getSearchParameters(SearchType searchType, String constraint) {
    SearchParameters searchParams = new SearchParameters(constraint, searchType);
    boolean caseSensitive = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, CASE_SENSITIVE_CONSTRAINT_PARAMETER, true, false);
    int from = ParametersHelper.getIntegerParameter(httpHeaders, uriInfo, FROM_CONSTRAINT_PARAMETER, -1, -1);
    int max = ParametersHelper.getIntegerParameter(httpHeaders, uriInfo, MAX, Integer.MAX_VALUE, Integer.MAX_VALUE);
    searchParams.setCaseSensitive(caseSensitive);
    if (from != -1) {
        searchParams.setSearchFrom(from);
    }
    searchParams.setMaxCount(max);
    return searchParams;
}
Also used : SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters)

Example 15 with SearchParameters

use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.

the class AsyncDataProvider method getHostListByStatus.

public void getHostListByStatus(AsyncQuery<List<VDS>> aQuery, VDSStatus status, boolean doRefresh) {
    aQuery.converterCallback = new ListConverter<>();
    SearchParameters searchParameters = // $NON-NLS-1$ //$NON-NLS-2$
    new SearchParameters("Host: " + (status == null ? "" : ("status=" + status.name())), SearchType.VDS);
    searchParameters.setMaxCount(9999);
    Frontend.getInstance().runQuery(QueryType.Search, doRefresh ? searchParameters : searchParameters.withoutRefresh(), aQuery);
}
Also used : SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters)

Aggregations

SearchParameters (org.ovirt.engine.core.common.queries.SearchParameters)58 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)19 Test (org.junit.Test)17 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)17 ArrayList (java.util.ArrayList)15 QueryType (org.ovirt.engine.core.common.queries.QueryType)12 StatusCodeException (com.google.gwt.user.client.rpc.StatusCodeException)9 SearchType (org.ovirt.engine.core.common.interfaces.SearchType)7 Frontend (org.ovirt.engine.ui.frontend.Frontend)7 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)7 List (java.util.List)6 Guid (org.ovirt.engine.core.compat.Guid)6 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)6 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)5 UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)5 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)4 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)4 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)4 EnumTranslator (org.ovirt.engine.ui.uicompat.EnumTranslator)4