org.keycloak.models.map.storage

## Class QueryParameters<M>

- java.lang.Object
- - org.keycloak.models.map.storage.QueryParameters<M>

- Type Parameters:
    `M` - Provide entity specific type checking, for example, when we create `QueryParameters` instance for Users, M is equal to UserModel, hence we are not able, for example, to order result by a `SearchableModelField` defined for clients in `ClientModel`.

      public class QueryParameters<M>
      extends Object

  Wraps together parameters for querying storage e.g. number of results to return, requested order or filtering criteria

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `QueryParameters.Order` Enum for ascending or descending ordering
    `static class` | `QueryParameters.OrderBy<M>` Wrapper class for a field with its `Order`, ascending or descending

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryParameters()`
    `QueryParameters(ModelCriteriaBuilder<M> mcb)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Integer` | `getLimit()`
    `ModelCriteriaBuilder<M>` | `getModelCriteriaBuilder()`
    `Integer` | `getOffset()`
    `List<QueryParameters.OrderBy<M>>` | `getOrderBy()`
    `QueryParameters<M>` | `limit(Integer limit)` Sets limit parameter
    `QueryParameters<M>` | `offset(Integer offset)` Sets offset parameter
    `QueryParameters<M>` | `orderBy(SearchableModelField<M> searchableModelField, QueryParameters.Order order)` Sets orderBy parameter; can be called repeatedly; fields are stored in a list where the first field has highest priority when determining order; e.g.
    `QueryParameters<M>` | `pagination(Integer offset, Integer limit, SearchableModelField<M> orderByAscField)` Sets pagination (offset, limit and orderBy) parameters to `QueryParameters`
    `static <M> QueryParameters<M>` | `withCriteria(ModelCriteriaBuilder<M> mcb)` Creates a new `QueryParameters` instance initialized with `ModelCriteriaBuilder`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### QueryParameters

          public QueryParameters()

    - #### QueryParameters

          public QueryParameters(ModelCriteriaBuilder<M> mcb)

  - ### Method Detail

    - #### withCriteria

          public static <M> QueryParameters<M> withCriteria(ModelCriteriaBuilder<M> mcb)

      Creates a new `QueryParameters` instance initialized with `ModelCriteriaBuilder`
      Type Parameters:
        `M` - model type
      Parameters:
        `mcb` - filtering criteria
      Returns:
        a new `QueryParameters` instance

    - #### pagination

          public QueryParameters<M> pagination(Integer offset,
                                               Integer limit,
                                               SearchableModelField<M> orderByAscField)

      Sets pagination (offset, limit and orderBy) parameters to `QueryParameters`
      Parameters:
        `offset` -
        `limit` -
        `orderByAscField` -
      Returns:
        this object

    - #### orderBy

          public QueryParameters<M> orderBy(SearchableModelField<M> searchableModelField,
                                            QueryParameters.Order order)

      Sets orderBy parameter; can be called repeatedly; fields are stored in a list where the first field has highest priority when determining order; e.g. the second field is compared only when values for the first field are equal
      Parameters:
        `searchableModelField` -
      Returns:
        this object

    - #### offset

          public QueryParameters<M> offset(Integer offset)

      Sets offset parameter
      Parameters:
        `offset` -
      Returns:

    - #### limit

          public QueryParameters<M> limit(Integer limit)

      Sets limit parameter
      Parameters:
        `limit` -
      Returns:

    - #### getOffset

          public Integer getOffset()

    - #### getLimit

          public Integer getLimit()

    - #### getModelCriteriaBuilder

          public ModelCriteriaBuilder<M> getModelCriteriaBuilder()

    - #### getOrderBy

          public List<QueryParameters.OrderBy<M>> getOrderBy()

Copyright © 2021 JBoss by Red Hat. All rights reserved.