Interface AuditStrategy
-
- All Known Subinterfaces:
AuditStrategy
- All Known Implementing Classes:
DefaultAuditStrategy,org.hibernate.envers.strategy.internal.DefaultAuditStrategy,org.hibernate.envers.strategy.internal.ValidityAuditStrategy,ValidityAuditStrategy
public interface AuditStrategyA strategy abstraction for how to audit entity changes.- Since:
- 5.4
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidaddAdditionalColumns(MappingContext mappingContext)Add additional columns to the audit mappings.voidaddAssociationAtRevisionRestriction(org.hibernate.envers.internal.tools.query.QueryBuilder rootQueryBuilder, org.hibernate.envers.internal.tools.query.Parameters parameters, java.lang.String revisionProperty, java.lang.String revisionEndProperty, boolean addAlias, org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData referencingIdData, java.lang.String versionsMiddleEntityName, java.lang.String eeOriginalIdPropertyPath, java.lang.String revisionPropertyPath, java.lang.String originalIdPropertyName, java.lang.String alias1, boolean inclusive, org.hibernate.envers.internal.entities.mapper.relation.MiddleComponentData... componentDatas)Update the rootQueryBuilder with an extra WHERE clause to restrict the revision for a middle-entity association.voidaddEntityAtRevisionRestriction(org.hibernate.envers.configuration.internal.GlobalConfiguration globalCfg, org.hibernate.envers.internal.tools.query.QueryBuilder rootQueryBuilder, org.hibernate.envers.internal.tools.query.Parameters parameters, java.lang.String revisionProperty, java.lang.String revisionEndProperty, boolean addAlias, org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData idData, java.lang.String revisionPropertyPath, java.lang.String originalIdPropertyName, java.lang.String alias1, java.lang.String alias2, boolean inclusive)Update the rootQueryBuilder with an extra WHERE clause to restrict the revision for a two-entity relation.voidperform(Session session, java.lang.String entityName, org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration auditEntitiesConfiguration, java.io.Serializable id, java.lang.Object data, java.lang.Object revision)Perform the persistence of audited data for regular entities.voidperformCollectionChange(Session session, java.lang.String entityName, java.lang.String propertyName, org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration auditEntitiesConfiguration, org.hibernate.envers.internal.entities.mapper.PersistentCollectionChangeData persistentCollectionChangeData, java.lang.Object revision)Perform the persistence of audited data for collection ("middle") entities.default voidpostInitialize(java.lang.Class<?> revisionInfoClass, org.hibernate.envers.internal.entities.PropertyData timestampData, ServiceRegistry serviceRegistry)Performs post initialization of the audit strategy implementation.
-
-
-
Method Detail
-
addAdditionalColumns
default void addAdditionalColumns(MappingContext mappingContext)
Add additional columns to the audit mappings.- Parameters:
mappingContext- The mapping context.
-
postInitialize
default void postInitialize(java.lang.Class<?> revisionInfoClass, org.hibernate.envers.internal.entities.PropertyData timestampData, ServiceRegistry serviceRegistry)Performs post initialization of the audit strategy implementation.- Parameters:
revisionInfoClass- The revision entity class.timestampData- The timestamp property data on the revision entity class.serviceRegistry- The service registry.
-
perform
void perform(Session session, java.lang.String entityName, org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration auditEntitiesConfiguration, java.io.Serializable id, java.lang.Object data, java.lang.Object revision)
Perform the persistence of audited data for regular entities.- Parameters:
session- Session, which can be used to persist the data.entityName- Name of the entity, in which the audited change happensauditEntitiesConfiguration- The audit entity configuration.id- Id of the entity.data- Audit data to persist.revision- Current revision data.
-
performCollectionChange
void performCollectionChange(Session session, java.lang.String entityName, java.lang.String propertyName, org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration auditEntitiesConfiguration, org.hibernate.envers.internal.entities.mapper.PersistentCollectionChangeData persistentCollectionChangeData, java.lang.Object revision)
Perform the persistence of audited data for collection ("middle") entities.- Parameters:
session- Session, which can be used to persist the data.entityName- Name of the entity, in which the audited change happens.propertyName- The name of the property holding the persistent collectionauditEntitiesConfiguration- audit entity configurationpersistentCollectionChangeData- Collection change data to be persisted.revision- Current revision data
-
addEntityAtRevisionRestriction
void addEntityAtRevisionRestriction(org.hibernate.envers.configuration.internal.GlobalConfiguration globalCfg, org.hibernate.envers.internal.tools.query.QueryBuilder rootQueryBuilder, org.hibernate.envers.internal.tools.query.Parameters parameters, java.lang.String revisionProperty, java.lang.String revisionEndProperty, boolean addAlias, org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData idData, java.lang.String revisionPropertyPath, java.lang.String originalIdPropertyName, java.lang.String alias1, java.lang.String alias2, boolean inclusive)Update the rootQueryBuilder with an extra WHERE clause to restrict the revision for a two-entity relation. This WHERE clause depends on the AuditStrategy.- Parameters:
globalCfg- theGlobalConfigurationrootQueryBuilder- theQueryBuilderthat will be updatedparameters- root parameters to which restrictions shall be addedrevisionProperty- property of the revision columnrevisionEndProperty- property of the revisionEnd column (only used forValidityAuditStrategy)addAlias-booleanindicator if a left alias is neededidData- id-information for the two-entity relation (only used forDefaultAuditStrategy)revisionPropertyPath- path of the revision property (only used forValidityAuditStrategy)originalIdPropertyName- name of the id property (only used forValidityAuditStrategy)alias1- an alias used for subquery (only used forValidityAuditStrategy)alias2- an alias used for subquery (only used forValidityAuditStrategy)inclusive- indicates whether revision number shall be treated as inclusive or exclusive
-
addAssociationAtRevisionRestriction
void addAssociationAtRevisionRestriction(org.hibernate.envers.internal.tools.query.QueryBuilder rootQueryBuilder, org.hibernate.envers.internal.tools.query.Parameters parameters, java.lang.String revisionProperty, java.lang.String revisionEndProperty, boolean addAlias, org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData referencingIdData, java.lang.String versionsMiddleEntityName, java.lang.String eeOriginalIdPropertyPath, java.lang.String revisionPropertyPath, java.lang.String originalIdPropertyName, java.lang.String alias1, boolean inclusive, org.hibernate.envers.internal.entities.mapper.relation.MiddleComponentData... componentDatas)Update the rootQueryBuilder with an extra WHERE clause to restrict the revision for a middle-entity association. This WHERE clause depends on the AuditStrategy.- Parameters:
rootQueryBuilder- theQueryBuilderthat will be updatedparameters- root parameters to which restrictions shall be addedrevisionProperty- property of the revision columnrevisionEndProperty- property of the revisionEnd column (only used forValidityAuditStrategy)addAlias-booleanindicator if a left alias is neededreferencingIdData- id-information for the middle-entity association (only used forDefaultAuditStrategy)versionsMiddleEntityName- name of the middle-entityeeOriginalIdPropertyPath- name of the id property (only used forValidityAuditStrategy)revisionPropertyPath- path of the revision property (only used forValidityAuditStrategy)originalIdPropertyName- name of the id property (only used forValidityAuditStrategy)alias1- an alias used for subqueries (only used forDefaultAuditStrategy)inclusive- indicates whether revision number shall be treated as inclusive or exclusivecomponentDatas- information about the middle-entity relation
-
-