Package com.blazebit.persistence.view
Class SerializableEntityViewManager
java.lang.Object
com.blazebit.persistence.view.SerializableEntityViewManager
- All Implemented Interfaces:
ServiceProvider,EntityViewManager,Serializable
public class SerializableEntityViewManager
extends Object
implements EntityViewManager, Serializable
A serializable entity view manager implementation that accesses the actual entity view manager through a static field in the entity view implementation class.
- Since:
- 1.5.0
- Author:
- Christian Beikov
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSerializableEntityViewManager(Class<?> entityViewClass, EntityViewManager evm) Creates a new serializable entity view manager. -
Method Summary
Modifier and TypeMethodDescription<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> Tconvert(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> Tconvert(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> Tconvert(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> Tconvert(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> TCreates a new instance of the entity view class and returns it.<T> TCreates 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>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> Tfind(javax.persistence.EntityManager entityManager, EntityViewSetting<T, CriteriaBuilder<T>> entityViewSetting, Object entityId) Loads and returns an entity view as determined by the given typeEntityViewSettinghaving the given entity id.<T> TLoads 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> TgetEntityReference(javax.persistence.EntityManager entityManager, Object entityView) Creates an entity reference for the given entity view and returns it.Returns the metamodel for this entity view manager.Returns the globally configured optional parameters.<T> TgetReference(Class<T> entityViewClass, Object id) Creates a reference instance of the entity view class for the given id and returns it.<T> TgetService(Class<T> serviceClass) voidRemoves the entity represented by the entity type defiend for the given view and the given entity id.voidRemoves the entity represented by the given view.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.removeWith(javax.persistence.EntityManager entityManager, Object view) Removes the entity represented by the given view.voidSaves the entity which the given entity view maps to.voidFully saves the entity which the given entity view maps to.voidsaveFullTo(javax.persistence.EntityManager entityManager, Object view, Object entity) Fully saves the entity view state onto the given entity.saveFullWith(javax.persistence.EntityManager entityManager, Object view) Fully saves the entity which the given entity view maps to.saveFullWithTo(javax.persistence.EntityManager entityManager, Object view, Object entity) Fully saves the entity view state onto the given entity.voidSaves the entity view state onto the given entity.Saves the entity which the given entity view maps to.saveWithTo(javax.persistence.EntityManager entityManager, Object view, Object entity) Saves the entity view state onto the given entity.voidDeprecated.voidupdateFull(javax.persistence.EntityManager entityManager, Object view) Deprecated.
-
Field Details
-
EVM_FIELD_NAME
- See Also:
-
SERIALIZABLE_EVM_FIELD_NAME
- See Also:
-
-
Constructor Details
-
SerializableEntityViewManager
Creates a new serializable entity view manager.- Parameters:
entityViewClass- The entity view class from which to access the entity view manager fromevm- The transient entity view manager
-
-
Method Details
-
getMetamodel
Description copied from interface:EntityViewManagerReturns the metamodel for this entity view manager.- Specified by:
getMetamodelin interfaceEntityViewManager- Returns:
- The metamodel for this entity view manager
-
getOptionalParameters
Description copied from interface:EntityViewManagerReturns the globally configured optional parameters.- Specified by:
getOptionalParametersin interfaceEntityViewManager- Returns:
- The optional parameters
-
find
public <T> T find(javax.persistence.EntityManager entityManager, Class<T> entityViewClass, Object entityId) Description copied from interface:EntityViewManagerLoads and returns an entity view of the given type having the given entity id.- Specified by:
findin interfaceEntityViewManager- 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
-
find
public <T> T find(javax.persistence.EntityManager entityManager, EntityViewSetting<T, CriteriaBuilder<T>> entityViewSetting, Object entityId) Description copied from interface:EntityViewManagerLoads and returns an entity view as determined by the given typeEntityViewSettinghaving the given entity id.- Specified by:
findin interfaceEntityViewManager- 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
-
getReference
Description copied from interface:EntityViewManagerCreates a reference instance of the entity view class for the given id and returns it.- Specified by:
getReferencein interfaceEntityViewManager- 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
-
getEntityReference
Description copied from interface:EntityViewManagerCreates an entity reference for the given entity view and returns it.- Specified by:
getEntityReferencein interfaceEntityViewManager- 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
-
getChangeModel
Description copied from interface:EntityViewManagerGives access to the change model of the entity view instance.- Specified by:
getChangeModelin interfaceEntityViewManager- Type Parameters:
T- The type of the given entity view- Parameters:
entityView- The entity view- Returns:
- The change model of the entity view instance
-
create
Description copied from interface:EntityViewManagerCreates a new instance of the entity view class and returns it.- Specified by:
createin interfaceEntityViewManager- 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
-
create
Description copied from interface:EntityViewManagerCreates a new instance of the entity view class and returns it.- Specified by:
createin interfaceEntityViewManager- 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
-
createBuilder
Description copied from interface:EntityViewManagerCreates a builder for the entity view of the given class type.- Specified by:
createBuilderin interfaceEntityViewManager- Type Parameters:
X- The entity view type- Parameters:
clazz- The entity view type to build- Returns:
- The builder
-
createBuilder
Description copied from interface:EntityViewManagerCreates a builder for the entity view of the given class type.- Specified by:
createBuilderin interfaceEntityViewManager- Type Parameters:
X- The entity view type- Parameters:
clazz- The entity view type to buildconstructorName- The entity view constructor to use- Returns:
- The builder
-
createBuilder
Description copied from interface:EntityViewManagerCopies the state from the given view into a builder for the same entity view type.- Specified by:
createBuilderin interfaceEntityViewManager- Type Parameters:
X- The entity view type- Parameters:
view- The entity view to copy into a builder- Returns:
- The builder
-
createBuilder
Description copied from interface:EntityViewManagerCopies the state from the given view into a builder for the same entity view type.- Specified by:
createBuilderin interfaceEntityViewManager- 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
-
createBuilder
public <X> EntityViewBuilder<X> createBuilder(Class<X> clazz, Map<String, Object> optionalParameters) Description copied from interface:EntityViewManagerCreates a builder for the entity view of the given class type.- Specified by:
createBuilderin interfaceEntityViewManager- Type Parameters:
X- The entity view type- Parameters:
clazz- The entity view type to buildoptionalParameters- The optional parameters to consider- Returns:
- The builder
-
createBuilder
public <X> EntityViewBuilder<X> createBuilder(Class<X> clazz, Map<String, Object> optionalParameters, String constructorName) Description copied from interface:EntityViewManagerCreates a builder for the entity view of the given class type.- Specified by:
createBuilderin interfaceEntityViewManager- 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
-
createBuilder
Description copied from interface:EntityViewManagerCopies the state from the given view into a builder for the same entity view type.- Specified by:
createBuilderin interfaceEntityViewManager- 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
-
createBuilder
public <X> EntityViewBuilder<X> createBuilder(X view, Map<String, Object> optionalParameters, String constructorName) Description copied from interface:EntityViewManagerCopies the state from the given view into a builder for the same entity view type.- Specified by:
createBuilderin interfaceEntityViewManager- 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
-
convert
Description copied from interface:EntityViewManagerCreates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Specified by:
convertin interfaceEntityViewManager- 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
-
convert
public <T> T convert(Object source, Class<T> entityViewClass, String constructorName, ConvertOption... convertOptions) Description copied from interface:EntityViewManagerCreates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Specified by:
convertin interfaceEntityViewManager- 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
-
convert
public <T> T convert(Object source, Class<T> entityViewClass, Map<String, Object> optionalParameters, ConvertOption... convertOptions) Description copied from interface:EntityViewManagerCreates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Specified by:
convertin interfaceEntityViewManager- 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
-
convert
public <T> T convert(Object source, Class<T> entityViewClass, String constructorName, Map<String, Object> optionalParameters, ConvertOption... convertOptions) Description copied from interface:EntityViewManagerCreates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Specified by:
convertin interfaceEntityViewManager- 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
-
convertWith
public <T> ConvertOperationBuilder<T> convertWith(Object source, Class<T> entityViewClass, ConvertOption... convertOptions) Description copied from interface:EntityViewManagerCreates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Specified by:
convertWithin interfaceEntityViewManager- 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
-
convertWith
public <T> ConvertOperationBuilder<T> convertWith(Object source, Class<T> entityViewClass, String constructorName, ConvertOption... convertOptions) Description copied from interface:EntityViewManagerCreates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Specified by:
convertWithin interfaceEntityViewManager- 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
-
convertWith
public <T> ConvertOperationBuilder<T> convertWith(Object source, Class<T> entityViewClass, Map<String, Object> optionalParameters, ConvertOption... convertOptions) Description copied from interface:EntityViewManagerCreates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Specified by:
convertWithin interfaceEntityViewManager- 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
-
convertWith
public <T> ConvertOperationBuilder<T> convertWith(Object source, Class<T> entityViewClass, String constructorName, Map<String, Object> optionalParameters, ConvertOption... convertOptions) Description copied from interface:EntityViewManagerCreates a new instance of the entity view class, copies the values of matching attributes of the source object and returns the instance.- Specified by:
convertWithin interfaceEntityViewManager- 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
-
save
Description copied from interface:EntityViewManagerSaves the entity which the given entity view maps to. Issues a partial update if enabled for the given view.- Specified by:
savein interfaceEntityViewManager- Parameters:
entityManager- The entity manager to use for the saveview- The view to use for saving
-
saveFull
Description copied from interface:EntityViewManagerFully saves the entity which the given entity view maps to.- Specified by:
saveFullin interfaceEntityViewManager- Parameters:
entityManager- The entity manager to use for the saveview- The view to use for saving
-
saveTo
Description copied from interface:EntityViewManagerSaves the entity view state onto the given entity. Issues a partial update if enabled for the given view.- Specified by:
saveToin interfaceEntityViewManager- Parameters:
entityManager- The entity manager to use for the saveview- The view to use for savingentity- The entity to apply data to
-
saveFullTo
Description copied from interface:EntityViewManagerFully saves the entity view state onto the given entity.- Specified by:
saveFullToin interfaceEntityViewManager- Parameters:
entityManager- The entity manager to use for the saveview- The view to use for savingentity- The entity to apply data to
-
update
Deprecated.Description copied from interface:EntityViewManagerUpdates the entity which the given entity view maps to. Issues a partial update if enabled for the given view.- Specified by:
updatein interfaceEntityViewManager- Parameters:
entityManager- The entity manager to use for the updateview- The view to use for updating
-
updateFull
Deprecated.Description copied from interface:EntityViewManagerFully updates the entity which the given entity view maps to.- Specified by:
updateFullin interfaceEntityViewManager- Parameters:
entityManager- The entity manager to use for the updateview- The view to use for updating
-
saveWith
Description copied from interface:EntityViewManagerSaves the entity which the given entity view maps to. Issues a partial update if enabled for the given view.- Specified by:
saveWithin interfaceEntityViewManager- 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
-
saveFullWith
public FlushOperationBuilder saveFullWith(javax.persistence.EntityManager entityManager, Object view) Description copied from interface:EntityViewManagerFully saves the entity which the given entity view maps to.- Specified by:
saveFullWithin interfaceEntityViewManager- 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
-
saveWithTo
public FlushOperationBuilder saveWithTo(javax.persistence.EntityManager entityManager, Object view, Object entity) Description copied from interface:EntityViewManagerSaves the entity view state onto the given entity. Issues a partial update if enabled for the given view.- Specified by:
saveWithToin interfaceEntityViewManager- 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
-
saveFullWithTo
public FlushOperationBuilder saveFullWithTo(javax.persistence.EntityManager entityManager, Object view, Object entity) Description copied from interface:EntityViewManagerFully saves the entity view state onto the given entity.- Specified by:
saveFullWithToin interfaceEntityViewManager- 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
-
remove
Description copied from interface:EntityViewManagerRemoves the entity represented by the given view. Also cascades deletes to attributes that haveCascadeType.DELETEenabled.- Specified by:
removein interfaceEntityViewManager- Parameters:
entityManager- The entity manager to use for the removingview- The view for which the entity should be removed
-
removeWith
Description copied from interface:EntityViewManagerRemoves the entity represented by the given view. Also cascades deletes to attributes that haveCascadeType.DELETEenabled.- Specified by:
removeWithin interfaceEntityViewManager- 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
-
remove
public void remove(javax.persistence.EntityManager entityManager, Class<?> entityViewClass, Object viewId) Description copied from interface:EntityViewManagerRemoves the entity represented by the entity type defiend for the given view and the given entity id. Also cascades deletes to attributes that haveCascadeType.DELETEenabled.- Specified by:
removein interfaceEntityViewManager- Parameters:
entityManager- The entity manager to use for the removingentityViewClass- The entity view class to useviewId- The id of entity view
-
removeWith
public FlushOperationBuilder removeWith(javax.persistence.EntityManager entityManager, Class<?> entityViewClass, Object viewId) Description copied from interface:EntityViewManagerRemoves the entity represented by the entity type defiend for the given view and the given entity id. Also cascades deletes to attributes that haveCascadeType.DELETEenabled.- Specified by:
removeWithin interfaceEntityViewManager- 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
-
applySetting
public <T,Q extends FullQueryBuilder<T, Q applySettingQ>> (EntityViewSetting<T, Q> setting, CriteriaBuilder<?> criteriaBuilder) Description copied from interface:EntityViewManagerApplies the entity view setting to the given criteria builder.- Specified by:
applySettingin interfaceEntityViewManager- 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
public <T,Q extends FullQueryBuilder<T, Q applySettingQ>> (EntityViewSetting<T, Q> setting, CriteriaBuilder<?> criteriaBuilder, String entityViewRoot) Description copied from interface:EntityViewManagerApplies the entity view setting to the given entity view root of the criteria builder.- Specified by:
applySettingin interfaceEntityViewManager- 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
-
getService
- Specified by:
getServicein interfaceServiceProvider
-