Class AbstractCollectionMapper<T>
java.lang.Object
org.hibernate.envers.internal.entities.mapper.AbstractMapper
org.hibernate.envers.internal.entities.mapper.AbstractPropertyMapper
org.hibernate.envers.internal.entities.mapper.relation.AbstractCollectionMapper<T>
- All Implemented Interfaces:
DynamicComponentMapperSupport, ModifiedFlagMapperSupport, PropertyMapper
- Direct Known Subclasses:
BasicCollectionMapper, ListCollectionMapper, MapCollectionMapper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CommonCollectionMapperDataprotected final Configurationprotected final booleanprotected final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCollectionMapper(Configuration configuration, CommonCollectionMapperData commonCollectionMapperData, Class<? extends T> collectionClass, Class<? extends T> proxyClass, boolean ordinalInId, boolean revisionTypeInId) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCollectionChanges(org.hibernate.engine.spi.SharedSessionContractImplementor session, List<PersistentCollectionChangeData> collectionChanges, Set<Object> changed, RevisionType revisionType, Object id) buildCollectionChangeSet(Object eventCollection, Collection collection) createIdMap(int ordinal) Creates map for storing identifier data.protected abstract Initializor<T> getInitializor(EnversService enversService, AuditReaderImplementor versionsReader, Object primaryKey, Number revision, boolean removed) protected abstract CollectiongetNewCollectionContent(org.hibernate.collection.spi.PersistentCollection newCollection) protected abstract CollectiongetOldCollectionContent(Serializable oldCollection) booleanReturns whether the associatedPropertyMapperhas any properties that use thewitModifiedFlagfeature.protected booleanisSame(org.hibernate.persister.collection.CollectionPersister collectionPersister, Object oldObject, Object newObject) Checks whether the old collection element and new collection element are the same.mapCollectionChanges(org.hibernate.engine.spi.SharedSessionContractImplementor session, String referencingPropertyName, org.hibernate.collection.spi.PersistentCollection newColl, Serializable oldColl, Object id) Maps collection changes.protected abstract List<PersistentCollectionChangeData> mapCollectionChanges(org.hibernate.engine.spi.SharedSessionContractImplementor session, org.hibernate.collection.spi.PersistentCollection newColl, Serializable oldColl, Object id) Map collection changes using hash identity.voidmapModifiedFlagsToMapForCollectionChange(String collectionPropertyName, Map<String, Object> data) voidmapModifiedFlagsToMapFromEntity(org.hibernate.engine.spi.SharedSessionContractImplementor session, Map<String, Object> data, Object newObj, Object oldObj) voidmapToEntityFromMap(EnversService enversService, Object obj, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) Maps properties from the given map to the given object.mapToEntityFromMap(EnversService enversService, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) booleanmapToMapFromEntity(org.hibernate.engine.spi.SharedSessionContractImplementor session, Map<String, Object> data, Object newObj, Object oldObj) Maps properties to the given map, basing on differences between properties of new and old objects.protected abstract voidmapToMapFromObject(org.hibernate.engine.spi.SharedSessionContractImplementor session, Map<String, Object> idData, Map<String, Object> data, Object changed) Maps the changed collection element to the given map.protected org.hibernate.persister.collection.CollectionPersisterresolveCollectionPersister(org.hibernate.engine.spi.SharedSessionContractImplementor session, org.hibernate.collection.spi.PersistentCollection collection) Methods inherited from class AbstractPropertyMapper
isDynamicComponentMap, markAsDynamicComponentMapMethods inherited from class AbstractMapper
getAndSetValue, getValueFromObject, getValueFromObject, newObjectInstance, setValueOnObject
-
Field Details
-
configuration
-
commonCollectionMapperData
-
collectionClass
-
ordinalInId
protected final boolean ordinalInId -
revisionTypeInId
protected final boolean revisionTypeInId
-
-
Constructor Details
-
AbstractCollectionMapper
protected AbstractCollectionMapper(Configuration configuration, CommonCollectionMapperData commonCollectionMapperData, Class<? extends T> collectionClass, Class<? extends T> proxyClass, boolean ordinalInId, boolean revisionTypeInId)
-
-
Method Details
-
getNewCollectionContent
protected abstract Collection getNewCollectionContent(org.hibernate.collection.spi.PersistentCollection newCollection) -
getOldCollectionContent
-
buildCollectionChangeSet
protected abstract Set<Object> buildCollectionChangeSet(Object eventCollection, Collection collection) -
createIdMap
Creates map for storing identifier data. Ordinal parameter guarantees uniqueness of primary key. Composite primary key cannot contain embeddable properties since they might be nullable.- Parameters:
ordinal- Iteration ordinal.- Returns:
- Map for holding identifier data.
-
mapModifiedFlagsToMapForCollectionChange
-
getInitializor
protected abstract Initializor<T> getInitializor(EnversService enversService, AuditReaderImplementor versionsReader, Object primaryKey, Number revision, boolean removed) -
isSame
protected boolean isSame(org.hibernate.persister.collection.CollectionPersister collectionPersister, Object oldObject, Object newObject) Checks whether the old collection element and new collection element are the same. By default, this delegates to the collection persister'sCollectionPersister.getElementType().- Parameters:
collectionPersister- The collection persister.oldObject- The collection element from the old persistent collection.newObject- The collection element from the new persistent collection.- Returns:
- true if the two objects are the same, false otherwise.
-
mapToEntityFromMap
public void mapToEntityFromMap(EnversService enversService, Object obj, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) Description copied from interface:PropertyMapperMaps properties from the given map to the given object.- Parameters:
enversService- The EnversService.obj- Object to map to.data- Data to map from.primaryKey- Primary key of the object to which we map (for relations)versionsReader- VersionsReader for reading relationsrevision- Revision at which the object is read, for reading relations
-
mapToEntityFromMap
public Object mapToEntityFromMap(EnversService enversService, Map data, Object primaryKey, AuditReaderImplementor versionsReader, Number revision) -
hasPropertiesWithModifiedFlag
public boolean hasPropertiesWithModifiedFlag()Description copied from interface:ModifiedFlagMapperSupportReturns whether the associatedPropertyMapperhas any properties that use thewitModifiedFlagfeature.- Returns:
trueif a property useswithModifiedFlag, otherwisefalse.
-