use of org.ovirt.engine.core.common.queries.IdQueryParameters 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);
}));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class StorageRegisterDiskListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
IdQueryParameters parameters = new IdQueryParameters(getEntity().getId());
parameters.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetUnregisteredCinderDisksByStorageDomainId, parameters, new SetSortedItemsAsyncQuery(new DiskByDiskAliasComparator()));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class StorageRegisterEntityListModel method syncSearch.
protected void syncSearch(QueryType queryType, final Comparator<? super T> comparator) {
if (getEntity() == null) {
return;
}
IdQueryParameters parameters = new IdQueryParameters(getEntity().getId());
parameters.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(queryType, parameters, new SetSortedItemsAsyncQuery(comparator));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class StorageVmListModel 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.GetVmsByStorageDomain, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<VM> vms = returnValue.getReturnValue();
Collections.sort(vms, new LexoNumericNameableComparator<>());
setItems(vms);
setIsEmpty(vms.size() == 0);
}));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class DataCenterListModel method onSave.
public void onSave() {
final DataCenterModel dcModel = (DataCenterModel) getWindow();
if (!dcModel.validate()) {
return;
}
if ((dcModel.getIsNew() || dcModel.getEntity() == null) && dcModel.getQuotaEnforceTypeListModel().getSelectedItem() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
promptNoQuotaInDCMessage();
} else if (!dcModel.getIsNew() && getSelectedItem() != null && !dcModel.getVersion().getSelectedItem().equals(getSelectedItem().getCompatibilityVersion())) {
final ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().changeDataCenterCompatibilityVersionTitle());
confirmModel.setHelpTag(HelpTag.change_data_center_compatibility_version);
// $NON-NLS-1$
confirmModel.setHashName("change_data_center_compatibility_version");
final StoragePool sp = getSelectedItem();
startProgress();
IdQueryParameters params = new IdQueryParameters(sp.getId());
Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByStoragePoolId, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
List<StorageDomain> storages = returnValue.getReturnValue();
StorageDomain storage = null;
for (StorageDomain sd : storages) {
if (sd.getStorageDomainType().isDataDomain()) {
storage = sd;
}
}
StorageFormatType newFormat = null;
StorageFormatType oldFormat = null;
if (storage != null) {
newFormat = VersionStorageFormatUtil.getForVersion(dcModel.getVersion().getSelectedItem());
oldFormat = VersionStorageFormatUtil.getForVersion(sp.getCompatibilityVersion());
}
if (newFormat == oldFormat) {
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youAreAboutChangeDcCompatibilityVersionMsg());
} else {
Version v = VersionStorageFormatUtil.getEarliestVersionSupported(newFormat);
confirmModel.setMessage(ConstantsManager.getInstance().getMessages().youAreAboutChangeDcCompatibilityVersionWithUpgradeMsg(v.getValue()));
}
stopProgress();
}));
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSaveInternal", this);
confirmModel.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
confirmModel.getCommands().add(tempVar2);
} else if (getSelectedItem() != null && getSelectedItem().getQuotaEnforcementType() != QuotaEnforcementTypeEnum.HARD_ENFORCEMENT && dcModel.getQuotaEnforceTypeListModel().getSelectedItem() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
checkForQuotaInDC(dcModel.getEntity(), this);
} else if (dcModel.getIsNew()) {
// New data center, check for name uniqueness.
validateDataCenterName(dcModel);
} else {
onSaveInternal();
}
}
Aggregations