T
- The type of the entity viewQ
- PaginatedCriteriaBuilder if paginated, CriteriaBuilder otherwisepublic final class EntityViewSetting<T,Q extends FullQueryBuilder<T,Q>> extends Object
CriteriaBuilder
. Filters and sorters are added for
entity view attribute names. It also supports pagination and optional
parameters. Optional parameters are only set on a criteria builder if they
are needed but not satisfied.Modifier and Type | Method and Description |
---|---|
void |
addAttributeFilter(String attributeName,
Object filterValue)
Adds the given attribute filter to the attribute filters of this setting.
|
void |
addAttributeFilters(Map<String,Object> attributeFilters)
Adds the given attribute filters to the attribute filters of this
setting.
|
void |
addAttributeNamedFilter(String filterName)
Enables and adds the attribute filter with the given name in this setting.
|
void |
addAttributeSorter(String attributeName,
Sorter sorter)
Adds the given attribute sorter to the attribute sorters of this setting.
|
void |
addAttributeSorters(Map<String,Sorter> attributeSorters)
Adds the given attribute sorters to the attribute sorters of this
setting.
|
void |
addOptionalParameter(String parameterName,
Object value)
Adds the given optional parameter to the optional parameters of this
setting.
|
void |
addOptionalParameters(Map<String,Object> optionalParameters)
Adds the given optional parameters to the optional parameters of this
setting.
|
void |
addViewFilter(String filterName)
Enables and adds the view filter with the given name in this setting.
|
static <T> EntityViewSetting<T,CriteriaBuilder<T>> |
create(Class<T> entityViewClass)
Like
create(java.lang.Class, java.lang.String) but with the viewConstructorname set to null. |
static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> |
create(Class<T> entityViewClass,
int firstRow,
int maxRows)
Like
create(java.lang.Class, int, int, java.lang.String) but with the viewConstructorname set to null. |
static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> |
create(Class<T> entityViewClass,
int firstRow,
int maxRows,
String viewConstructorName)
Creates a new EntityViewSetting that can be applied on
criteria builders.
|
static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> |
create(Class<T> entityViewClass,
Object entityId,
int maxRows)
Like
create(java.lang.Class, java.lang.Object, int, java.lang.String) but with the viewConstructorname set to null. |
static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> |
create(Class<T> entityViewClass,
Object entityId,
int maxRows,
String viewConstructorName)
Creates a new EntityViewSetting that can be applied on
criteria builders.
|
static <T> EntityViewSetting<T,CriteriaBuilder<T>> |
create(Class<T> entityViewClass,
String viewConstructorName)
Creates a new EntityViewSetting that can be applied on
criteria builders.
|
Map<String,Object> |
getAttributeFilters()
Returns a copy of the attribute filters that have been added.
|
Set<String> |
getAttributeNamedFilters()
Returns a copy of the named filters for attributes that have been added.
|
Map<String,Sorter> |
getAttributeSorters()
Returns a copy of the attribute sorters that have been added.
|
Object |
getEntityId()
The id of the entity which should be located on the page returned result.
|
Class<T> |
getEntityViewClass()
Returns the entity view class.
|
int |
getFirstResult()
The first result that the criteria builder should return.
|
KeysetPage |
getKeysetPage()
Returns the key set of this setting.
|
int |
getMaxResults()
The maximum number of results that the criteria builder should return.
|
Map<String,Object> |
getOptionalParameters()
Returns a copy of the optional parameters that have been added.
|
String |
getViewConstructorName()
Returns the entity view constructor name.
|
Set<String> |
getViewFilters()
Returns a copy of the named filters for the view that have been added.
|
boolean |
hasAttributeFilters()
Returns true if filters have been added, otherwise false.
|
boolean |
hasAttributeNamedFilters()
Returns true if named filters for attributes have been added, otherwise false.
|
boolean |
hasAttributeSorters()
Returns true if sorters have been added, otherwise false.
|
boolean |
hasOptionalParameters()
Returns true if optional parameters have been added, otherwise false.
|
boolean |
hasViewFilters()
Returns true if named filters for the view have been added, otherwise false.
|
boolean |
isKeysetPaginated()
Returns true if this setting is key set paginated.
|
boolean |
isPaginated()
Returns true if this entiy view setting applies pagination, false otherwise.
|
EntityViewSetting<T,Q> |
withKeysetPage(KeysetPage keysetPage)
Sets the key set of this setting.
|
public static <T> EntityViewSetting<T,CriteriaBuilder<T>> create(Class<T> entityViewClass)
create(java.lang.Class, java.lang.String)
but with the viewConstructorname
set to null.T
- The type of the entity viewentityViewClass
- The entity view class that should be used for the object builderpublic static <T> EntityViewSetting<T,CriteriaBuilder<T>> create(Class<T> entityViewClass, String viewConstructorName)
T
- The type of the entity viewentityViewClass
- The entity view class that should be used for the object builderviewConstructorName
- The name of the view constructorpublic static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> create(Class<T> entityViewClass, int firstRow, int maxRows)
create(java.lang.Class, int, int, java.lang.String)
but with the viewConstructorname
set to null.T
- The type of the entity viewentityViewClass
- The entity view class that should be used for the object builderfirstRow
- The position of the first result to retrieve, numbered from 0maxRows
- The maximum number of results to retrievepublic static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> create(Class<T> entityViewClass, Object entityId, int maxRows)
create(java.lang.Class, java.lang.Object, int, java.lang.String)
but with the viewConstructorname
set to null.T
- The type of the entity viewentityViewClass
- The entity view class that should be used for the object builderentityId
- The id of the entity which should be located on a pagemaxRows
- The maximum number of results to retrievepublic static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> create(Class<T> entityViewClass, int firstRow, int maxRows, String viewConstructorName)
T
- The type of the entity viewentityViewClass
- The entity view class that should be used for the object builderfirstRow
- The position of the first result to retrieve, numbered from 0maxRows
- The maximum number of results to retrieveviewConstructorName
- The name of the view constructorpublic static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> create(Class<T> entityViewClass, Object entityId, int maxRows, String viewConstructorName)
T
- The type of the entity viewentityViewClass
- The entity view class that should be used for the object builderentityId
- The id of the entity which should be located on a pagemaxRows
- The maximum number of results to retrieveviewConstructorName
- The name of the view constructorpublic Class<T> getEntityViewClass()
public String getViewConstructorName()
public Object getEntityId()
null
if no pagination or a absolute first result will be applied.FullQueryBuilder.page(java.lang.Object, int)
public int getFirstResult()
FullQueryBuilder.page(int, int)
public int getMaxResults()
FullQueryBuilder.page(int, int)
public boolean isPaginated()
public KeysetPage getKeysetPage()
public EntityViewSetting<T,Q> withKeysetPage(KeysetPage keysetPage)
keysetPage
- the new key setpublic boolean isKeysetPaginated()
public void addAttributeSorters(Map<String,Sorter> attributeSorters)
attributeSorters
- The attribute sorters to addpublic void addAttributeSorter(String attributeName, Sorter sorter)
attributeName
- The name of the attribute sortersorter
- The sorter for the attribute sorterpublic boolean hasAttributeSorters()
public Map<String,Sorter> getAttributeSorters()
public void addAttributeFilters(Map<String,Object> attributeFilters)
attributeFilters
- The attribute filters to addpublic void addAttributeFilter(String attributeName, Object filterValue)
attributeName
- The name of the attribute filterfilterValue
- The filter value for the attribute filterpublic boolean hasAttributeFilters()
public Map<String,Object> getAttributeFilters()
public void addAttributeNamedFilter(String filterName)
filterName
- The name of the attribute filterpublic boolean hasAttributeNamedFilters()
public Set<String> getAttributeNamedFilters()
public void addViewFilter(String filterName)
filterName
- The name of the view filterpublic boolean hasViewFilters()
public Set<String> getViewFilters()
public void addOptionalParameters(Map<String,Object> optionalParameters)
optionalParameters
- The optional parameters to addpublic void addOptionalParameter(String parameterName, Object value)
parameterName
- The name of the optional parametervalue
- The value of the optional parameterpublic boolean hasOptionalParameters()
Copyright © 2015 Blazebit. All Rights Reserved.