Package 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 createQueryParameters
instance for Users, M is equal to UserModel, hence we are not able, for example, to order result by aSearchableModelField
defined for clients inClientModel
.
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 Description static class
QueryParameters.Order
Enum for ascending or descending orderingstatic class
QueryParameters.OrderBy<M>
Wrapper class for a field with itsOrder
, ascending or descending
-
Constructor Summary
Constructors Constructor Description QueryParameters()
QueryParameters(DefaultModelCriteria<M> mcb)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
getLimit()
DefaultModelCriteria<M>
getModelCriteriaBuilder()
Integer
getOffset()
List<QueryParameters.OrderBy<M>>
getOrderBy()
QueryParameters<M>
limit(Integer limit)
Sets limit parameterQueryParameters<M>
offset(Integer offset)
Sets offset parameterQueryParameters<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 toQueryParameters
String
toString()
static <M> QueryParameters<M>
withCriteria(DefaultModelCriteria<M> mcb)
Creates a newQueryParameters
instance initialized withModelCriteriaBuilder
-
-
-
Constructor Detail
-
QueryParameters
public QueryParameters()
-
QueryParameters
public QueryParameters(DefaultModelCriteria<M> mcb)
-
-
Method Detail
-
withCriteria
public static <M> QueryParameters<M> withCriteria(DefaultModelCriteria<M> mcb)
Creates a newQueryParameters
instance initialized withModelCriteriaBuilder
- 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 toQueryParameters
- 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()
-
-