Search in sources :

Example 56 with QueryParametersBase

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

the class AsyncDataProvider method updateVDSInterfaceList.

public void updateVDSInterfaceList(List<VDS> vdsList, Runnable callback) {
    if (vdsList != null && !vdsList.isEmpty()) {
        List<QueryType> types = new ArrayList<>();
        List<QueryParametersBase> ids = new ArrayList<>();
        vdsList.stream().forEach(vds -> {
            types.add(QueryType.GetVdsInterfacesByVdsId);
            ids.add(new IdQueryParameters(vds.getId()));
        });
        Frontend.getInstance().runMultipleQueries(types, ids, result -> {
            List<QueryReturnValue> values = result.getReturnValues();
            for (int i = 0; i < vdsList.size(); i++) {
                QueryReturnValue interfaceQueryValue = values.get(i);
                if (interfaceQueryValue.getReturnValue() != null) {
                    vdsList.get(i).getInterfaces().addAll(interfaceQueryValue.getReturnValue());
                }
            }
            callback.run();
        });
    } else {
        callback.run();
    }
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase) QueryType(org.ovirt.engine.core.common.queries.QueryType)

Example 57 with QueryParametersBase

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

the class AsyncDataProvider method getAuthzExtensionsNames.

public void getAuthzExtensionsNames(AsyncQuery<List<String>> aQuery) {
    aQuery.converterCallback = new ListConverter<>();
    Frontend.getInstance().runQuery(QueryType.GetDomainList, new QueryParametersBase(), aQuery);
}
Also used : QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)

Example 58 with QueryParametersBase

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

the class AsyncDataProvider method countAllTemplates.

public void countAllTemplates(AsyncQuery<Integer> aQuery) {
    aQuery.converterCallback = new CastingConverter<>();
    Frontend.getInstance().runQuery(QueryType.GetVmTemplateCount, new QueryParametersBase(), aQuery);
}
Also used : QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)

Example 59 with QueryParametersBase

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

the class AsyncDataProvider method getAllVmTemplates.

public void getAllVmTemplates(AsyncQuery<List<VmTemplate>> aQuery, final boolean refresh) {
    aQuery.converterCallback = new TemplateConverter();
    QueryParametersBase params = new QueryParametersBase();
    params.setRefresh(refresh);
    Frontend.getInstance().runQuery(QueryType.GetAllVmTemplates, params, aQuery);
}
Also used : QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)

Example 60 with QueryParametersBase

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

the class InstanceTypeManager method updateAll.

/**
 * First updates the list of instance types and selects the one which is supposed to be selected and then
 * updates all the fields which are taken from the instance type (by calling the updateFields()).
 */
public void updateAll() {
    final Guid selectedInstanceTypeId = getSelectedInstanceTypeId();
    Frontend.getInstance().runQuery(QueryType.GetAllInstanceTypes, new QueryParametersBase(), new AsyncQuery<QueryReturnValue>(returnValue -> {
        if (returnValue == null || !returnValue.getSucceeded()) {
            return;
        }
        List<InstanceType> instanceTypes = new ArrayList<>();
        // add this only if the user is allowed to
        if (!getModel().isCreateInstanceOnly()) {
            instanceTypes.add(CustomInstanceType.INSTANCE);
        }
        for (InstanceType instanceType : (Iterable<InstanceType>) returnValue.getReturnValue()) {
            instanceTypes.add(instanceType);
        }
        getModel().getInstanceTypes().setItems(instanceTypes);
        for (InstanceType instanceType : instanceTypes) {
            if ((instanceType instanceof CustomInstanceType) && selectedInstanceTypeId == null) {
                getModel().getInstanceTypes().setSelectedItem(CustomInstanceType.INSTANCE);
                break;
            }
            if (instanceType.getId() == null || selectedInstanceTypeId == null) {
                continue;
            }
            if (instanceType.getId().equals(selectedInstanceTypeId)) {
                getModel().getInstanceTypes().setSelectedItem(instanceType);
                break;
            }
        }
        if (getModel().getInstanceTypes().getSelectedItem() instanceof CustomInstanceType) {
            // detach if the instance type is "custom"
            getModel().getAttachedToInstanceType().setEntity(false);
        }
        updateFields();
    }));
}
Also used : VmDeviceType(org.ovirt.engine.core.common.utils.VmDeviceType) QueryType(org.ovirt.engine.core.common.queries.QueryType) Guid(org.ovirt.engine.core.compat.Guid) InstanceType(org.ovirt.engine.core.common.businessentities.InstanceType) PriorityUtil(org.ovirt.engine.ui.uicommonweb.models.vms.PriorityUtil) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) CustomInstanceType(org.ovirt.engine.ui.uicommonweb.models.vms.CustomInstanceType) Event(org.ovirt.engine.ui.uicompat.Event) VmEntityType(org.ovirt.engine.core.common.businessentities.VmEntityType) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) VmDeviceGeneralType(org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) VmWatchdogType(org.ovirt.engine.core.common.businessentities.VmWatchdogType) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) VmDeviceCommonUtils(org.ovirt.engine.core.common.utils.VmDeviceCommonUtils) VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) VmBase(org.ovirt.engine.core.common.businessentities.VmBase) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) List(java.util.List) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) VirtioScsiUtil(org.ovirt.engine.ui.uicommonweb.models.vms.VirtioScsiUtil) MigrationSupport(org.ovirt.engine.core.common.businessentities.MigrationSupport) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) ArrayList(java.util.ArrayList) List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) CustomInstanceType(org.ovirt.engine.ui.uicommonweb.models.vms.CustomInstanceType) InstanceType(org.ovirt.engine.core.common.businessentities.InstanceType) CustomInstanceType(org.ovirt.engine.ui.uicommonweb.models.vms.CustomInstanceType)

Aggregations

QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)89 ArrayList (java.util.ArrayList)41 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)40 QueryType (org.ovirt.engine.core.common.queries.QueryType)37 Test (org.junit.Test)33 StorageServerConnectionQueryParametersBase (org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)22 SearchParameters (org.ovirt.engine.core.common.queries.SearchParameters)18 List (java.util.List)15 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)15 Guid (org.ovirt.engine.core.compat.Guid)13 HashMap (java.util.HashMap)11 StatusCodeException (com.google.gwt.user.client.rpc.StatusCodeException)9 HashSet (java.util.HashSet)7 Map (java.util.Map)6 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)6 Frontend (org.ovirt.engine.ui.frontend.Frontend)6 Collection (java.util.Collection)5 Quota (org.ovirt.engine.core.common.businessentities.Quota)5 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)5 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5