Search in sources :

Example 61 with QueryReturnValue

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

the class GwtDynamicHostPageServlet method runQuery.

/**
 * Executes a backend {@linkplain BackendLocal#runQuery query} and returns its result value if successful.
 * <p>
 * Returns {@code null} otherwise.
 */
protected Object runQuery(QueryType queryType, QueryParametersBase queryParams, String sessionId) {
    initQueryParams(queryParams, sessionId);
    QueryReturnValue result = backend.runQuery(queryType, queryParams);
    return result != null && result.getSucceeded() ? result.getReturnValue() : null;
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue)

Example 62 with QueryReturnValue

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

the class AsyncDataProvider method getDefaultConfigurationVersion.

private void getDefaultConfigurationVersion(final LoginModel loginModel) {
    AsyncQuery<QueryReturnValue> callback = new AsyncQuery<>(returnValue -> {
        if (returnValue != null) {
            _defaultConfigurationVersion = ((QueryReturnValue) returnValue).getReturnValue();
        } else {
            _defaultConfigurationVersion = GENERAL;
        }
        loginModel.getLoggedInEvent().raise(loginModel, EventArgs.EMPTY);
    });
    callback.setHandleFailure(true);
    Frontend.getInstance().runQuery(QueryType.GetDefaultConfigurationVersion, new QueryParametersBase(), callback);
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)

Example 63 with QueryReturnValue

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

the class HostSetupNetworksModel method queryFreeBonds.

private void queryFreeBonds() {
    // query for all unused, existing bonds on the host
    VDS vds = getEntity();
    Frontend.getInstance().runQuery(QueryType.GetVdsFreeBondsByVdsId, new IdQueryParameters(vds.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
        allBonds = returnValue.getReturnValue();
        queryTLVInformation();
        initNetworkModels();
        initNicModels();
        stopProgress();
    }));
}
Also used : SortedSet(java.util.SortedSet) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration) DataFromHostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.DataFromHostSetupNetworksModel) NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) OperationCandidateEventArgs(org.ovirt.engine.ui.uicommonweb.models.hosts.network.OperationCandidateEventArgs) SimpleAction(org.ovirt.engine.ui.uicommonweb.action.SimpleAction) Event(org.ovirt.engine.ui.uicompat.Event) AnonymousHostNetworkQos(org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) UiVdcAction(org.ovirt.engine.ui.uicommonweb.action.UiVdcAction) AllNetworksSelector(org.ovirt.engine.ui.uicommonweb.models.hosts.VfsConfigModel.AllNetworksSelector) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) AnonymousHostNetworkQos.fromHostNetworkQos(org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos.fromHostNetworkQos) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) NicLabel(org.ovirt.engine.core.common.businessentities.network.NicLabel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Set(java.util.Set) BusinessEntitiesDefinitions(org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions) Objects(java.util.Objects) LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo) List(java.util.List) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) NetworkCommand(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkCommand) Bond(org.ovirt.engine.core.common.businessentities.network.Bond) LogicalNetworkModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel) NetworkCommonUtils(org.ovirt.engine.core.common.utils.NetworkCommonUtils) EventDefinition(org.ovirt.engine.ui.uicompat.EventDefinition) HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) QueryType(org.ovirt.engine.core.common.queries.QueryType) HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) Guid(org.ovirt.engine.core.compat.Guid) UiAction(org.ovirt.engine.ui.uicommonweb.action.UiAction) NewNetworkLabelModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel.NewNetworkLabelModel) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) Entities(org.ovirt.engine.core.common.businessentities.Entities) HashMap(java.util.HashMap) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) NetworkOperation(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkOperation) LexoNumericComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator) Network(org.ovirt.engine.core.common.businessentities.network.Network) MapNetworkAttachments(org.ovirt.engine.core.common.utils.MapNetworkAttachments) FromNetworkAttachmentModel(org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor.FromNetworkAttachmentModel) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) Model(org.ovirt.engine.ui.uicommonweb.models.Model) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) NetworkItemModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkItemModel) Iterator(java.util.Iterator) NetworkOperationFactory(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkOperationFactory) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) LogicalNetworkModelParametersHelper(org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModelParametersHelper) NetworkLabelModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel) BaseCommandTarget(org.ovirt.engine.ui.uicommonweb.BaseCommandTarget) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS)

Example 64 with QueryReturnValue

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

the class HostSetupNetworksModel method queryInterfaces.

private void queryInterfaces() {
    VDS vds = getEntity();
    IdQueryParameters params = new IdQueryParameters(vds.getId());
    params.setRefresh(false);
    // query for interfaces
    Frontend.getInstance().runQuery(QueryType.GetVdsInterfacesByVdsId, params, new AsyncQuery<>((QueryReturnValue returnValue) -> {
        allExistingNics = returnValue.getReturnValue();
        existingVlanDevicesByVlanId = mapVlanDevicesByVlanId();
        initCreateOrUpdateBondParameters();
        initNicLabelsParameters();
        // chain the network attachments query
        queryNetworkAttachments();
    }));
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS)

Example 65 with QueryReturnValue

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

the class HostSetupNetworksModel method queryNetworkAttachments.

private void queryNetworkAttachments() {
    VDS vds = getEntity();
    IdQueryParameters params = new IdQueryParameters(vds.getId());
    params.setRefresh(false);
    // query for network attachments
    Frontend.getInstance().runQuery(QueryType.GetNetworkAttachmentsByHostId, params, new AsyncQuery<>((QueryReturnValue returnValue) -> {
        hostSetupNetworksParametersData.getNetworkAttachments().addAll((List<NetworkAttachment>) returnValue.getReturnValue());
        initNetworkIdToExistingAttachmentMap();
        // chain the vfsConfig query
        queryVfsConfig();
    }));
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) List(java.util.List) ArrayList(java.util.ArrayList)

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