From 85388ec48f396201fe8afe9e304bb0c4dd2e159c Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Thu, 25 Nov 2021 18:14:08 -0500 Subject: [PATCH] HHH-11469 Remove deprecated ModificationStore --- .../java/org/hibernate/envers/Audited.java | 7 ---- .../hibernate/envers/ModificationStore.java | 17 ---------- .../internal/RevisionInfoConfiguration.java | 2 +- .../AbstractCollectionMetadataGenerator.java | 2 -- .../metadata/IdMetadataGenerator.java | 5 +-- ...JoinColumnCollectionMetadataGenerator.java | 2 +- .../reader/AnnotationsMetadataReader.java | 11 +++---- .../reader/AuditedPropertiesReader.java | 15 +-------- .../ComponentAuditedPropertiesReader.java | 10 +----- .../metadata/reader/PropertyAuditingData.java | 25 --------------- .../internal/entities/PropertyData.java | 32 ++++--------------- 11 files changed, 16 insertions(+), 112 deletions(-) delete mode 100644 hibernate-envers/src/main/java/org/hibernate/envers/ModificationStore.java diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/Audited.java b/hibernate-envers/src/main/java/org/hibernate/envers/Audited.java index 80798ba0a3..a4e50469f4 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/Audited.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/Audited.java @@ -23,13 +23,6 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) public @interface Audited { - /** - * Specifies modification store to use - * @deprecated since 5.2, to be removed in 6.0 with no replacement. - */ - @Deprecated - ModificationStore modStore() default ModificationStore.FULL; - /** * Specifies if the entity that is the target of the relation should be audited or not. If not, then when * reading a historic version an audited entity, the relation will always point to the "current" entity. diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/ModificationStore.java b/hibernate-envers/src/main/java/org/hibernate/envers/ModificationStore.java deleted file mode 100644 index a3062ededc..0000000000 --- a/hibernate-envers/src/main/java/org/hibernate/envers/ModificationStore.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.envers; - - -/** - * @author Adam Warski (adam at warski dot org) - * @deprecated since 5.2, to be removed in 6.0 with no replacement. - */ -@Deprecated -public enum ModificationStore { - FULL -} diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/RevisionInfoConfiguration.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/RevisionInfoConfiguration.java index 6af8162381..9ecf4f7558 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/RevisionInfoConfiguration.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/RevisionInfoConfiguration.java @@ -496,7 +496,7 @@ public class RevisionInfoConfiguration { } private PropertyData createPropertyData(String name, String accessType) { - return new PropertyData( name, name, accessType, null ); + return new PropertyData( name, name, accessType ); } private boolean isAnyType(XClass clazz, Class... types) { diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AbstractCollectionMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AbstractCollectionMetadataGenerator.java index a0a8e3637d..1080540493 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AbstractCollectionMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AbstractCollectionMetadataGenerator.java @@ -18,7 +18,6 @@ import java.util.TreeSet; import jakarta.persistence.EnumType; -import org.hibernate.envers.ModificationStore; import org.hibernate.envers.boot.model.Attribute; import org.hibernate.envers.boot.model.AttributeContainer; import org.hibernate.envers.boot.model.BasicAttribute; @@ -326,7 +325,6 @@ public abstract class AbstractCollectionMetadataGenerator extends AbstractMetada new ComponentAuditedPropertiesReader( getMetadataBuildingContext(), - ModificationStore.FULL, PersistentPropertiesSource.forComponent( getMetadataBuildingContext(), component ), auditData ).read(); diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/IdMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/IdMetadataGenerator.java index 260656db19..05b2e0ef59 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/IdMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/IdMetadataGenerator.java @@ -9,8 +9,6 @@ package org.hibernate.envers.configuration.internal.metadata; import java.util.Iterator; import java.util.Locale; -import org.hibernate.envers.ModificationStore; -import org.hibernate.envers.RelationTargetAuditMode; import org.hibernate.envers.boot.EnversMappingException; import org.hibernate.envers.boot.model.AttributeContainer; import org.hibernate.envers.boot.model.CompositeIdentifier; @@ -259,8 +257,7 @@ public final class IdMetadataGenerator extends AbstractMetadataGenerator { return new PropertyData( property.getName(), property.getName(), - property.getPropertyAccessorName(), - ModificationStore.FULL + property.getPropertyAccessorName() ); } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/JoinColumnCollectionMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/JoinColumnCollectionMetadataGenerator.java index 10d5dad8d2..a0cc2b7426 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/JoinColumnCollectionMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/JoinColumnCollectionMetadataGenerator.java @@ -181,7 +181,7 @@ public class JoinColumnCollectionMetadataGenerator extends AbstractCollectionMet relMapper, // The mapper will only be used to map from entity to map, so no need to provide other details // when constructing the PropertyData. - new PropertyData( auditMappedBy, null, null, null ), + new PropertyData( auditMappedBy, null, null ), entityName, false, false diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AnnotationsMetadataReader.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AnnotationsMetadataReader.java index df444027ec..838557517a 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AnnotationsMetadataReader.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AnnotationsMetadataReader.java @@ -11,7 +11,7 @@ import java.lang.annotation.Annotation; import org.hibernate.annotations.common.reflection.XClass; import org.hibernate.envers.AuditTable; import org.hibernate.envers.Audited; -import org.hibernate.envers.ModificationStore; +import org.hibernate.envers.RelationTargetAuditMode; import org.hibernate.envers.SecondaryAuditTable; import org.hibernate.envers.SecondaryAuditTables; import org.hibernate.envers.boot.spi.EnversMetadataBuildingContext; @@ -31,11 +31,11 @@ public final class AnnotationsMetadataReader { this.metadataBuildingContext = metadataBuildingContext; } - private ModificationStore getDefaultAudited(XClass clazz) { + private RelationTargetAuditMode getDefaultAudited(XClass clazz) { final Audited defaultAudited = clazz.getAnnotation( Audited.class ); if ( defaultAudited != null ) { - return defaultAudited.modStore(); + return defaultAudited.targetAuditMode(); } else { return null; @@ -77,14 +77,13 @@ public final class AnnotationsMetadataReader { final ClassAuditingData auditData = new ClassAuditingData( persistentClass ); final XClass xclass = metadataBuildingContext.getReflectionManager().toXClass( persistentClass.getMappedClass() ); - final ModificationStore defaultStore = getDefaultAudited( xclass ); - if ( defaultStore != null ) { + final RelationTargetAuditMode auditMode = getDefaultAudited( xclass ); + if ( auditMode != null ) { auditData.setDefaultAudited( true ); } new AuditedPropertiesReader( metadataBuildingContext, - defaultStore, PersistentPropertiesSource.forClass( persistentClass, xclass ), auditData ).read(); diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AuditedPropertiesReader.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AuditedPropertiesReader.java index 1f752c74c0..b2ee488109 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AuditedPropertiesReader.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/AuditedPropertiesReader.java @@ -32,7 +32,6 @@ import org.hibernate.envers.AuditMappedBy; import org.hibernate.envers.AuditOverride; import org.hibernate.envers.AuditOverrides; import org.hibernate.envers.Audited; -import org.hibernate.envers.ModificationStore; import org.hibernate.envers.NotAudited; import org.hibernate.envers.RelationTargetAuditMode; import org.hibernate.envers.boot.EnversMappingException; @@ -68,7 +67,6 @@ public class AuditedPropertiesReader { public static final String NO_PREFIX = ""; - protected final ModificationStore defaultStore; private final PersistentPropertiesSource persistentPropertiesSource; private final AuditedPropertiesHolder auditedPropertiesHolder; private final EnversMetadataBuildingContext metadataBuildingContext; @@ -88,19 +86,16 @@ public class AuditedPropertiesReader { public AuditedPropertiesReader( EnversMetadataBuildingContext metadataBuildingContext, - ModificationStore defaultStore, PersistentPropertiesSource persistentPropertiesSource, AuditedPropertiesHolder auditedPropertiesHolder) { - this ( metadataBuildingContext, defaultStore, persistentPropertiesSource, auditedPropertiesHolder, NO_PREFIX ); + this ( metadataBuildingContext, persistentPropertiesSource, auditedPropertiesHolder, NO_PREFIX ); } public AuditedPropertiesReader( EnversMetadataBuildingContext metadataBuildingContext, - ModificationStore defaultStore, PersistentPropertiesSource persistentPropertiesSource, AuditedPropertiesHolder auditedPropertiesHolder, String propertyNamePrefix) { - this.defaultStore = defaultStore; this.persistentPropertiesSource = persistentPropertiesSource; this.auditedPropertiesHolder = auditedPropertiesHolder; this.metadataBuildingContext = metadataBuildingContext; @@ -441,7 +436,6 @@ public class AuditedPropertiesReader { ); final AuditedPropertiesReader audPropReader = new AuditedPropertiesReader( metadataBuildingContext, - ModificationStore.FULL, componentPropertiesSource, componentData, propertyNamePrefix + MappingTools.createComponentPrefix( embeddedName ) @@ -471,7 +465,6 @@ public class AuditedPropertiesReader { final ComponentAuditedPropertiesReader audPropReader = new ComponentAuditedPropertiesReader( metadataBuildingContext, - ModificationStore.FULL, componentPropertiesSource, componentData, propertyNamePrefix + MappingTools.createComponentPrefix( property.getName() ) @@ -596,7 +589,6 @@ public class AuditedPropertiesReader { aud = DEFAULT_AUDITED; } if ( aud != null ) { - propertyData.setStore( aud.modStore() ); propertyData.setRelationTargetAuditMode( aud.targetAuditMode() ); propertyData.setUsingModifiedFlag( checkUsingModifiedFlag( aud ) ); propertyData.setModifiedFlagName( ModifiedColumnNameResolver.getName( propertyName, modifiedFlagSuffix ) ); @@ -724,11 +716,6 @@ public class AuditedPropertiesReader { } private static final Audited DEFAULT_AUDITED = new Audited() { - @Override - public ModificationStore modStore() { - return ModificationStore.FULL; - } - @Override public RelationTargetAuditMode targetAuditMode() { return RelationTargetAuditMode.AUDITED; diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/ComponentAuditedPropertiesReader.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/ComponentAuditedPropertiesReader.java index d1f7748ea0..55bb1b3bf4 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/ComponentAuditedPropertiesReader.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/ComponentAuditedPropertiesReader.java @@ -8,7 +8,6 @@ package org.hibernate.envers.configuration.internal.metadata.reader; import org.hibernate.annotations.common.reflection.XProperty; import org.hibernate.envers.Audited; -import org.hibernate.envers.ModificationStore; import org.hibernate.envers.boot.internal.ModifiedColumnNameResolver; import org.hibernate.envers.boot.spi.EnversMetadataBuildingContext; import org.hibernate.internal.util.StringHelper; @@ -24,21 +23,18 @@ public class ComponentAuditedPropertiesReader extends AuditedPropertiesReader { public ComponentAuditedPropertiesReader( EnversMetadataBuildingContext metadataBuildingContext, - ModificationStore defaultStore, PersistentPropertiesSource persistentPropertiesSource, AuditedPropertiesHolder auditedPropertiesHolder) { - this( metadataBuildingContext, defaultStore, persistentPropertiesSource, auditedPropertiesHolder, NO_PREFIX ); + this( metadataBuildingContext, persistentPropertiesSource, auditedPropertiesHolder, NO_PREFIX ); } public ComponentAuditedPropertiesReader( EnversMetadataBuildingContext metadataBuildingContext, - ModificationStore defaultStore, PersistentPropertiesSource persistentPropertiesSource, AuditedPropertiesHolder auditedPropertiesHolder, String propertyNamePrefix) { super( metadataBuildingContext, - defaultStore, persistentPropertiesSource, auditedPropertiesHolder, propertyNamePrefix @@ -55,7 +51,6 @@ public class ComponentAuditedPropertiesReader extends AuditedPropertiesReader { // Checking if this property is explicitly audited or if all properties are. final Audited aud = property.getAnnotation( Audited.class ); if ( aud != null ) { - propertyData.setStore( aud.modStore() ); propertyData.setRelationTargetAuditMode( aud.targetAuditMode() ); propertyData.setUsingModifiedFlag( checkUsingModifiedFlag( aud ) ); propertyData.setModifiedFlagName( ModifiedColumnNameResolver.getName( propertyName, modifiedFlagSuffix ) ); @@ -63,9 +58,6 @@ public class ComponentAuditedPropertiesReader extends AuditedPropertiesReader { propertyData.setExplicitModifiedFlagName( aud.modifiedColumnName() ); } } - else { - propertyData.setStore( ModificationStore.FULL ); - } return true; } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/PropertyAuditingData.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/PropertyAuditingData.java index a8adc1d1ce..84e77c5514 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/PropertyAuditingData.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/reader/PropertyAuditingData.java @@ -14,7 +14,6 @@ import jakarta.persistence.EnumType; import org.hibernate.envers.AuditOverride; import org.hibernate.envers.AuditOverrides; -import org.hibernate.envers.ModificationStore; import org.hibernate.envers.RelationTargetAuditMode; import org.hibernate.envers.internal.entities.PropertyData; import org.hibernate.envers.internal.tools.StringTools; @@ -31,7 +30,6 @@ import org.hibernate.type.Type; public class PropertyAuditingData { private String name; private String beanName; - private ModificationStore store; private String mapKey; private EnumType mapKeyEnumType; private AuditJoinTableData joinTable; @@ -69,7 +67,6 @@ public class PropertyAuditingData { this( name, accessType, - ModificationStore.FULL, RelationTargetAuditMode.AUDITED, null, null, @@ -97,7 +94,6 @@ public class PropertyAuditingData { this( name, accessType, - ModificationStore.FULL, RelationTargetAuditMode.AUDITED, null, null, @@ -110,7 +106,6 @@ public class PropertyAuditingData { public PropertyAuditingData( String name, String accessType, - ModificationStore store, RelationTargetAuditMode relationTargetAuditMode, String auditMappedBy, String positionMappedBy, @@ -120,7 +115,6 @@ public class PropertyAuditingData { this.name = name; this.beanName = name; this.accessType = accessType; - this.store = store; this.relationTargetAuditMode = relationTargetAuditMode; this.auditMappedBy = auditMappedBy; this.positionMappedBy = positionMappedBy; @@ -145,22 +139,6 @@ public class PropertyAuditingData { this.beanName = beanName; } - /** - * @deprecated since 5.2, to be removed in 6.0 with no replacement. - */ - @Deprecated - public ModificationStore getStore() { - return store; - } - - /** - * @deprecated since 5.2, to be removed in 6.0 with no replacement. - */ - @Deprecated - public void setStore(ModificationStore store) { - this.store = store; - } - public String getMapKey() { return mapKey; } @@ -341,7 +319,6 @@ public class PropertyAuditingData { name, beanName, accessType, - store, usingModifiedFlag, modifiedFlagName, synthetic, @@ -354,7 +331,6 @@ public class PropertyAuditingData { name, beanName, accessType, - store, usingModifiedFlag, modifiedFlagName, synthetic, @@ -365,7 +341,6 @@ public class PropertyAuditingData { name, beanName, accessType, - store, usingModifiedFlag, modifiedFlagName, synthetic, diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/internal/entities/PropertyData.java b/hibernate-envers/src/main/java/org/hibernate/envers/internal/entities/PropertyData.java index 939250efcb..a86ccadbb1 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/internal/entities/PropertyData.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/internal/entities/PropertyData.java @@ -8,7 +8,6 @@ package org.hibernate.envers.internal.entities; import java.util.Objects; -import org.hibernate.envers.ModificationStore; import org.hibernate.type.Type; /** @@ -24,7 +23,6 @@ public class PropertyData { */ private final String beanName; private final String accessType; - private final ModificationStore store; private boolean usingModifiedFlag; private String modifiedFlagName; // Synthetic properties are ones which are not part of the actual java model. @@ -43,7 +41,6 @@ public class PropertyData { this.name = newName; this.beanName = propertyData.beanName; this.accessType = propertyData.accessType; - this.store = propertyData.store; this.usingModifiedFlag = propertyData.usingModifiedFlag; this.modifiedFlagName = propertyData.modifiedFlagName; @@ -56,17 +53,15 @@ public class PropertyData { * @param name Name of the property. * @param beanName Name of the property in the bean. * @param accessType Accessor type for this property. - * @param store How this property should be stored. */ - public PropertyData(String name, String beanName, String accessType, ModificationStore store) { + public PropertyData(String name, String beanName, String accessType) { this.name = name; this.beanName = beanName; this.accessType = accessType; - this.store = store; } - private PropertyData(String name, String beanName, String accessType, ModificationStore store, Type propertyType) { - this( name, beanName, accessType, store ); + private PropertyData(String name, String beanName, String accessType, Type propertyType) { + this( name, beanName, accessType ); this.propertyType = propertyType; } @@ -74,18 +69,16 @@ public class PropertyData { * @param name Name of the property. * @param beanName Name of the property in the bean. * @param accessType Accessor type for this property. - * @param store How this property should be stored. * @param usingModifiedFlag Defines if field changes should be tracked */ public PropertyData( String name, String beanName, String accessType, - ModificationStore store, boolean usingModifiedFlag, String modifiedFlagName, boolean synthetic) { - this( name, beanName, accessType, store ); + this( name, beanName, accessType ); this.usingModifiedFlag = usingModifiedFlag; this.modifiedFlagName = modifiedFlagName; this.synthetic = synthetic; @@ -95,25 +88,23 @@ public class PropertyData { String name, String beanName, String accessType, - ModificationStore store, boolean usingModifiedFlag, String modifiedFlagName, boolean synthetic, Type propertyType) { - this( name, beanName, accessType, store, usingModifiedFlag, modifiedFlagName, synthetic, propertyType, null ); + this( name, beanName, accessType, usingModifiedFlag, modifiedFlagName, synthetic, propertyType, null ); } public PropertyData( String name, String beanName, String accessType, - ModificationStore store, boolean usingModifiedFlag, String modifiedFlagName, boolean synthetic, Type propertyType, Class virtualReturnClass) { - this( name, beanName, accessType, store, usingModifiedFlag, modifiedFlagName, synthetic ); + this( name, beanName, accessType, usingModifiedFlag, modifiedFlagName, synthetic ); this.propertyType = propertyType; this.virtualReturnClass = virtualReturnClass; } @@ -130,14 +121,6 @@ public class PropertyData { return accessType; } - /** - * @deprecated since 5.2, to be removed in 6.0 with no replacement. - */ - @Deprecated - public ModificationStore getStore() { - return store; - } - public boolean isUsingModifiedFlag() { return usingModifiedFlag; } @@ -169,7 +152,6 @@ public class PropertyData { final PropertyData that = (PropertyData) o; return usingModifiedFlag == that.usingModifiedFlag - && store == that.store && Objects.equals( accessType, that.accessType ) && Objects.equals( beanName, that.beanName ) && Objects.equals( name, that.name ) @@ -181,7 +163,6 @@ public class PropertyData { int result = name != null ? name.hashCode() : 0; result = 31 * result + (beanName != null ? beanName.hashCode() : 0); result = 31 * result + (accessType != null ? accessType.hashCode() : 0); - result = 31 * result + (store != null ? store.hashCode() : 0); result = 31 * result + (usingModifiedFlag ? 1 : 0); result = 31 * result + (synthetic ? 1 : 0); return result; @@ -192,7 +173,6 @@ public class PropertyData { propertyName, null, null, - null, propertyType ); }