use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class SanStorageModelBase method discoverTargets.
private void discoverTargets() {
if (!validateDiscoverTargetFields()) {
return;
}
VDS host = getContainer().getHost().getSelectedItem();
StorageServerConnections tempVar = new StorageServerConnections();
tempVar.setConnection(getAddress().getEntity().trim());
tempVar.setPort(getPort().getEntity().trim());
tempVar.setStorageType(StorageType.ISCSI);
// $NON-NLS-1$
tempVar.setUserName(getUseUserAuth().getEntity() ? getUserName().getEntity() : "");
// $NON-NLS-1$
tempVar.setPassword(getUseUserAuth().getEntity() ? getPassword().getEntity() : "");
DiscoverSendTargetsQueryParameters parameters = new DiscoverSendTargetsQueryParameters(host.getId(), tempVar);
setMessage(null);
final SanStorageModelBase model = this;
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
Object result = returnValue.getReturnValue();
model.postDiscoverTargetsInternal(result != null ? (ArrayList<StorageServerConnections>) result : new ArrayList<>());
}, true);
Frontend.getInstance().runQuery(QueryType.DiscoverSendTargets, parameters, asyncQuery);
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue 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.QueryReturnValue 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.QueryReturnValue in project ovirt-engine by oVirt.
the class ImportTemplateModel method init.
public void init(final Collection<VmTemplate> externalTemplates, final Guid storageDomainId) {
Frontend.getInstance().runQuery(QueryType.Search, new SearchParameters(createSearchPattern(externalTemplates), SearchType.VmTemplate), new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {
@Override
public void onSuccess(QueryReturnValue returnValue) {
UIConstants constants = ConstantsManager.getInstance().getConstants();
List<VmTemplate> vmtList = returnValue.getReturnValue();
List<ImportTemplateData> templateDataList = new ArrayList<>();
for (VmTemplate template : externalTemplates) {
ImportTemplateData templateData = new ImportTemplateData(template);
boolean templateExistsInSystem = vmtList.contains(template);
templateData.setExistsInSystem(templateExistsInSystem);
if (templateExistsInSystem) {
templateData.enforceClone(constants.importTemplateThatExistsInSystemMustClone());
} else if (!template.isBaseTemplate() && findAnyVmTemplateById(vmtList, template.getBaseTemplateId()) == null) {
templateData.enforceClone(constants.importTemplateWithoutBaseMustClone());
}
templateDataList.add(templateData);
}
setItems(templateDataList);
withDataCenterLoaded(storageDomainId, r -> doInit());
}
private VmTemplate findAnyVmTemplateById(List<VmTemplate> vmtList, Guid templateId) {
for (VmTemplate vmt : vmtList) {
if (templateId.equals(vmt.getId())) {
return vmt;
}
}
return null;
}
}));
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue 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);
}));
}
Aggregations