T
- The type of the entity viewQ
- PaginatedCriteriaBuilder if paginated, CriteriaBuilder otherwisepublic final class EntityViewSetting<T,Q extends FullQueryBuilder<T,Q>>
extends java.lang.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 | Class | Description |
---|---|---|
static class |
EntityViewSetting.AttributeFilterActivation |
Modifier and Type | Method | Description |
---|---|---|
void |
addAttributeFilter(java.lang.String attributeName,
java.lang.Object filterValue) |
Adds the attribute's default attribute filter to the attribute filters of this setting
or overwrites the filter value of an existing default attribute filter.
|
void |
addAttributeFilter(java.lang.String attributeName,
java.lang.String filterName,
java.lang.Object filterValue) |
Adds the attribute's attribute filter with the given name to the attribute filters of this setting
or overwrites the filter value of an existing attribute filter with the same attribute name and filter name.
|
void |
addAttributeFilters(java.util.Map<java.lang.String,java.lang.Object> attributeFilters) |
Adds the given attribute filters to the attribute filters of this
setting.
|
void |
addAttributeSorter(java.lang.String attributeName,
Sorter sorter) |
Adds the given attribute sorter to the attribute sorters of this setting.
|
void |
addAttributeSorters(java.util.Map<java.lang.String,Sorter> attributeSorters) |
Adds the given attribute sorters to the attribute sorters of this
setting.
|
void |
addOptionalParameter(java.lang.String parameterName,
java.lang.Object value) |
Adds the given optional parameter to the optional parameters of this
setting.
|
void |
addOptionalParameters(java.util.Map<java.lang.String,java.lang.Object> optionalParameters) |
Adds the given optional parameters to the optional parameters of this
setting.
|
void |
addViewFilter(java.lang.String filterName) |
Enables and adds the view filter with the given name in this setting.
|
static <T> EntityViewSetting<T,CriteriaBuilder<T>> |
create(java.lang.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(java.lang.Class<T> entityViewClass,
int firstResult,
int maxResults) |
Like
create(java.lang.Class, int, int, java.lang.String) but with the viewConstructorname set to null. |
static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> |
create(java.lang.Class<T> entityViewClass,
int firstResult,
int maxResults,
java.lang.String viewConstructorName) |
Creates a new EntityViewSetting that can be applied on
criteria builders.
|
static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> |
create(java.lang.Class<T> entityViewClass,
java.lang.Object entityId,
int maxResults) |
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(java.lang.Class<T> entityViewClass,
java.lang.Object entityId,
int maxResults,
java.lang.String viewConstructorName) |
Creates a new EntityViewSetting that can be applied on
criteria builders.
|
static <T> EntityViewSetting<T,CriteriaBuilder<T>> |
create(java.lang.Class<T> entityViewClass,
java.lang.String viewConstructorName) |
Creates a new EntityViewSetting that can be applied on
criteria builders.
|
<X extends T,Y extends FullQueryBuilder<X,Y>> |
forSubtype(java.lang.Class<X> subtype) |
Creates a copy of
this EntityViewSetting for the given entity view subtype. |
java.util.Map<java.lang.String,EntityViewSetting.AttributeFilterActivation> |
getAttributeFilters() |
Returns a copy of the attribute filters that have been added.
|
java.util.Map<java.lang.String,Sorter> |
getAttributeSorters() |
Returns a copy of the attribute sorters that have been added.
|
java.lang.Object |
getEntityId() |
The id of the entity which should be located on the page returned result.
|
java.lang.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.
|
java.util.Map<java.lang.String,java.lang.Object> |
getOptionalParameters() |
Returns a copy of the optional parameters that have been added.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties() |
Get the properties and hints and associated values that are in effect
for the entity view setting.
|
java.lang.String |
getViewConstructorName() |
Returns the entity view constructor name.
|
java.util.Set<java.lang.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 |
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.
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object value) |
Set a entity view property or hint.
|
EntityViewSetting<T,Q> |
withKeysetPage(KeysetPage keysetPage) |
Sets the key set of this setting.
|
public static <T> EntityViewSetting<T,CriteriaBuilder<T>> create(java.lang.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(java.lang.Class<T> entityViewClass, java.lang.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(java.lang.Class<T> entityViewClass, int firstResult, int maxResults)
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 builderfirstResult
- The position of the first result to retrieve, numbered from 0maxResults
- The maximum number of results to retrievepublic static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> create(java.lang.Class<T> entityViewClass, java.lang.Object entityId, int maxResults)
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 pagemaxResults
- The maximum number of results to retrievepublic static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> create(java.lang.Class<T> entityViewClass, int firstResult, int maxResults, java.lang.String viewConstructorName)
T
- The type of the entity viewentityViewClass
- The entity view class that should be used for the object builderfirstResult
- The position of the first result to retrieve, numbered from 0maxResults
- The maximum number of results to retrieveviewConstructorName
- The name of the view constructorpublic static <T> EntityViewSetting<T,PaginatedCriteriaBuilder<T>> create(java.lang.Class<T> entityViewClass, java.lang.Object entityId, int maxResults, java.lang.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 pagemaxResults
- The maximum number of results to retrieveviewConstructorName
- The name of the view constructorpublic <X extends T,Y extends FullQueryBuilder<X,Y>> EntityViewSetting<X,Y> forSubtype(java.lang.Class<X> subtype)
this
EntityViewSetting for the given entity view subtype.X
- Entity view subtypeY
- The query builder typesubtype
- The entity view subtypepublic java.lang.Class<T> getEntityViewClass()
public java.lang.String getViewConstructorName()
public java.lang.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(java.util.Map<java.lang.String,Sorter> attributeSorters)
attributeSorters
- The attribute sorters to addpublic void addAttributeSorter(java.lang.String attributeName, Sorter sorter)
attributeName
- The name of the attribute sortersorter
- The sorter for the attribute sorterpublic boolean hasAttributeSorters()
public java.util.Map<java.lang.String,Sorter> getAttributeSorters()
public void addAttributeFilters(java.util.Map<java.lang.String,java.lang.Object> attributeFilters)
attributeFilters
- The attribute filters to addpublic void addAttributeFilter(java.lang.String attributeName, java.lang.Object filterValue)
attributeName
- The name of the attribute filterfilterValue
- The filter value for the attribute filterpublic void addAttributeFilter(java.lang.String attributeName, java.lang.String filterName, java.lang.Object filterValue)
attributeName
- The attribute namefilterName
- The filter namefilterValue
- The filter value for the attribute filterpublic boolean hasAttributeFilters()
public java.util.Map<java.lang.String,EntityViewSetting.AttributeFilterActivation> getAttributeFilters()
public void addViewFilter(java.lang.String filterName)
filterName
- The name of the view filterpublic boolean hasViewFilters()
public java.util.Set<java.lang.String> getViewFilters()
public void addOptionalParameters(java.util.Map<java.lang.String,java.lang.Object> optionalParameters)
optionalParameters
- The optional parameters to addpublic void addOptionalParameter(java.lang.String parameterName, java.lang.Object value)
parameterName
- The name of the optional parametervalue
- The value of the optional parameterpublic boolean hasOptionalParameters()
public java.util.Map<java.lang.String,java.lang.Object> getOptionalParameters()
public void setProperty(java.lang.String propertyName, java.lang.Object value)
propertyName
- name of property or hintvalue
- value for property or hintjava.lang.IllegalArgumentException
- if the second argument is
not valid for the implementationpublic java.util.Map<java.lang.String,java.lang.Object> getProperties()
Copyright © 2014–2018 Blazebit. All rights reserved.