Search in sources :

Example 26 with QueryReturnValue

use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.

the class VnicProfileModel method initCustomPropertySheet.

private void initCustomPropertySheet(Version dcCompatibilityVersion) {
    if (!customPropertiesVisible) {
        return;
    }
    GetDeviceCustomPropertiesParameters params = new GetDeviceCustomPropertiesParameters();
    params.setVersion(dcCompatibilityVersion);
    params.setDeviceType(VmDeviceGeneralType.INTERFACE);
    startProgress();
    Frontend.getInstance().runQuery(QueryType.GetDeviceCustomProperties, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
        if (returnValue != null) {
            Map<String, String> customPropertiesList = returnValue.getReturnValue();
            getCustomPropertySheet().setKeyValueMap(customPropertiesList);
            getCustomPropertySheet().setIsChangeable(!customPropertiesList.isEmpty());
            initCustomProperties();
        }
        stopProgress();
    }));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Arrays(java.util.Arrays) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) Guid(org.ovirt.engine.core.compat.Guid) GetDeviceCustomPropertiesParameters(org.ovirt.engine.core.common.queries.GetDeviceCustomPropertiesParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) VmDeviceGeneralType(org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) Network(org.ovirt.engine.core.common.businessentities.network.Network) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) NetworkFilter(org.ovirt.engine.core.common.businessentities.network.NetworkFilter) 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) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) BusinessEntitiesDefinitions(org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions) VersionQueryParameters(org.ovirt.engine.core.common.action.VersionQueryParameters) NetworkQoSModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkQoSModel) VnicProfileParameters(org.ovirt.engine.core.common.action.VnicProfileParameters) Objects(java.util.Objects) List(java.util.List) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) GetDeviceCustomPropertiesParameters(org.ovirt.engine.core.common.queries.GetDeviceCustomPropertiesParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Map(java.util.Map)

Example 27 with QueryReturnValue

use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.

the class VnicProfileTemplateListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    IdQueryParameters params = new IdQueryParameters(getEntity().getId());
    params.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetTemplatesByVnicProfileId, params, new AsyncQuery<QueryReturnValue>(returnValue -> setItems((Collection<VmTemplate>) returnValue.getReturnValue())));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Frontend(org.ovirt.engine.ui.frontend.Frontend) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 28 with QueryReturnValue

use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.

the class VnicProfileVmListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    IdQueryParameters params = new IdQueryParameters(getEntity().getId());
    params.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetVmsByVnicProfileId, params, new AsyncQuery<QueryReturnValue>(returnValue -> setItems((Collection<VM>) returnValue.getReturnValue())));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Frontend(org.ovirt.engine.ui.frontend.Frontend) VM(org.ovirt.engine.core.common.businessentities.VM) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VM(org.ovirt.engine.core.common.businessentities.VM)

Example 29 with QueryReturnValue

use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.

the class ImportSanStorageModel method getUnregisteredStorageDomains.

protected void getUnregisteredStorageDomains(List<StorageServerConnections> connections) {
    VDS vds = getContainer().getHost().getSelectedItem();
    Frontend.getInstance().runQuery(QueryType.GetUnregisteredBlockStorageDomains, new GetUnregisteredBlockStorageDomainsParameters(vds.getId(), getType(), connections), new AsyncQuery<QueryReturnValue>(returnValue -> {
        Pair<List<StorageDomain>, List<StorageServerConnections>> returnValuePair = returnValue.getReturnValue();
        ArrayList<StorageDomain> storageDomains = (ArrayList<StorageDomain>) returnValuePair.getFirst();
        ArrayList<StorageServerConnections> connections1 = (ArrayList<StorageServerConnections>) returnValuePair.getSecond();
        if (storageDomains != null) {
            addStorageDomains(storageDomains);
        }
        postGetUnregisteredStorageDomains(storageDomains, connections1);
    }));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) GetUnregisteredBlockStorageDomainsParameters(org.ovirt.engine.core.common.queries.GetUnregisteredBlockStorageDomainsParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VDS(org.ovirt.engine.core.common.businessentities.VDS) Pair(org.ovirt.engine.core.common.utils.Pair) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VDS(org.ovirt.engine.core.common.businessentities.VDS) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) GetUnregisteredBlockStorageDomainsParameters(org.ovirt.engine.core.common.queries.GetUnregisteredBlockStorageDomainsParameters) ArrayList(java.util.ArrayList) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 30 with QueryReturnValue

