Search in sources :

Example 1 with GetAllProvidersParameters

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

the class AsyncDataProvider method getAllProvidersByType.

public void getAllProvidersByType(AsyncQuery<List<Provider<?>>> aQuery, ProviderType... providerTypes) {
    aQuery.converterCallback = new ListConverter<>();
    Frontend.getInstance().runQuery(QueryType.GetAllProviders, new GetAllProvidersParameters(providerTypes), aQuery);
}
Also used : GetAllProvidersParameters(org.ovirt.engine.core.common.queries.GetAllProvidersParameters)

Example 2 with GetAllProvidersParameters

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

the class BackendOpenStackNetworkProvidersResource method getBackendCollection.

private List<Provider> getBackendCollection() {
    if (isFiltered()) {
        return getBackendCollection(QueryType.GetAllProviders, new GetAllProvidersParameters(ProviderType.OPENSTACK_NETWORK, ProviderType.EXTERNAL_NETWORK));
    } else {
        List<Provider> openstackCollection = getBackendCollection(SearchType.Provider, getConstraint(ProviderType.OPENSTACK_NETWORK.name()));
        List<Provider> externalCollection = getBackendCollection(SearchType.Provider, getConstraint(ProviderType.EXTERNAL_NETWORK.name()));
        openstackCollection.addAll(externalCollection);
        return openstackCollection;
    }
}
Also used : GetAllProvidersParameters(org.ovirt.engine.core.common.queries.GetAllProvidersParameters) OpenStackNetworkProvider(org.ovirt.engine.api.model.OpenStackNetworkProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 3 with GetAllProvidersParameters

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

the class AsyncDataProvider method getAllProviders.

public void getAllProviders(AsyncQuery<List<Provider<?>>> aQuery, boolean doRefresh) {
    aQuery.converterCallback = new SortListByNameConverter<>();
    Frontend.getInstance().runQuery(QueryType.GetAllProviders, doRefresh ? new GetAllProvidersParameters() : new GetAllProvidersParameters().withoutRefresh(), aQuery);
}
Also used : GetAllProvidersParameters(org.ovirt.engine.core.common.queries.GetAllProvidersParameters)

Example 4 with GetAllProvidersParameters

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

the class AsyncDataProvider method getAllProvidersByProvidedEntity.

public void getAllProvidersByProvidedEntity(AsyncQuery<List<Provider<?>>> query, final VdcObjectType providedEntity) {
    query.converterCallback = returnValue -> {
        if (returnValue == null) {
            return new ArrayList<>();
        }
        return ((Collection<Provider<?>>) returnValue).stream().filter(p -> p.getType().getProvidedTypes().contains(providedEntity)).sorted(new NameableComparator()).collect(Collectors.toList());
    };
    Frontend.getInstance().runQuery(QueryType.GetAllProviders, new GetAllProvidersParameters(), query);
}
Also used : ArrayList(java.util.ArrayList) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) GetAllProvidersParameters(org.ovirt.engine.core.common.queries.GetAllProvidersParameters) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Aggregations

GetAllProvidersParameters (org.ovirt.engine.core.common.queries.GetAllProvidersParameters)4 Provider (org.ovirt.engine.core.common.businessentities.Provider)2 ArrayList (java.util.ArrayList)1 OpenStackNetworkProvider (org.ovirt.engine.api.model.OpenStackNetworkProvider)1 NameableComparator (org.ovirt.engine.core.common.businessentities.comparators.NameableComparator)1