Search in sources :

Example 36 with IdQueryParameters

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

the class StorageDomainHelper method addAttachedDataCenterReferences.

/**
 * Adds to the given Storage Domain the references to the Data Centers it is attached to.
 *
 * @param resource the resource that will be used to run the required queries
 * @param model the model of the Storage Domain where the references will be added
 */
public static void addAttachedDataCenterReferences(BackendResource resource, StorageDomain model) {
    // Note that this implementation is far from efficient, as we are retrieving all the content of the Storage
    // Domains and immediately discarding everything but the identifiers of the Data Centers. It would be better to
    // have a query that returns only the identifiers.
    Guid id = Guid.createGuidFromString(model.getId());
    QueryReturnValue result = resource.runQuery(QueryType.GetStorageDomainListById, new IdQueryParameters(id));
    if (result != null && result.getSucceeded()) {
        List<org.ovirt.engine.core.common.businessentities.StorageDomain> storageDomains = result.getReturnValue();
        if (CollectionUtils.isNotEmpty(storageDomains)) {
            DataCenters dataCenters = new DataCenters();
            for (org.ovirt.engine.core.common.businessentities.StorageDomain storageDomain : storageDomains) {
                DataCenter dataCenter = new DataCenter();
                dataCenter.setId(storageDomain.getStoragePoolId().toString());
                dataCenters.getDataCenters().add(dataCenter);
            }
            model.setDataCenters(dataCenters);
        }
    }
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StorageDomain(org.ovirt.engine.api.model.StorageDomain) DataCenters(org.ovirt.engine.api.model.DataCenters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) DataCenter(org.ovirt.engine.api.model.DataCenter)

Example 37 with IdQueryParameters

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

the class AsyncDataProvider method getRoleActionGroupsByRoleId.

public void getRoleActionGroupsByRoleId(AsyncQuery<List<ActionGroup>> aQuery, Guid roleId) {
    aQuery.converterCallback = new ListConverter<>();
    Frontend.getInstance().runQuery(QueryType.GetRoleActionGroupsByRoleId, new IdQueryParameters(roleId), aQuery);
}
Also used : StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Example 38 with IdQueryParameters

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

the class AsyncDataProvider method getAllNetworkQos.

public void getAllNetworkQos(Guid dcId, AsyncQuery<List<NetworkQoS>> query) {
    query.converterCallback = new ListConverter<NetworkQoS>() {

        @Override
        public List<NetworkQoS> convert(List<NetworkQoS> returnValue) {
            List<NetworkQoS> qosList = super.convert(returnValue);
            qosList.add(0, NetworkQoSModel.EMPTY_QOS);
            return qosList;
        }
    };
    Frontend.getInstance().runQuery(QueryType.GetAllNetworkQosByStoragePoolId, new IdQueryParameters(dcId), query);
}
Also used : StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) ArrayList(java.util.ArrayList) List(java.util.List)

Example 39 with IdQueryParameters

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

the class AsyncDataProvider method getVmsPinnedToHost.

public void getVmsPinnedToHost(AsyncQuery<List<VM>> aQuery, Guid id) {
    aQuery.converterCallback = new ListConverter<>();
    Frontend.getInstance().runQuery(QueryType.GetVmsPinnedToHost, new IdQueryParameters(id), aQuery);
}
Also used : StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Example 40 with IdQueryParameters

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

the class AsyncDataProvider method getHostListByClusterId.

public void getHostListByClusterId(AsyncQuery<List<VDS>> aQuery, Guid clusterId) {
    aQuery.converterCallback = new ListConverter<>();
    Frontend.getInstance().runQuery(QueryType.GetHostsByClusterId, new IdQueryParameters(clusterId), aQuery);
}
Also used : StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Aggregations

IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)268 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)89 Guid (org.ovirt.engine.core.compat.Guid)80 ArrayList (java.util.ArrayList)68 StorageDomainsAndStoragePoolIdQueryParameters (org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters)62 QueryType (org.ovirt.engine.core.common.queries.QueryType)59 List (java.util.List)47 Frontend (org.ovirt.engine.ui.frontend.Frontend)45 VM (org.ovirt.engine.core.common.businessentities.VM)42 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)36 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)35 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)26 Collection (java.util.Collection)25 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)25 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)25 Test (org.junit.Test)24 VDS (org.ovirt.engine.core.common.businessentities.VDS)24 HashMap (java.util.HashMap)22 ActionType (org.ovirt.engine.core.common.action.ActionType)21 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)19