use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.

the class VmListModel method updateVM.

@Override
protected void updateVM(final UnitVmModel model) {
    final VM selectedItem = getSelectedItem();
    // explicitly pass non-editable field from the original VM
    getcurrentVm().setCreatedByUserId(selectedItem.getCreatedByUserId());
    getcurrentVm().setUseLatestVersion(model.getTemplateWithVersion().getSelectedItem().isLatest());
    if (selectedItem.isRunningOrPaused() && !selectedItem.isHostedEngine()) {
        AsyncDataProvider.getInstance().getVmChangedFieldsForNextRun(editedVm, getcurrentVm(), getUpdateVmParameters(false), new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {

            @Override
            public void onSuccess(QueryReturnValue returnValue) {
                List<String> changedFields = returnValue.getReturnValue();
                final boolean cpuHotPluggable = VmCommonUtils.isCpusToBeHotpluggedOrUnplugged(selectedItem, getcurrentVm());
                final boolean isHeadlessModeChanged = isHeadlessModeChanged(editedVm, getUpdateVmParameters(false));
                final boolean memoryHotPluggable = VmCommonUtils.isMemoryToBeHotplugged(selectedItem, getcurrentVm());
                final boolean minAllocatedMemoryChanged = selectedItem.getMinAllocatedMem() != getcurrentVm().getMinAllocatedMem();
                final boolean vmLeaseUpdated = VmCommonUtils.isVmLeaseToBeHotPluggedOrUnplugged(selectedItem, getcurrentVm());
                if (isHeadlessModeChanged) {
                    changedFields.add(constants.headlessMode());
                }
                // provide warnings if isVmUnpinned()
                if (!changedFields.isEmpty() || isVmUnpinned() || memoryHotPluggable || cpuHotPluggable || vmLeaseUpdated) {
                    VmNextRunConfigurationModel confirmModel = new VmNextRunConfigurationModel();
                    if (isVmUnpinned()) {
                        confirmModel.setVmUnpinned();
                    }
                    confirmModel.setTitle(ConstantsManager.getInstance().getConstants().editNextRunConfigurationTitle());
                    confirmModel.setHelpTag(HelpTag.edit_next_run_configuration);
                    // $NON-NLS-1$
                    confirmModel.setHashName("edit_next_run_configuration");
                    confirmModel.setChangedFields(changedFields);
                    confirmModel.setCpuPluggable(cpuHotPluggable);
                    confirmModel.setMemoryPluggable(memoryHotPluggable);
                    // it can be plugged only together with the memory, never alone
                    confirmModel.setMinAllocatedMemoryPluggable(memoryHotPluggable && minAllocatedMemoryChanged);
                    confirmModel.setVmLeaseUpdated(vmLeaseUpdated);
                    confirmModel.getCommands().add(// $NON-NLS-1$
                    new UICommand("updateExistingVm", VmListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
                    // $NON-NLS-1$
                    confirmModel.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation", VmListModel.this));
                    setConfirmWindow(confirmModel);
                } else {
                    updateExistingVm(false);
                }
            }

            private boolean isVmUnpinned() {
                if (selectedItem.isRunning()) {
                    if (selectedItem.getMigrationSupport() == MigrationSupport.PINNED_TO_HOST && getcurrentVm().getMigrationSupport() != MigrationSupport.PINNED_TO_HOST) {
                        return true;
                    }
                }
                return false;
            }
        }));
    } else {
        updateExistingVm(false);
    }
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VM(org.ovirt.engine.core.common.businessentities.VM) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)265 ArrayList (java.util.ArrayList)123 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)97 QueryType (org.ovirt.engine.core.common.queries.QueryType)85 List (java.util.List)74 Guid (org.ovirt.engine.core.compat.Guid)66 Frontend (org.ovirt.engine.ui.frontend.Frontend)64 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)54 VM (org.ovirt.engine.core.common.businessentities.VM)49 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)47 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)42 HashMap (java.util.HashMap)40 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)39 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 Test (org.junit.Test)38 Collection (java.util.Collection)34 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)33 Map (java.util.Map)31 ActionType (org.ovirt.engine.core.common.action.ActionType)31 VDS (org.ovirt.engine.core.common.businessentities.VDS)31