Search in sources :

Example 1 with IdAndBooleanQueryParameters

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

the class StorageRegisterDiskImageListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        setItems(null);
        return;
    }
    IdQueryParameters parameters = new IdAndBooleanQueryParameters(getEntity().getId(), true);
    parameters.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetUnregisteredDisksFromDB, parameters, new AsyncQuery<QueryReturnValue>(returnValue -> {
        List<UnregisteredDisk> unregisteredDisks = returnValue.getReturnValue();
        Collections.sort(unregisteredDisks, Comparator.comparing(UnregisteredDisk::getDiskAlias));
        ArrayList<Disk> diskItems = new ArrayList<>();
        for (UnregisteredDisk unregisteredDisk : unregisteredDisks) {
            diskItems.add(unregisteredDisk.getDiskImage());
        }
        setItems(diskItems);
    }));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) UnregisteredDisk(org.ovirt.engine.core.common.businessentities.storage.UnregisteredDisk) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) Frontend(org.ovirt.engine.ui.frontend.Frontend) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) List(java.util.List) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) IdAndBooleanQueryParameters(org.ovirt.engine.core.common.queries.IdAndBooleanQueryParameters) Comparator(java.util.Comparator) Collections(java.util.Collections) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UnregisteredDisk(org.ovirt.engine.core.common.businessentities.storage.UnregisteredDisk) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) IdAndBooleanQueryParameters(org.ovirt.engine.core.common.queries.IdAndBooleanQueryParameters) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 List (java.util.List)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 UnregisteredDisk (org.ovirt.engine.core.common.businessentities.storage.UnregisteredDisk)1 IdAndBooleanQueryParameters (org.ovirt.engine.core.common.queries.IdAndBooleanQueryParameters)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 QueryType (org.ovirt.engine.core.common.queries.QueryType)1 Frontend (org.ovirt.engine.ui.frontend.Frontend)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)1 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)1 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)1 DiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel)1 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)1