use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class RemoveQosModel method setMessage.
private void setMessage() {
ArrayList<QueryParametersBase> parameters = new ArrayList<>();
ArrayList<QueryType> queryTypes = new ArrayList<>();
for (T qos : sourceListModel.getSelectedItems()) {
QueryParametersBase parameter = new IdQueryParameters(qos.getId());
parameters.add(parameter);
queryTypes.add(getUsingEntitiesByQosIdQueryType());
}
Frontend.getInstance().runMultipleQueries(queryTypes, parameters, result -> handleSetMessageQueryResult(result));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class DiskStorageListModel method syncSearch.
@Override
protected void syncSearch() {
DiskImage diskImage = getEntity();
if (diskImage == null) {
return;
}
IdQueryParameters getStorageDomainsByImageIdParameters = new IdQueryParameters(diskImage.getImageId());
getStorageDomainsByImageIdParameters.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByImageId, getStorageDomainsByImageIdParameters, new SetItemsAsyncQuery());
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class RemoveNetworkQoSModel method setMessage.
private void setMessage() {
ArrayList<QueryParametersBase> parameters = new ArrayList<>();
ArrayList<QueryType> queryTypes = new ArrayList<>();
for (Object networkQoS : sourceListModel.getSelectedItems()) {
QueryParametersBase parameter = new IdQueryParameters(((NetworkQoS) networkQoS).getId());
parameters.add(parameter);
queryTypes.add(QueryType.GetVnicProfilesByNetworkQosId);
}
Frontend.getInstance().runMultipleQueries(queryTypes, parameters, result -> {
ArrayList<VnicProfileView> vnicProfiles = new ArrayList<>();
setHelpTag(HelpTag.remove_network_qos);
// $NON-NLS-1$
setHashName("remove_network_qos");
for (QueryReturnValue returnValue : result.getReturnValues()) {
vnicProfiles.addAll((ArrayList<VnicProfileView>) returnValue.getReturnValue());
}
if (vnicProfiles.isEmpty()) {
ArrayList<String> list = new ArrayList<>();
for (Object item : sourceListModel.getSelectedItems()) {
NetworkQoS i = (NetworkQoS) item;
list.add(i.getName());
}
setItems(list);
} else {
setMessage(ConstantsManager.getInstance().getMessages().removeNetworkQoSMessage(vnicProfiles.size()));
ArrayList<String> list = new ArrayList<>();
for (VnicProfileView item : vnicProfiles) {
list.add(item.getName());
}
setItems(list);
}
});
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderModel method initQuotaForStorageDomains.
private void initQuotaForStorageDomains() {
List<QueryType> queryTypeList = new ArrayList<>();
List<QueryParametersBase> queryParamsList = new ArrayList<>();
for (StorageDomain storage : getStorage().getItems()) {
queryTypeList.add(QueryType.GetAllRelevantQuotasForStorage);
queryParamsList.add(new IdQueryParameters(storage.getId()));
}
storageQuotaMap = new HashMap<>();
Frontend.getInstance().runMultipleQueries(queryTypeList, queryParamsList, result -> {
Iterator<QueryReturnValue> returnValuesIter = result.getReturnValues().iterator();
Iterator<StorageDomain> domainsIter = getStorage().getItems().iterator();
boolean noQuota = true;
while (domainsIter.hasNext()) {
ArrayList<Quota> quotaList = returnValuesIter.next().getReturnValue();
noQuota = noQuota && quotaList.isEmpty();
storageQuotaMap.put(domainsIter.next().getId(), quotaList);
}
if (noQuota && QuotaEnforcementTypeEnum.HARD_ENFORCEMENT.equals(storagePool.getQuotaEnforcementType())) {
showCloseMessage(ConstantsManager.getInstance().getConstants().missingQuotaStorageEnforceMode());
}
initDisksStorageDomainsList();
});
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class ImportVmsModel method initDataCenters.
private void initDataCenters() {
getDataCenters().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
clearVms();
exportDomain.setEntity(null);
loadProviders();
StoragePool dataCenter = dataCenters.getSelectedItem();
Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByStoragePoolId, new IdQueryParameters(dataCenter.getId()), new AsyncQuery<>(createGetStorageDomainsByStoragePoolIdCallback()));
});
dataCenters.getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() {
@Override
public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
AsyncDataProvider.getInstance().getHostListByDataCenter(new AsyncQuery<>(hosts -> {
List<VDS> upHosts = filterUpHosts(hosts);
proxyHosts.setItems(addAnyHostInCluster(upHosts));
xenProxyHosts.setItems(addAnyHostInCluster(upHosts));
kvmProxyHosts.setItems(addAnyHostInCluster(upHosts));
ImportVmsModel.this.hosts.setItems(upHosts);
stopProgress();
}), dataCenters.getSelectedItem().getId());
}
private List<VDS> filterUpHosts(List<VDS> hosts) {
List<VDS> result = new ArrayList<>();
for (VDS host : hosts) {
if (host.getStatus() == VDSStatus.Up) {
result.add(host);
}
}
return result;
}
private List<VDS> addAnyHostInCluster(List<VDS> hosts) {
List<VDS> result = new ArrayList<>(hosts);
// Any host in the cluster
result.add(0, null);
return result;
}
});
AsyncDataProvider.getInstance().getDataCenterList(new AsyncQuery<>(returnValue -> {
List<StoragePool> dataCenters = new ArrayList<>();
for (StoragePool a : returnValue) {
if (a.getStatus() == StoragePoolStatus.Up) {
dataCenters.add(a);
}
}
if (dataCenters.isEmpty()) {
getDataCenters().setIsChangeable(false);
getImportSources().setIsChangeable(false);
setError(constants.notAvailableWithNoUpDC());
stopProgress();
return;
}
Collections.sort(dataCenters, new NameableComparator());
ImportVmsModel.this.dataCenters.setItems(dataCenters);
}));
}
Aggregations