Search in sources :

Example 1 with IdQueryParameters

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

the class ClusterListModel method checkForNonResponsiveHosts.

/**
 * Checks if in selected cluster are some non responsive hosts. If so, it adds warning about upgrading cluster level
 * when some hosts are non responsive
 */
@SuppressWarnings("unchecked")
private void checkForNonResponsiveHosts(final ConfirmationModel confirmModel) {
    startProgress();
    Frontend.getInstance().runQuery(QueryType.GetHostsByClusterId, new IdQueryParameters(getSelectedItem().getId()), new AsyncQuery<>(returnValue -> {
        List<VDS> hosts = null;
        if (returnValue instanceof List) {
            hosts = (List<VDS>) returnValue;
        } else if (returnValue instanceof QueryReturnValue && ((QueryReturnValue) returnValue).getReturnValue() instanceof List) {
            hosts = ((QueryReturnValue) returnValue).getReturnValue();
        }
        boolean foundNRHosts = false;
        if (hosts != null) {
            for (VDS host : hosts) {
                if (VDSStatus.NonResponsive == host.getStatus()) {
                    foundNRHosts = true;
                    break;
                }
            }
        }
        String existingMsg = confirmModel.getMessage() == null ? "" : confirmModel.getMessage();
        if (foundNRHosts) {
            confirmModel.setMessage(existingMsg + constants.youAreAboutChangeClusterCompatibilityVersionNonResponsiveHostsMsg());
        } else {
            confirmModel.setMessage(existingMsg + constants.youAreAboutChangeClusterCompatibilityVersionMsg());
        }
        stopProgress();
    }));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) MultipleHostsModel(org.ovirt.engine.ui.uicommonweb.models.hosts.MultipleHostsModel) ClusterParametersBase(org.ovirt.engine.core.common.action.ClusterParametersBase) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) MigrationBandwidthLimitType(org.ovirt.engine.core.common.businessentities.MigrationBandwidthLimitType) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) SharedMacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel) OptimizationType(org.ovirt.engine.core.common.scheduling.OptimizationType) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) CpuProfileListModel(org.ovirt.engine.ui.uicommonweb.models.profiles.CpuProfileListModel) QueryType(org.ovirt.engine.core.common.queries.QueryType) NewSharedMacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.NewSharedMacPoolModel) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) Frontend(org.ovirt.engine.ui.frontend.Frontend) Network(org.ovirt.engine.core.common.businessentities.network.Network) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) ClusterAffinityLabelListModel(org.ovirt.engine.ui.uicommonweb.models.configure.labels.list.ClusterAffinityLabelListModel) ClusterAffinityGroupListModel(org.ovirt.engine.ui.uicommonweb.models.configure.scheduling.affinity_groups.list.ClusterAffinityGroupListModel) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) MacPool(org.ovirt.engine.core.common.businessentities.MacPool) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) 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) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with IdQueryParameters

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

the class ClusterGeneralModel method updateConsoleAddressPartiallyOverridden.

private void updateConsoleAddressPartiallyOverridden(Cluster cluster) {
    AsyncQuery<QueryReturnValue> query = new AsyncQuery<>(returnValue -> {
        boolean isConsistent = returnValue.getReturnValue();
        setConsoleAddressPartiallyOverridden(!isConsistent);
    });
    Frontend.getInstance().runQuery(QueryType.IsDisplayAddressConsistentInCluster, new IdQueryParameters(cluster.getId()), query);
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Example 3 with IdQueryParameters

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

the class RoleListModel method eventRaised.

@Override
public void eventRaised(Event ev, Object sender, EventArgs args) {
    super.eventRaised(ev, sender, args);
    if (getWindow() != null && sender == ((RoleModel) getWindow()).getIsAdminRole()) {
        if (commandType == CommandType.New) {
            List<ActionGroup> selectedActionGroups = new ArrayList<>();
            selectedActionGroups.add(ActionGroup.LOGIN);
            setAttachedActionGroups(selectedActionGroups);
        } else {
            Role role = getSelectedItem();
            Frontend.getInstance().runQuery(QueryType.GetRoleActionGroupsByRoleId, new IdQueryParameters(role.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
                publicAttachedActions = returnValue.getReturnValue();
                setAttachedActionGroups(publicAttachedActions);
            }));
        }
    }
}
Also used : Role(org.ovirt.engine.core.common.businessentities.Role) QueryType(org.ovirt.engine.core.common.queries.QueryType) Inject(com.google.inject.Inject) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) Event(org.ovirt.engine.ui.uicompat.Event) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) SelectionTreeNodeModel(org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel) RoleWithActionGroupsParameters(org.ovirt.engine.core.common.action.RoleWithActionGroupsParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) ApplicationGuids(org.ovirt.engine.ui.uicommonweb.auth.ApplicationGuids) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) ActionGroupsToRoleParameter(org.ovirt.engine.core.common.action.ActionGroupsToRoleParameter) RolesOperationsParameters(org.ovirt.engine.core.common.action.RolesOperationsParameters) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) RoleType(org.ovirt.engine.core.common.businessentities.RoleType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) RolesParameterBase(org.ovirt.engine.core.common.action.RolesParameterBase) List(java.util.List) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) Role(org.ovirt.engine.core.common.businessentities.Role) Collections(java.util.Collections) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) ArrayList(java.util.ArrayList)

Example 4 with IdQueryParameters

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

the class NetworkTemplateListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    IdQueryParameters params = new IdQueryParameters(getEntity().getId());
    params.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetVmTemplatesAndNetworkInterfacesByNetworkId, params, new SetItemsAsyncQuery());
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Example 5 with IdQueryParameters

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

the class PoolDiskListModel method onEntityChanged.

@Override
protected void onEntityChanged() {
    super.onEntityChanged();
    VmPool pool = getEntity();
    if (pool != null) {
        Frontend.getInstance().runQuery(QueryType.GetVmDataByPoolId, new IdQueryParameters(pool.getVmPoolId()), new AsyncQuery<QueryReturnValue>(result -> {
            if (result != null) {
                VM vm = result.getReturnValue();
                if (vm == null) {
                    return;
                }
                setVM(vm);
                syncSearch();
            }
        }));
    }
}
Also used : VmPool(org.ovirt.engine.core.common.businessentities.VmPool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Frontend(org.ovirt.engine.ui.frontend.Frontend) VM(org.ovirt.engine.core.common.businessentities.VM) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) VmDiskListModelBase(org.ovirt.engine.ui.uicommonweb.models.vms.VmDiskListModelBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) VM(org.ovirt.engine.core.common.businessentities.VM)

Aggregations

IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)268 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)89 Guid (org.ovirt.engine.core.compat.Guid)80 ArrayList (java.util.ArrayList)68 StorageDomainsAndStoragePoolIdQueryParameters (org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters)62 QueryType (org.ovirt.engine.core.common.queries.QueryType)59 List (java.util.List)47 Frontend (org.ovirt.engine.ui.frontend.Frontend)45 VM (org.ovirt.engine.core.common.businessentities.VM)42 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)36 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)35 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)26 Collection (java.util.Collection)25 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)25 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)25 Test (org.junit.Test)24 VDS (org.ovirt.engine.core.common.businessentities.VDS)24 HashMap (java.util.HashMap)22 ActionType (org.ovirt.engine.core.common.action.ActionType)21 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)19