use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class NetworkHostListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
final NetworkHostFilter filter = getViewFilterType();
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
if (filter.equals(getViewFilterType())) {
final Iterable returnList = returnValue.getReturnValue();
if (NetworkHostFilter.unattached.equals(getViewFilterType())) {
final List<PairQueryable<VdsNetworkInterface, VDS>> items = new ArrayList<>();
for (Object obj : returnList) {
items.add(new PairQueryable<VdsNetworkInterface, VDS>(null, (VDS) obj));
}
setItems(items);
} else if (NetworkHostFilter.attached.equals(getViewFilterType())) {
initAttachedInterfaces((Collection<PairQueryable<VdsNetworkInterface, VDS>>) returnList);
}
}
});
IdQueryParameters params = new IdQueryParameters(getEntity().getId());
params.setRefresh(getIsQueryFirstTime());
if (NetworkHostFilter.unattached.equals(getViewFilterType())) {
Frontend.getInstance().runQuery(QueryType.GetVdsWithoutNetwork, params, asyncQuery);
} else if (NetworkHostFilter.attached.equals(getViewFilterType())) {
Frontend.getInstance().runQuery(QueryType.GetVdsAndNetworkInterfacesByNetworkId, params, asyncQuery);
}
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class StorageLeaseListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
setItems(null);
return;
}
super.syncSearch();
StorageDomain storageDomain = getEntity();
Frontend.getInstance().runQuery(QueryType.GetEntitiesWithLeaseByStorageId, new IdQueryParameters(storageDomain.getId()), new SetItemsAsyncQuery());
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
super.syncSearch();
IdQueryParameters tempVar = new IdQueryParameters(getEntity().getId());
tempVar.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetStorageDomainListById, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<StorageDomain> domains = returnValue.getReturnValue();
for (StorageDomain domain : domains) {
domain.setId(domain.getStoragePoolId());
}
Collections.sort(domains, Comparator.comparing(StorageDomain::getStoragePoolName, new LexoNumericComparator()));
setItems(domains);
setIsEmpty(getItems().size() == 0);
}));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class AbstractDiskModel method updateDiskProfiles.
private void updateDiskProfiles(StoragePool selectedItem) {
StorageDomain storageDomain = getStorageDomain().getSelectedItem();
if (storageDomain == null) {
return;
}
Frontend.getInstance().runQuery(QueryType.GetDiskProfilesByStorageDomainId, new IdQueryParameters(storageDomain.getId()), new AsyncQuery<QueryReturnValue>(value -> setDiskProfilesList((List<DiskProfile>) value.getReturnValue())));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class UserPermissionListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
IdQueryParameters mlaParams = new IdQueryParameters(getEntity().getId());
mlaParams.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetPermissionsOnBehalfByAdElementId, mlaParams, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> {
ArrayList<Permission> list = returnValue.getReturnValue();
ArrayList<Permission> newList = new ArrayList<>();
for (Permission permission : list) {
if (!permission.getRoleId().equals(ApplicationGuids.quotaConsumer.asGuid())) {
newList.add(permission);
}
}
setItems(newList);
}));
setIsQueryFirstTime(false);
}
Aggregations