Search in sources :

Example 11 with GetAllFromExportDomainQueryParameters

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();
    }));
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Guid(org.ovirt.engine.core.compat.Guid) Inject(com.google.inject.Inject) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HashMap(java.util.HashMap) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) HashSet(java.util.HashSet) ActionType(org.ovirt.engine.core.common.action.ActionType) CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) Frontend(org.ovirt.engine.ui.frontend.Frontend) QuotaListModel(org.ovirt.engine.ui.uicommonweb.models.quota.QuotaListModel) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Set(java.util.Set) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) Quota(org.ovirt.engine.core.common.businessentities.Quota) ImportVmParameters(org.ovirt.engine.core.common.action.ImportVmParameters) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Entry(java.util.Map.Entry) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Entry(java.util.Map.Entry) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters)

Aggregations

GetAllFromExportDomainQueryParameters (org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters)11 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)8 ArrayList (java.util.ArrayList)7 List (java.util.List)6 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)6 Guid (org.ovirt.engine.core.compat.Guid)5 HashMap (java.util.HashMap)4 Map (java.util.Map)4 VM (org.ovirt.engine.core.common.businessentities.VM)4 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)3 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 Inject (com.google.inject.Inject)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 StorageDomainValidator (org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 ArchitectureType (org.ovirt.engine.core.common.businessentities.ArchitectureType)2