HHH-6605 - Removed OVERRIDE_USING_MODIFIED_FLAG_PROPERTY global property
This commit is contained in:
parent
fcb57dd17f
commit
726571b270
|
@ -22,21 +22,20 @@
|
|||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.envers.configuration;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.envers.RevisionListener;
|
||||
|
||||
import org.hibernate.*;
|
||||
import org.hibernate.envers.*;
|
||||
import java.util.Properties;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.hibernate.envers.tools.Tools.*;
|
||||
import static org.hibernate.envers.tools.Tools.getProperty;
|
||||
|
||||
/**
|
||||
* @author Adam Warski (adam at warski dot org)
|
||||
* @author Nicolas Doroskevich
|
||||
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
|
||||
* @author Michal Skowronek (mskowr at o2 dot pl)
|
||||
*/
|
||||
public class GlobalConfiguration {
|
||||
public static final String OVERRIDE_USING_MODIFIED_FLAG_PROPERTY = "org.hibernate.envers.override_using_modified_flag";
|
||||
public static final String USING_MODIFIED_FLAG_PROPERTY = "org.hibernate.envers.using_modified_flag";
|
||||
// Should a revision be generated when a not-owned relation field changes
|
||||
private final boolean generateRevisionsForCollections;
|
||||
|
@ -58,10 +57,10 @@ public class GlobalConfiguration {
|
|||
|
||||
// Revision listener class name.
|
||||
private final Class<? extends RevisionListener> revisionListenerClass;
|
||||
// Should default setting (false) for modified property flags be overridden
|
||||
private boolean overrideUsingModifiedFlag;
|
||||
// Should Envers use modified property flags by default
|
||||
private boolean usingModifiedFlag;
|
||||
// Indicates that user defined global behavior for modified flags feature
|
||||
private boolean hasSettingForUsingModifiedFlag;
|
||||
|
||||
/*
|
||||
Which operator to use in correlated subqueries (when we want a property to be equal to the result of
|
||||
|
@ -102,12 +101,8 @@ public class GlobalConfiguration {
|
|||
"false");
|
||||
trackEntitiesChangedInRevisionEnabled = Boolean.parseBoolean(trackEntitiesChangedInRevisionEnabledStr);
|
||||
|
||||
String overrideUsingModifiedFlagStr = getProperty(properties,
|
||||
OVERRIDE_USING_MODIFIED_FLAG_PROPERTY,
|
||||
OVERRIDE_USING_MODIFIED_FLAG_PROPERTY,
|
||||
"false");
|
||||
overrideUsingModifiedFlag = Boolean.parseBoolean(overrideUsingModifiedFlagStr);
|
||||
|
||||
hasSettingForUsingModifiedFlag =
|
||||
properties.getProperty(USING_MODIFIED_FLAG_PROPERTY) != null;
|
||||
String usingModifiedFlagStr = getProperty(properties,
|
||||
USING_MODIFIED_FLAG_PROPERTY,
|
||||
USING_MODIFIED_FLAG_PROPERTY,
|
||||
|
@ -162,8 +157,8 @@ public class GlobalConfiguration {
|
|||
return revisionListenerClass;
|
||||
}
|
||||
|
||||
public boolean isOverrideUsingModifiedFlag() {
|
||||
return overrideUsingModifiedFlag;
|
||||
public boolean hasSettingForUsingModifiedFlag() {
|
||||
return hasSettingForUsingModifiedFlag;
|
||||
}
|
||||
|
||||
public boolean isUsingModifiedFlag() {
|
||||
|
|
|
@ -4,7 +4,13 @@ import org.hibernate.MappingException;
|
|||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
import org.hibernate.envers.*;
|
||||
import org.hibernate.envers.AuditJoinTable;
|
||||
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.configuration.GlobalConfiguration;
|
||||
import org.hibernate.envers.tools.MappingTools;
|
||||
import org.hibernate.mapping.Component;
|
||||
|
@ -113,7 +119,7 @@ public class AuditedPropertiesReader {
|
|||
private void readPersistentPropertiesAccess() {
|
||||
Iterator<Property> propertyIter = persistentPropertiesSource.getPropertyIterator();
|
||||
while (propertyIter.hasNext()) {
|
||||
Property property = (Property) propertyIter.next();
|
||||
Property property = propertyIter.next();
|
||||
if ("field".equals(property.getPropertyAccessorName())) {
|
||||
fieldAccessedPersistentProperties.add(property.getName());
|
||||
} else {
|
||||
|
@ -186,8 +192,8 @@ public class AuditedPropertiesReader {
|
|||
boolean isAudited = fillPropertyData(property, componentData, accessType,
|
||||
allClassAudited);
|
||||
|
||||
PersistentPropertiesSource componentPropertiesSource = new ComponentPropertiesSource(
|
||||
(Component) propertyValue);
|
||||
PersistentPropertiesSource componentPropertiesSource =
|
||||
new ComponentPropertiesSource(propertyValue);
|
||||
|
||||
ComponentAuditedPropertiesReader audPropReader = new ComponentAuditedPropertiesReader(
|
||||
ModificationStore.FULL, componentPropertiesSource,
|
||||
|
@ -278,7 +284,7 @@ public class AuditedPropertiesReader {
|
|||
}
|
||||
|
||||
protected boolean checkUsingModifiedFlag(Audited aud) {
|
||||
return globalCfg.isOverrideUsingModifiedFlag() ?
|
||||
return globalCfg.hasSettingForUsingModifiedFlag() ?
|
||||
globalCfg.isUsingModifiedFlag() : aud.usingModifiedFlag();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,12 +43,7 @@ public abstract class AbstractModifiedFlagsEntityTest extends AbstractEntityTest
|
|||
super.addConfigurationProperties(configuration);
|
||||
if (forceModifiedFlags()) {
|
||||
configuration.setProperty(
|
||||
GlobalConfiguration.OVERRIDE_USING_MODIFIED_FLAG_PROPERTY,
|
||||
"true");
|
||||
configuration
|
||||
.setProperty(
|
||||
GlobalConfiguration.USING_MODIFIED_FLAG_PROPERTY,
|
||||
"true");
|
||||
GlobalConfiguration.USING_MODIFIED_FLAG_PROPERTY, "true");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,12 +40,7 @@ public abstract class AbstractModifiedFlagsOneSessionTest extends
|
|||
super.addProperties(configuration);
|
||||
if (forceModifiedFlags()) {
|
||||
configuration.setProperty(
|
||||
GlobalConfiguration.OVERRIDE_USING_MODIFIED_FLAG_PROPERTY,
|
||||
"true");
|
||||
configuration
|
||||
.setProperty(
|
||||
GlobalConfiguration.USING_MODIFIED_FLAG_PROPERTY,
|
||||
"true");
|
||||
GlobalConfiguration.USING_MODIFIED_FLAG_PROPERTY, "true");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue