use of org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters in project ovirt-engine by oVirt.
the class ImportVmFromExportDomainModel method getTemplatesFromExportDomain.
protected void getTemplatesFromExportDomain() {
GetAllFromExportDomainQueryParameters tempVar = new GetAllFromExportDomainQueryParameters(storagePool.getId(), (Guid) getEntity());
Frontend.getInstance().runQuery(QueryType.GetTemplatesFromExportDomain, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
Map<VmTemplate, List<DiskImage>> dictionary = (HashMap<VmTemplate, List<DiskImage>>) returnValue.getReturnValue();
Map<Guid, Guid> tempMap = new HashMap<>();
for (Entry<VmTemplate, List<DiskImage>> entry : dictionary.entrySet()) {
tempMap.put(entry.getKey().getId(), null);
}
for (Entry<Guid, List<Disk>> missingTemplateEntry : missingTemplateDiskMap.entrySet()) {
if (tempMap.containsKey(missingTemplateEntry.getKey())) {
for (Disk disk : missingTemplateEntry.getValue()) {
addDiskImportData(disk.getId(), filteredStorageDomains, ((DiskImage) disk).getVolumeType(), new EntityModel(true));
}
} else {
showCloseMessage(ConstantsManager.getInstance().getConstants().errorTemplateCannotBeFoundMessage());
return;
}
}
ImportVmFromExportDomainModel.this.setMessage(ConstantsManager.getInstance().getConstants().importMissingStorages());
for (ImportVmData vmData : (List<ImportVmData>) getItems()) {
if (!Guid.Empty.equals(vmData.getVm().getVmtGuid()) && missingTemplateDiskMap.containsKey(vmData.getVm().getVmtGuid())) {
vmData.setTemplateExistsInSetup(false);
}
}
postInitDisks();
}));
}
Aggregations