Search in sources :

Example 1 with NameQueryParameters

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

the class BackendOpenStackVolumeProvidersResource method getStoragePoolIdByStorageDomainName.

private StoragePool getStoragePoolIdByStorageDomainName(String storageDomainName) {
    StorageDomainStatic storageDomain = getEntity(StorageDomainStatic.class, QueryType.GetStorageDomainByName, new NameQueryParameters(storageDomainName), "StorageDomain: name=" + storageDomainName);
    List<StoragePool> storagePools = getEntity(List.class, QueryType.GetStoragePoolsByStorageDomainId, new IdQueryParameters(storageDomain.getId()), "Datacenters");
    if (!storagePools.isEmpty()) {
        return storagePools.get(0);
    }
    // The storage domain is unattached
    return null;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters)

Example 2 with NameQueryParameters

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

the class BackendOpenStackVolumeProvidersResource method getStoragePool.

public StoragePool getStoragePool(DataCenter dataCenter) {
    StoragePool pool = null;
    if (dataCenter.isSetId()) {
        Guid id = asGuid(dataCenter.getId());
        pool = getEntity(StoragePool.class, QueryType.GetStoragePoolById, new IdQueryParameters(id), "Datacenter: id=" + dataCenter.getId());
    } else if (dataCenter.isSetName()) {
        pool = getEntity(StoragePool.class, QueryType.GetStoragePoolByDatacenterName, new NameQueryParameters(dataCenter.getName()), "Datacenter: name=" + dataCenter.getName());
    }
    if (pool == null) {
        notFound(DataCenter.class);
    }
    return pool;
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Guid(org.ovirt.engine.core.compat.Guid) NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters)

Example 3 with NameQueryParameters

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

the class AsyncDataProvider method isPoolNameUnique.

public void isPoolNameUnique(AsyncQuery<Boolean> aQuery, String name) {
    aQuery.converterCallback = source -> {
        if (source != null) {
            return !(Boolean) source;
        }
        return false;
    };
    Frontend.getInstance().runQuery(QueryType.IsVmPoolWithSameNameExists, new NameQueryParameters(name), aQuery);
}
Also used : NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters)

Example 4 with NameQueryParameters

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

the class AsyncDataProvider method isTemplateNameUnique.

public void isTemplateNameUnique(AsyncQuery<Boolean> aQuery, String templateName, Guid datacenterId) {
    aQuery.converterCallback = source -> source != null && !(Boolean) source;
    NameQueryParameters params = new NameQueryParameters(templateName);
    params.setDatacenterId(datacenterId);
    Frontend.getInstance().runQuery(QueryType.IsVmTemlateWithSameNameExist, params, aQuery);
}
Also used : NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters)

Example 5 with NameQueryParameters

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

the class AsyncDataProvider method getStorageDomainByName.

public void getStorageDomainByName(AsyncQuery<StorageDomainStatic> aQuery, String storageDomainName) {
    aQuery.converterCallback = new CastingConverter<>();
    Frontend.getInstance().runQuery(QueryType.GetStorageDomainByName, new NameQueryParameters(storageDomainName), aQuery);
}
Also used : NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters)

Aggregations

NameQueryParameters (org.ovirt.engine.core.common.queries.NameQueryParameters)11 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)4 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)3 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 Guid (org.ovirt.engine.core.compat.Guid)2 MalformedIdException (org.ovirt.engine.api.restapi.utils.MalformedIdException)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1