Search in sources :

Example 1 with GetImagesListParameters

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

the class BackendOpenStackImagesResource method list.

@Override
public OpenStackImages list() {
    Guid storageDomainId = BackendOpenStackStorageProviderHelper.getStorageDomainId(this, providerId);
    GetImagesListParameters parameters = new GetImagesListParameters(storageDomainId, ImageFileType.All);
    return mapCollection(getBackendCollection(QueryType.GetImagesList, parameters));
}
Also used : GetImagesListParameters(org.ovirt.engine.core.common.queries.GetImagesListParameters) Guid(org.ovirt.engine.core.compat.Guid)

Example 2 with GetImagesListParameters

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

the class BackendFilesResource method listFiles.

protected List<String> listFiles() {
    GetImagesListParameters queryParams = new GetImagesListParameters(asGuid(storageDomainId), ImageFileType.All);
    Boolean forceRefresh = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, FORCE_REFRESH, null, null);
    queryParams.setForceRefresh(forceRefresh);
    List<RepoImage> files = getBackendCollection(RepoImage.class, QueryType.GetImagesList, queryParams);
    return files.stream().map(RepoImage::getRepoImageId).collect(toList());
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) GetImagesListParameters(org.ovirt.engine.core.common.queries.GetImagesListParameters)

Example 3 with GetImagesListParameters

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

the class BackendStorageDomainImagesResource method list.

@Override
public Images list() {
    GetImagesListParameters getImagesListParams = new GetImagesListParameters(storageDomainId, ImageFileType.All);
    getImagesListParams.setForceRefresh(true);
    return mapCollection(getBackendCollection(QueryType.GetImagesList, getImagesListParams));
}
Also used : GetImagesListParameters(org.ovirt.engine.core.common.queries.GetImagesListParameters)

Example 4 with GetImagesListParameters

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

the class StorageIsoListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    super.syncSearch();
    StorageDomain storageDomain = getEntity();
    boolean isDomainActive = storageDomain.getStorageDomainSharedStatus() == StorageDomainSharedStatus.Active || storageDomain.getStorageDomainSharedStatus() == StorageDomainSharedStatus.Mixed;
    if (storageDomain.getStorageDomainType() == StorageDomainType.ISO && !isDomainActive) {
        setItems(Collections.emptyList());
        return;
    }
    GetImagesListParameters imagesListParams = new GetImagesListParameters(storageDomain.getId(), ImageFileType.All);
    imagesListParams.setForceRefresh(true);
    imagesListParams.setRefresh(getIsQueryFirstTime());
    startProgress();
    AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
        stopProgress();
        ArrayList<RepoImage> repoImageList = new ArrayList<>();
        if (returnValue != null && returnValue.getReturnValue() != null && returnValue.getSucceeded()) {
            repoImageList = returnValue.getReturnValue();
            repoImageList.sort(Comparator.comparing(RepoImage::getRepoImageId));
        }
        setItems(repoImageList);
        setIsEmpty(repoImageList.isEmpty());
    });
    asyncQuery.setHandleFailure(true);
    Frontend.getInstance().runQuery(QueryType.GetImagesList, imagesListParams, asyncQuery);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) GetImagesListParameters(org.ovirt.engine.core.common.queries.GetImagesListParameters) ArrayList(java.util.ArrayList)

Aggregations

GetImagesListParameters (org.ovirt.engine.core.common.queries.GetImagesListParameters)4 RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)2 ArrayList (java.util.ArrayList)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 Guid (org.ovirt.engine.core.compat.Guid)1