Class MapAttributeFlusher<E,V extends Map<?,?>>
java.lang.Object
com.blazebit.persistence.view.impl.update.flush.AttributeFetchGraphNode<X>
com.blazebit.persistence.view.impl.update.flush.AbstractPluralAttributeFlusher<MapAttributeFlusher<E,V>,MapAction<?>,RecordingMap<?,?,?>,E,V>
com.blazebit.persistence.view.impl.update.flush.MapAttributeFlusher<E,V>
- All Implemented Interfaces:
DirtyChecker<V>
,MapDirtyChecker<V,Object,E>
,PluralDirtyChecker<V,E>
,DirtyAttributeFlusher<MapAttributeFlusher<E,V>,E,V>
,FetchGraphNode<MapAttributeFlusher<E,V>>
public class MapAttributeFlusher<E,V extends Map<?,?>> extends AbstractPluralAttributeFlusher<MapAttributeFlusher<E,V>,MapAction<?>,RecordingMap<?,?,?>,E,V> implements DirtyAttributeFlusher<MapAttributeFlusher<E,V>,E,V>, MapDirtyChecker<V,Object,E>
- Since:
- 1.2.0
- Author:
- Christian Beikov
-
Nested Class Summary
Nested classes/interfaces inherited from class com.blazebit.persistence.view.impl.update.flush.AbstractPluralAttributeFlusher
AbstractPluralAttributeFlusher.DeepEqualityChecker, AbstractPluralAttributeFlusher.EntityIdWithViewIdEqualityChecker, AbstractPluralAttributeFlusher.EntityWithViewEqualityChecker, AbstractPluralAttributeFlusher.EntryState, AbstractPluralAttributeFlusher.EqualityChecker, AbstractPluralAttributeFlusher.EqualsEqualityChecker, AbstractPluralAttributeFlusher.IdentityEqualityChecker, AbstractPluralAttributeFlusher.PluralFlushOperation
Nested classes/interfaces inherited from interface com.blazebit.persistence.view.impl.change.DirtyChecker
DirtyChecker.DirtyKind
-
Field Summary
Fields inherited from class com.blazebit.persistence.view.impl.update.flush.AbstractPluralAttributeFlusher
cascadeDeleteListener, collectionActions, collectionUpdatable, elementDescriptor, elementDirtyChecker, elementEqualityChecker, elementFlusher, elementFlushers, entityAttributeAccessor, flushOperation, flushStrategy, jpaProviderDeletesCollection, optimisticLockProtected, ownerEntityClass, ownerIdAttributeName, ownerIdBindFragments, ownerIdFlusher, ownerIdWhereFragment, ownerMapping, removeListener, replaceWithReferenceContents, supportsCollectionDml, viewAttributeAccessor, viewOnlyDeleteCascaded
Fields inherited from class com.blazebit.persistence.view.impl.update.flush.AttributeFetchGraphNode
attributeName, fetch, mapping
-
Constructor Summary
Constructors Modifier Constructor Description protected
MapAttributeFlusher(MapAttributeFlusher original, boolean fetch)
protected
MapAttributeFlusher(MapAttributeFlusher original, boolean fetch, AbstractPluralAttributeFlusher.PluralFlushOperation flushOperation, List<? extends MapAction<?>> collectionActions, List<CollectionElementAttributeFlusher<E,V>> elementFlushers)
MapAttributeFlusher(String attributeName, String mapping, Class<?> ownerEntityClass, String ownerIdAttributeName, String ownerMapping, DirtyAttributeFlusher<?,?,?> ownerIdFlusher, DirtyAttributeFlusher<?,?,?> elementFlusher, boolean supportsCollectionDml, FlushStrategy flushStrategy, AttributeAccessor attributeMapper, InitialValueAttributeAccessor viewAttributeAccessor, boolean optimisticLockProtected, boolean collectionUpdatable, CollectionRemoveListener keyCascadeDeleteListener, CollectionRemoveListener elementCascadeDeleteListener, CollectionRemoveListener keyRemoveListener, CollectionRemoveListener elementRemoveListener, boolean viewOnlyDeleteCascaded, boolean jpaProviderDeletesCollection, TypeDescriptor keyDescriptor, TypeDescriptor elementDescriptor, MapViewToEntityMapper mapper, MapViewToEntityMapper loadOnlyMapper, MapInstantiatorImplementor<?,?> mapInstantiator)
-
Method Summary
Modifier and Type Method Description protected void
addElements(UpdateContext context, Object ownerView, Object view, Map<Object,Object> removedAllObjects, boolean flushAtOnce, V value, Map<Object,Object> embeddablesToUpdate, FusedMapActions fusedCollectionActions, boolean initialKnown)
protected void
addFlatViewElementFlushActions(UpdateContext context, TypeDescriptor typeDescriptor, List<MapAction<?>> actions, V current)
protected Map<Object,Object>
appendRemoveSpecific(UpdateContext context, DeleteCriteriaBuilder<?> deleteCb, FusedMapActions fusedCollectionActions)
protected boolean
canFlushSeparateCollectionOperations()
V
cloneDeep(Object view, V oldValue, V newValue)
protected boolean
collectionEquals(V initial, V current)
protected DeleteCriteriaBuilder<?>
createCollectionDeleter(UpdateContext context)
protected V
createJpaCollection()
protected V
createJpaMap(int size)
protected V
createMap(int size)
protected CollectionElementAttributeFlusher<E,V>
createMergeFlusher(TypeDescriptor typeDescriptor, Object element)
protected CollectionElementAttributeFlusher<E,V>
createPersistFlusher(TypeDescriptor typeDescriptor, Object element)
protected RecordingMap<?,?,?>
createRecordingMap(int size)
protected boolean
deleteElements(UpdateContext context, Object ownerView, Object view, V value, boolean removeSpecific, FusedMapActions fusedCollectionActions, boolean deleteAll)
protected List<MapAction<Map<Object,Object>>>
determineCollectionActions(UpdateContext context, V initial, V current, AbstractPluralAttributeFlusher.EqualityChecker equalityChecker)
protected DirtyAttributeFlusher<MapAttributeFlusher<E,V>,E,V>
determineDirtyFlusherForNewCollection(UpdateContext context, V initial, V current)
protected List<MapAction<Map<Object,Object>>>
determineJpaCollectionActions(UpdateContext context, V initial, V current, AbstractPluralAttributeFlusher.EqualityChecker equalityChecker)
protected void
flushCollectionOperations(UpdateContext context, Object ownerView, Object view, V initial, V value, Map<Object,Object> embeddablesToUpdate, FusedMapActions fusedCollectionActions, boolean initialKnown)
boolean
flushEntity(UpdateContext context, E entity, Object ownerView, Object view, V value, Runnable postReplaceListener)
javax.persistence.Query
flushQuery(UpdateContext context, String parameterPrefix, UpdateQueryFactory queryFactory, javax.persistence.Query query, Object ownerView, Object view, V current, UnmappedOwnerAwareDeleter ownerAwareDeleter, DirtyAttributeFlusher<?,?,?> ownerFlusher)
DirtyAttributeFlusher<MapAttributeFlusher<E,V>,E,V>
getDirtyFlusher(UpdateContext context, Object view, Object initial, Object current)
protected DirtyAttributeFlusher<MapAttributeFlusher<E,V>,E,V>
getDirtyFlusherForRecordingCollection(UpdateContext context, V initial, RecordingMap<?,?,?> collection)
DirtyChecker.DirtyKind
getDirtyKind(V initial, V current)
Returns the dirty kind of the objects.DirtyChecker<E>
getElementDirtyChecker(E element)
protected List<CollectionElementAttributeFlusher<E,V>>
getElementFlushers(UpdateContext context, V current, List<? extends MapAction<?>> actions)
protected FusedMapActions
getFusedOperations(List<? extends MapAction<?>> collectionActions)
DirtyChecker<Object>
getKeyDirtyChecker(Object element)
<X> DirtyChecker<X>[]
getNestedCheckers(V current)
Object
getNewInitialValue(UpdateContext context, V clonedValue, V currentValue)
protected void
invokeCollectionAction(UpdateContext context, Object ownerView, Object view, V targetCollection, Object value, List<? extends MapAction<?>> collectionActions)
protected boolean
isIndexed()
boolean
isPassThrough()
boolean
isViewOnlyDeleteCascaded()
protected boolean
mergeCollectionElements(UpdateContext context, Object ownerView, Object view, E entity, V value)
protected MapAttributeFlusher<E,V>
partialFlusher(boolean fetch, AbstractPluralAttributeFlusher.PluralFlushOperation operation, List<? extends MapAction<?>> collectionActions, List<CollectionElementAttributeFlusher<E,V>> elementFlushers)
protected <X> X
persistOrMergeKey(UpdateContext context, javax.persistence.EntityManager em, X object)
List<PostFlushDeleter>
remove(UpdateContext context, E entity, Object view, V value)
void
remove(UpdateContext context, Object id)
List<PostFlushDeleter>
removeByOwnerId(UpdateContext context, Object id)
void
removeFromEntity(UpdateContext context, E entity)
protected List<MapAction<Map<Object,Object>>>
replaceActions(V value)
protected void
replaceCollection(UpdateContext context, Object ownerView, Object view, E entity, V value, FlushStrategy flushStrategy)
protected V
replaceWithRecordingCollection(UpdateContext context, Object view, V value, List<? extends MapAction<?>> actions)
boolean
requiresDeleteCascadeAfterRemove()
Methods inherited from class com.blazebit.persistence.view.impl.update.flush.AbstractPluralAttributeFlusher
appendUpdateQueryFragment, determineElementFlushers, getElementIdAttributeName, getElementOnlyFlusher, getEntityAttributeAccessor, getEntityAttributeValue, getLockOwner, getMapping, getNestedGraphNode, getReplaceOrMergeAndElementFlusher, getReplaceOrMergeOnlyFlusher, getReplayAndElementFlusher, getReplayOnlyFlusher, getViewAttributeAccessor, getViewElement, identityContains, invokeFlushOperation, isOptimisticLockProtected, loadForEntityFlush, persistIfNeeded, persistOrMerge, persistOrMerge, requiresDeferredFlush, requiresFlushAfterPersist, supportsQueryFlush
Methods inherited from class com.blazebit.persistence.view.impl.update.flush.AttributeFetchGraphNode
appendFetchJoinQueryFragment, getAttributeName, mergeWith
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.blazebit.persistence.view.impl.update.flush.DirtyAttributeFlusher
appendFetchJoinQueryFragment, appendUpdateQueryFragment, getElementIdAttributeName, getEntityAttributeAccessor, getLockOwner, getViewAttributeAccessor, isOptimisticLockProtected, loadForEntityFlush, requiresDeferredFlush, requiresFlushAfterPersist, supportsQueryFlush
Methods inherited from interface com.blazebit.persistence.view.impl.update.flush.FetchGraphNode
getAttributeName, getMapping, mergeWith
-
Constructor Details
-
MapAttributeFlusher
public MapAttributeFlusher(String attributeName, String mapping, Class<?> ownerEntityClass, String ownerIdAttributeName, String ownerMapping, DirtyAttributeFlusher<?,?,?> ownerIdFlusher, DirtyAttributeFlusher<?,?,?> elementFlusher, boolean supportsCollectionDml, FlushStrategy flushStrategy, AttributeAccessor attributeMapper, InitialValueAttributeAccessor viewAttributeAccessor, boolean optimisticLockProtected, boolean collectionUpdatable, CollectionRemoveListener keyCascadeDeleteListener, CollectionRemoveListener elementCascadeDeleteListener, CollectionRemoveListener keyRemoveListener, CollectionRemoveListener elementRemoveListener, boolean viewOnlyDeleteCascaded, boolean jpaProviderDeletesCollection, TypeDescriptor keyDescriptor, TypeDescriptor elementDescriptor, MapViewToEntityMapper mapper, MapViewToEntityMapper loadOnlyMapper, MapInstantiatorImplementor<?,?> mapInstantiator) -
MapAttributeFlusher
-
MapAttributeFlusher
protected MapAttributeFlusher(MapAttributeFlusher original, boolean fetch, AbstractPluralAttributeFlusher.PluralFlushOperation flushOperation, List<? extends MapAction<?>> collectionActions, List<CollectionElementAttributeFlusher<E,V>> elementFlushers)
-
-
Method Details
-
createMap
-
createJpaMap
-
createJpaCollection
- Specified by:
createJpaCollection
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
createRecordingMap
-
cloneDeep
- Specified by:
cloneDeep
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
getNewInitialValue
- Specified by:
getNewInitialValue
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
isPassThrough
public boolean isPassThrough()- Specified by:
isPassThrough
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
- Overrides:
isPassThrough
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
isIndexed
protected boolean isIndexed()- Specified by:
isIndexed
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
addFlatViewElementFlushActions
protected void addFlatViewElementFlushActions(UpdateContext context, TypeDescriptor typeDescriptor, List<MapAction<?>> actions, V current)- Specified by:
addFlatViewElementFlushActions
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
invokeCollectionAction
protected void invokeCollectionAction(UpdateContext context, Object ownerView, Object view, V targetCollection, Object value, List<? extends MapAction<?>> collectionActions)- Specified by:
invokeCollectionAction
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
replaceWithRecordingCollection
protected V replaceWithRecordingCollection(UpdateContext context, Object view, V value, List<? extends MapAction<?>> actions)- Specified by:
replaceWithRecordingCollection
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
flushQuery
public javax.persistence.Query flushQuery(UpdateContext context, String parameterPrefix, UpdateQueryFactory queryFactory, javax.persistence.Query query, Object ownerView, Object view, V current, UnmappedOwnerAwareDeleter ownerAwareDeleter, DirtyAttributeFlusher<?,?,?> ownerFlusher)- Specified by:
flushQuery
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
- Overrides:
flushQuery
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
createCollectionDeleter
-
appendRemoveSpecific
protected Map<Object,Object> appendRemoveSpecific(UpdateContext context, DeleteCriteriaBuilder<?> deleteCb, FusedMapActions fusedCollectionActions) -
deleteElements
protected boolean deleteElements(UpdateContext context, Object ownerView, Object view, V value, boolean removeSpecific, FusedMapActions fusedCollectionActions, boolean deleteAll) -
addElements
-
flushCollectionOperations
protected void flushCollectionOperations(UpdateContext context, Object ownerView, Object view, V initial, V value, Map<Object,Object> embeddablesToUpdate, FusedMapActions fusedCollectionActions, boolean initialKnown) -
flushEntity
public boolean flushEntity(UpdateContext context, E entity, Object ownerView, Object view, V value, Runnable postReplaceListener)- Specified by:
flushEntity
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
replaceActions
-
remove
- Specified by:
remove
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
removeByOwnerId
- Specified by:
removeByOwnerId
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
remove
- Specified by:
remove
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
removeFromEntity
- Specified by:
removeFromEntity
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
canFlushSeparateCollectionOperations
protected boolean canFlushSeparateCollectionOperations()- Specified by:
canFlushSeparateCollectionOperations
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
requiresDeleteCascadeAfterRemove
public boolean requiresDeleteCascadeAfterRemove()- Specified by:
requiresDeleteCascadeAfterRemove
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
isViewOnlyDeleteCascaded
public boolean isViewOnlyDeleteCascaded()- Specified by:
isViewOnlyDeleteCascaded
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
persistOrMergeKey
protected final <X> X persistOrMergeKey(UpdateContext context, javax.persistence.EntityManager em, X object) -
mergeCollectionElements
protected boolean mergeCollectionElements(UpdateContext context, Object ownerView, Object view, E entity, V value)- Specified by:
mergeCollectionElements
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
replaceCollection
protected void replaceCollection(UpdateContext context, Object ownerView, Object view, E entity, V value, FlushStrategy flushStrategy)- Specified by:
replaceCollection
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
getNestedCheckers
- Specified by:
getNestedCheckers
in interfaceDirtyChecker<E>
-
getDirtyKind
Description copied from interface:DirtyChecker
Returns the dirty kind of the objects.- Specified by:
getDirtyKind
in interfaceDirtyChecker<E>
- Returns:
- The dirty kind
-
getElementDirtyChecker
- Specified by:
getElementDirtyChecker
in interfacePluralDirtyChecker<E,V extends Map<?,?>>
-
getKeyDirtyChecker
- Specified by:
getKeyDirtyChecker
in interfaceMapDirtyChecker<V extends Map<?,?>,Object,E>
-
getDirtyFlusher
public DirtyAttributeFlusher<MapAttributeFlusher<E,V>,E,V> getDirtyFlusher(UpdateContext context, Object view, Object initial, Object current)- Specified by:
getDirtyFlusher
in interfaceDirtyAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,E,V extends Map<?,?>>
-
determineDirtyFlusherForNewCollection
protected DirtyAttributeFlusher<MapAttributeFlusher<E,V>,E,V> determineDirtyFlusherForNewCollection(UpdateContext context, V initial, V current) -
determineJpaCollectionActions
protected List<MapAction<Map<Object,Object>>> determineJpaCollectionActions(UpdateContext context, V initial, V current, AbstractPluralAttributeFlusher.EqualityChecker equalityChecker) -
determineCollectionActions
protected List<MapAction<Map<Object,Object>>> determineCollectionActions(UpdateContext context, V initial, V current, AbstractPluralAttributeFlusher.EqualityChecker equalityChecker) -
createPersistFlusher
protected CollectionElementAttributeFlusher<E,V> createPersistFlusher(TypeDescriptor typeDescriptor, Object element)- Specified by:
createPersistFlusher
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
createMergeFlusher
protected CollectionElementAttributeFlusher<E,V> createMergeFlusher(TypeDescriptor typeDescriptor, Object element)- Specified by:
createMergeFlusher
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
getElementFlushers
protected List<CollectionElementAttributeFlusher<E,V>> getElementFlushers(UpdateContext context, V current, List<? extends MapAction<?>> actions)- Specified by:
getElementFlushers
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
partialFlusher
protected MapAttributeFlusher<E,V> partialFlusher(boolean fetch, AbstractPluralAttributeFlusher.PluralFlushOperation operation, List<? extends MapAction<?>> collectionActions, List<CollectionElementAttributeFlusher<E,V>> elementFlushers)- Specified by:
partialFlusher
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
collectionEquals
- Specified by:
collectionEquals
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
getDirtyFlusherForRecordingCollection
protected DirtyAttributeFlusher<MapAttributeFlusher<E,V>,E,V> getDirtyFlusherForRecordingCollection(UpdateContext context, V initial, RecordingMap<?,?,?> collection)- Specified by:
getDirtyFlusherForRecordingCollection
in classAbstractPluralAttributeFlusher<MapAttributeFlusher<E,V extends Map<?,?>>,MapAction<?>,RecordingMap<?,?,?>,E,V extends Map<?,?>>
-
getFusedOperations
-