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
  • Constructor Details

    • QueryParameters

      public QueryParameters()
    • QueryParameters

      public QueryParameters(DefaultModelCriteria<M> mcb)
  • Method Details

    • withCriteria

      public static <M> QueryParameters<M> withCriteria(DefaultModelCriteria<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 DefaultModelCriteria<M> getModelCriteriaBuilder()
    • getOrderBy

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

      public String toString()
      Overrides:
      toString in class Object