HHH-10468 - Fix Envers global_with_modified_flag to allow override behavior when set to false.

This commit is contained in:
Chris Cranford 2016-05-11 22:18:41 -05:00
parent 8117588354
commit 03aa47ab76
1 changed files with 11 additions and 2 deletions

View File

@ -560,8 +560,17 @@ public class AuditedPropertiesReader {
}
protected boolean checkUsingModifiedFlag(Audited aud) {
return globalCfg.hasSettingForUsingModifiedFlag() ?
globalCfg.isGlobalWithModifiedFlag() : aud.withModifiedFlag();
// HHH-10468
if ( globalCfg.hasSettingForUsingModifiedFlag() ) {
// HHH-10468
// Modify behavior so that if the global setting has been set by user properties, then
// the audit behavior should be a disjunction between the global setting and the field
// annotation. This allows the annotation to take precedence when the global value is
// false and for the global setting to take precedence when true.
return globalCfg.isGlobalWithModifiedFlag() || aud.withModifiedFlag();
}
// no global setting enabled, use the annotation's value only.
return aud.withModifiedFlag();
}
private void setPropertyRelationMappedBy(XProperty property, PropertyAuditingData propertyData) {