Package com.blazebit.persistence.view
Interface EntityViewManager
- All Superinterfaces:
ServiceProvider
- All Known Implementing Classes:
SerializableEntityViewManager
public interface EntityViewManager extends ServiceProvider
An interface that gives access to the metamodel and object builders.
- Since:
- 1.0.0
- Author:
- Christian Beikov
-
Method Summary
Modifier and Type Method Description <T, Q extends FullQueryBuilder<T, Q>>
QapplySetting(EntityViewSetting<T,Q> setting, CriteriaBuilder<?> criteriaBuilder)
Applies the entity view setting to the given criteria builder.<T, Q extends FullQueryBuilder<T, Q>>
QapplySetting(EntityViewSetting<T,Q> setting, CriteriaBuilder<?> criteriaBuilder, String entityViewRoot)
Applies the entity view setting to the given entity view root of the criteria builder.<T> T
convert(Object source, Class<T> entityViewClass, ConvertOption... convertOptions)
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.<T> T
convert(Object source, Class<T> entityViewClass, String constructorName, ConvertOption... convertOptions)
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.<T> T
convert(Object source, Class<T> entityViewClass, String constructorName, Map<String,Object> optionalParameters, ConvertOption... convertOptions)
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.<T> T
convert(Object source, Class<T> entityViewClass, Map<String,Object> optionalParameters, ConvertOption... convertOptions)
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.<T> ConvertOperationBuilder<T>
convertWith(Object source, Class<T> entityViewClass, ConvertOption... convertOptions)
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.<T> ConvertOperationBuilder<T>
convertWith(Object source, Class<T> entityViewClass, String constructorName, ConvertOption... convertOptions)
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.<T> ConvertOperationBuilder<T>
convertWith(Object source, Class<T> entityViewClass, String constructorName, Map<String,Object> optionalParameters, ConvertOption... convertOptions)
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.<T> ConvertOperationBuilder<T>
convertWith(Object source, Class<T> entityViewClass, Map<String,Object> optionalParameters, ConvertOption... convertOptions)
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.<T> T
create(Class<T> entityViewClass)
Creates a new instance of the entity view class and returns it.<T> T
create(Class<T> entityViewClass, Map<String,Object> optionalParameters)
Creates a new instance of the entity view class and returns it.<X> EntityViewBuilder<X>
createBuilder(Class<X> clazz)
Creates a builder for the entity view of the given class type.<X> EntityViewBuilder<X>
createBuilder(Class<X> clazz, String constructorName)
Creates a builder for the entity view of the given class type.<X> EntityViewBuilder<X>
createBuilder(Class<X> clazz, Map<String,Object> optionalParameters)
Creates a builder for the entity view of the given class type.<X> EntityViewBuilder<X>
createBuilder(Class<X> clazz, Map<String,Object> optionalParameters, String constructorName)
Creates a builder for the entity view of the given class type.<X> EntityViewBuilder<X>
createBuilder(X view)
Copies the state from the given view into a builder for the same entity view type.<X> EntityViewBuilder<X>
createBuilder(X view, String constructorName)
Copies the state from the given view into a builder for the same entity view type.<X> EntityViewBuilder<X>
createBuilder(X view, Map<String,Object> optionalParameters)
Copies the state from the given view into a builder for the same entity view type.<X> EntityViewBuilder<X>
createBuilder(X view, Map<String,Object> optionalParameters, String constructorName)
Copies the state from the given view into a builder for the same entity view type.<T> T
find(javax.persistence.EntityManager entityManager, EntityViewSetting<T,CriteriaBuilder<T>> entityViewSetting, Object entityId)
Loads and returns an entity view as determined by the given typeEntityViewSetting
having the given entity id.<T> T
find(javax.persistence.EntityManager entityManager, Class<T> entityViewClass, Object entityId)
Loads and returns an entity view of the given type having the given entity id.<T> SingularChangeModel<T>
getChangeModel(T entityView)
Gives access to the change model of the entity view instance.<T> T
getEntityReference(javax.persistence.EntityManager entityManager, Object entityView)
Creates an entity reference for the given entity view and returns it.ViewMetamodel
getMetamodel()
Returns the metamodel for this entity view manager.Map<String,Object>
getOptionalParameters()
Returns the globally configured optional parameters.<T> T
getReference(Class<T> entityViewClass, Object id)
Creates a reference instance of the entity view class for the given id and returns it.void
remove(javax.persistence.EntityManager entityManager, Class<?> entityViewClass, Object viewId)
Removes the entity represented by the entity type defiend for the given view and the given entity id.void
remove(javax.persistence.EntityManager entityManager, Object view)
Removes the entity represented by the given view.FlushOperationBuilder
removeWith(javax.persistence.EntityManager entityManager, Class<?> entityViewClass, Object viewId)
Removes the entity represented by the entity type defiend for the given view and the given entity id.FlushOperationBuilder
removeWith(javax.persistence.EntityManager entityManager, Object view)
Removes the entity represented by the given view.void
save(javax.persistence.EntityManager entityManager, Object view)
Saves the entity which the given entity view maps to.void
saveFull(javax.persistence.EntityManager entityManager, Object view)
Fully saves the entity which the given entity view maps to.void
saveFullTo(javax.persistence.EntityManager entityManager, Object view, Object entity)
Fully saves the entity view state onto the given entity.FlushOperationBuilder
saveFullWith(javax.persistence.EntityManager entityManager, Object view)
Fully saves the entity which the given entity view maps to.FlushOperationBuilder
saveFullWithTo(javax.persistence.EntityManager entityManager, Object view, Object entity)
Fully saves the entity view state onto the given entity.void
saveTo(javax.persistence.EntityManager entityManager, Object view, Object entity)
Saves the entity view state onto the given entity.FlushOperationBuilder
saveWith(javax.persistence.EntityManager entityManager, Object view)
Saves the entity which the given entity view maps to.FlushOperationBuilder
saveWithTo(javax.persistence.EntityManager entityManager, Object view, Object entity)
Saves the entity view state onto the given entity.void
update(javax.persistence.EntityManager entityManager, Object view)
Deprecated.Usesave(EntityManager, Object)
instead.void
updateFull(javax.persistence.EntityManager entityManager, Object view)
Deprecated.UsesaveFull(EntityManager, Object)
instead.
-
Method Details
-
getMetamodel
ViewMetamodel getMetamodel()Returns the metamodel for this entity view manager.- Returns:
- The metamodel for this entity view manager
-
getOptionalParameters
Returns the globally configured optional parameters.- Returns:
- The optional parameters
- Since:
- 1.5.0
-
find
<T> T find(javax.persistence.EntityManager entityManager, Class<T> entityViewClass, Object entityId)Loads and returns an entity view of the given type having the given entity id.- Type Parameters:
T
- The type of the entity view class- Parameters:
entityManager
- The entity manager to use for queryingentityViewClass
- The entity view class to useentityId
- The id of the entity- Returns:
- The loaded instance of the given entity view type with the id
- Since:
- 1.2.0
-
find
<T> T find(javax.persistence.EntityManager entityManager, EntityViewSetting<T,CriteriaBuilder<T>> entityViewSetting, Object entityId)Loads and returns an entity view as determined by the given typeEntityViewSetting
having the given entity id.- Type Parameters:
T
- The type of the entity view class- Parameters:
entityManager
- The entity manager to use for queryingentityViewSetting
- The entity view setting to useentityId
- The id of the entity- Returns:
- The loaded instance of the given entity view type with the id
- Since:
- 1.2.0
-
getReference
Creates a reference instance of the entity view class for the given id and returns it.- Type Parameters:
T
- The type of the entity view class- Parameters:
entityViewClass
- The entity view class to constructid
- The id of the entity view- Returns:
- A reference instance of the given entity view type with the id
- Since:
- 1.2.0
-
getEntityReference
Creates an entity reference for the given entity view and returns it.- Type Parameters:
T
- The type of the entity class- Parameters:
entityManager
- The entity manager to use for the entity referenceentityView
- The entity view class for which to get the entity reference- Returns:
- An entity reference for given entity view object
- Since:
- 1.3.0
-
getChangeModel
Gives access to the change model of the entity view instance.- Type Parameters:
T
- The type of the given entity view- Parameters:
entityView
- The entity view- Returns:
- The change model of the entity view instance
- Since:
- 1.2.0
-
create
Creates a new instance of the entity view class and returns it.- Type Parameters:
T
- The type of the entity view class- Parameters:
entityViewClass
- The entity view class to construct- Returns:
- A new instance of the given entity view class
- Since:
- 1.2.0
-
create
Creates a new instance of the entity view class and returns it.- Type Parameters:
T
- The type of the entity view class- Parameters:
entityViewClass
- The entity view class to constructoptionalParameters
- The optional parameters to consider- Returns:
- A new instance of the given entity view class
- Since:
- 1.5.0
-
createBuilder
Creates a builder for the entity view of the given class type.- Type Parameters:
X
- The entity view type- Parameters:
clazz
- The entity view type to build- Returns:
- The builder
- Since:
- 1.5.0
-
createBuilder
Creates a builder for the entity view of the given class type.- Type Parameters:
X
- The entity view type- Parameters:
clazz
- The entity view type to buildconstructorName
- The entity view constructor to use- Returns:
- The builder
- Since:
- 1.5.0
-
createBuilder
Copies the state from the given view into a builder for the same entity view type.- Type Parameters:
X
- The entity view type- Parameters:
view
- The entity view to copy into a builder- Returns:
- The builder
- Since:
- 1.5.0
-
createBuilder
Copies the state from the given view into a builder for the same entity view type.- Type Parameters:
X
- The entity view type- Parameters:
view
- The entity view to copy into a builderconstructorName
- The entity view constructor to use- Returns:
- The builder
- Since:
- 1.5.0
-
createBuilder
Creates a builder for the entity view of the given class type.- Type Parameters:
X
- The entity view type- Parameters:
clazz
- The entity view type to buildoptionalParameters
- The optional parameters to consider- Returns:
- The builder
- Since:
- 1.5.0
-
createBuilder
<X> EntityViewBuilder<X> createBuilder(Class<X> clazz, Map<String,Object> optionalParameters, String constructorName)Creates a builder for the entity view of the given class type.- Type Parameters:
X
- The entity view type- Parameters:
clazz
- The entity view type to buildoptionalParameters
- The optional parameters to considerconstructorName
- The entity view constructor to use- Returns:
- The builder
- Since:
- 1.5.0
-
createBuilder
Copies the state from the given view into a builder for the same entity view type.- Type Parameters:
X
- The entity view type- Parameters:
view
- The entity view to copy into a builderoptionalParameters
- The optional parameters to consider- Returns:
- The builder
- Since:
- 1.5.0
-
createBuilder
<X> EntityViewBuilder<X> createBuilder(X view, Map<String,Object> optionalParameters, String constructorName)Copies the state from the given view into a builder for the same entity view type.- Type Parameters:
X
- The entity view type- Parameters:
view
- The entity view to copy into a builderoptionalParameters
- The optional parameters to considerconstructorName
- The entity view constructor to use- Returns:
- The builder
- Since:
- 1.5.0
-
convert
Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Type Parameters:
T
- The type of the entity view class- Parameters:
source
- The source object from which to copy valuesentityViewClass
- The entity view class to constructconvertOptions
- The options to use for converting- Returns:
- A new instance of the given entity view class
- Since:
- 1.2.0
-
convert
<T> T convert(Object source, Class<T> entityViewClass, String constructorName, ConvertOption... convertOptions)Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Type Parameters:
T
- The type of the entity view class- Parameters:
source
- The source object from which to copy valuesentityViewClass
- The entity view class to constructconstructorName
- The name of the entity view constructor to useconvertOptions
- The options to use for converting- Returns:
- A new instance of the given entity view class
- Since:
- 1.5.0
-
convert
<T> T convert(Object source, Class<T> entityViewClass, Map<String,Object> optionalParameters, ConvertOption... convertOptions)Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Type Parameters:
T
- The type of the entity view class- Parameters:
source
- The source object from which to copy valuesentityViewClass
- The entity view class to constructoptionalParameters
- The optional parameters to considerconvertOptions
- The options to use for converting- Returns:
- A new instance of the given entity view class
- Since:
- 1.5.0
-
convert
<T> T convert(Object source, Class<T> entityViewClass, String constructorName, Map<String,Object> optionalParameters, ConvertOption... convertOptions)Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Type Parameters:
T
- The type of the entity view class- Parameters:
source
- The source object from which to copy valuesentityViewClass
- The entity view class to constructconstructorName
- The name of the entity view constructor to useoptionalParameters
- The optional parameters to considerconvertOptions
- The options to use for converting- Returns:
- A new instance of the given entity view class
- Since:
- 1.5.0
-
convertWith
<T> ConvertOperationBuilder<T> convertWith(Object source, Class<T> entityViewClass, ConvertOption... convertOptions)Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Type Parameters:
T
- The type of the entity view class- Parameters:
source
- The source object from which to copy valuesentityViewClass
- The entity view class to constructconvertOptions
- The options to use for converting- Returns:
- A builder to specify attribute entity view types and conversion options
- Since:
- 1.4.0
-
convertWith
<T> ConvertOperationBuilder<T> convertWith(Object source, Class<T> entityViewClass, String constructorName, ConvertOption... convertOptions)Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Type Parameters:
T
- The type of the entity view class- Parameters:
source
- The source object from which to copy valuesentityViewClass
- The entity view class to constructconstructorName
- The name of the entity view constructor to useconvertOptions
- The options to use for converting- Returns:
- A builder to specify attribute entity view types and conversion options
- Since:
- 1.5.0
-
convertWith
<T> ConvertOperationBuilder<T> convertWith(Object source, Class<T> entityViewClass, Map<String,Object> optionalParameters, ConvertOption... convertOptions)Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Type Parameters:
T
- The type of the entity view class- Parameters:
source
- The source object from which to copy valuesentityViewClass
- The entity view class to constructoptionalParameters
- The optional parameters to considerconvertOptions
- The options to use for converting- Returns:
- A builder to specify attribute entity view types and conversion options
- Since:
- 1.5.0
-
convertWith
<T> ConvertOperationBuilder<T> convertWith(Object source, Class<T> entityViewClass, String constructorName, Map<String,Object> optionalParameters, ConvertOption... convertOptions)Creates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Type Parameters:
T
- The type of the entity view class- Parameters:
source
- The source object from which to copy valuesentityViewClass
- The entity view class to constructconstructorName
- The name of the entity view constructor to useoptionalParameters
- The optional parameters to considerconvertOptions
- The options to use for converting- Returns:
- A builder to specify attribute entity view types and conversion options
- Since:
- 1.5.0
-
save
Saves the entity which the given entity view maps to. Issues a partial update if enabled for the given view.- Parameters:
entityManager
- The entity manager to use for the saveview
- The view to use for saving- Since:
- 1.4.0
-
saveFull
Fully saves the entity which the given entity view maps to.- Parameters:
entityManager
- The entity manager to use for the saveview
- The view to use for saving- Since:
- 1.4.0
-
saveTo
Saves the entity view state onto the given entity. Issues a partial update if enabled for the given view.- Parameters:
entityManager
- The entity manager to use for the saveview
- The view to use for savingentity
- The entity to apply data to- Since:
- 1.4.0
-
saveFullTo
Fully saves the entity view state onto the given entity.- Parameters:
entityManager
- The entity manager to use for the saveview
- The view to use for savingentity
- The entity to apply data to- Since:
- 1.4.0
-
update
Deprecated.Usesave(EntityManager, Object)
instead. This will be removed in 2.0Updates the entity which the given entity view maps to. Issues a partial update if enabled for the given view.- Parameters:
entityManager
- The entity manager to use for the updateview
- The view to use for updating- Since:
- 1.1.0
-
updateFull
Deprecated.UsesaveFull(EntityManager, Object)
instead. This will be removed in 2.0Fully updates the entity which the given entity view maps to.- Parameters:
entityManager
- The entity manager to use for the updateview
- The view to use for updating- Since:
- 1.1.0
-
saveWith
Saves the entity which the given entity view maps to. Issues a partial update if enabled for the given view.- Parameters:
entityManager
- The entity manager to use for the updateview
- The view to use for updating- Returns:
- A flush operation builder for further configuring the flush operation
- Since:
- 1.4.0
-
saveFullWith
Fully saves the entity which the given entity view maps to.- Parameters:
entityManager
- The entity manager to use for the updateview
- The view to use for updating- Returns:
- A flush operation builder for further configuring the flush operation
- Since:
- 1.4.0
-
saveWithTo
FlushOperationBuilder saveWithTo(javax.persistence.EntityManager entityManager, Object view, Object entity)Saves the entity view state onto the given entity. Issues a partial update if enabled for the given view.- Parameters:
entityManager
- The entity manager to use for the updateview
- The view to use for updatingentity
- The entity to apply data to- Returns:
- A flush operation builder for further configuring the flush operation
- Since:
- 1.4.0
-
saveFullWithTo
FlushOperationBuilder saveFullWithTo(javax.persistence.EntityManager entityManager, Object view, Object entity)Fully saves the entity view state onto the given entity.- Parameters:
entityManager
- The entity manager to use for the updateview
- The view to use for updatingentity
- The entity to apply data to- Returns:
- A flush operation builder for further configuring the flush operation
- Since:
- 1.4.0
-
remove
Removes the entity represented by the given view. Also cascades deletes to attributes that haveCascadeType.DELETE
enabled.- Parameters:
entityManager
- The entity manager to use for the removingview
- The view for which the entity should be removed- Since:
- 1.2.0
-
removeWith
Removes the entity represented by the given view. Also cascades deletes to attributes that haveCascadeType.DELETE
enabled.- Parameters:
entityManager
- The entity manager to use for the removingview
- The view for which the entity should be removed- Returns:
- A flush operation builder for further configuring the flush operation
- Since:
- 1.4.0
-
remove
void remove(javax.persistence.EntityManager entityManager, Class<?> entityViewClass, Object viewId)Removes the entity represented by the entity type defiend for the given view and the given entity id. Also cascades deletes to attributes that haveCascadeType.DELETE
enabled.- Parameters:
entityManager
- The entity manager to use for the removingentityViewClass
- The entity view class to useviewId
- The id of entity view- Since:
- 1.2.0
-
removeWith
FlushOperationBuilder removeWith(javax.persistence.EntityManager entityManager, Class<?> entityViewClass, Object viewId)Removes the entity represented by the entity type defiend for the given view and the given entity id. Also cascades deletes to attributes that haveCascadeType.DELETE
enabled.- Parameters:
entityManager
- The entity manager to use for the removingentityViewClass
- The entity view class to useviewId
- The id of entity view- Returns:
- A flush operation builder for further configuring the flush operation
- Since:
- 1.4.0
-
applySetting
<T, Q extends FullQueryBuilder<T, Q>> Q applySetting(EntityViewSetting<T,Q> setting, CriteriaBuilder<?> criteriaBuilder)Applies the entity view setting to the given criteria builder.- Type Parameters:
T
- The type of the entity viewQ
- PaginatedCriteriaBuilder if paginated, CriteriaBuilder otherwise- Parameters:
setting
- The setting that should be appliedcriteriaBuilder
- The criteria builder on which the setting should be applied- Returns:
- PaginatedCriteriaBuilder if paginated, CriteriaBuilder otherwise
-
applySetting
<T, Q extends FullQueryBuilder<T, Q>> Q applySetting(EntityViewSetting<T,Q> setting, CriteriaBuilder<?> criteriaBuilder, String entityViewRoot)Applies the entity view setting to the given entity view root of the criteria builder.- Type Parameters:
T
- The type of the entity viewQ
- PaginatedCriteriaBuilder if paginated, CriteriaBuilder otherwise- Parameters:
setting
- The setting that should be appliedcriteriaBuilder
- The criteria builder on which the setting should be appliedentityViewRoot
- The relation from which the entity view should be materialized- Returns:
- PaginatedCriteriaBuilder if paginated, CriteriaBuilder otherwise
- Since:
- 1.2.0
-