diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesHolder.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesHolder.java index fa19964793..80d14d3d5a 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesHolder.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesHolder.java @@ -3,6 +3,7 @@ package org.hibernate.envers.configuration.metadata.reader; /** * Implementations hold other audited properties. * @author Adam Warski (adam at warski dot org) + * @author Hern&aacut;n Chanfreau */ public interface AuditedPropertiesHolder { /** @@ -17,4 +18,16 @@ public interface AuditedPropertiesHolder { * @return Auditing data for the property. */ PropertyAuditingData getPropertyAuditingData(String propertyName); + + + /** + * @return true if the holder contains any audited property + */ + boolean isEmpty(); + + /** + * @return true if the holder contains the given audited property + */ + boolean contains(String propertyName); + } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ClassAuditingData.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ClassAuditingData.java index 43a34c0122..334933e5ad 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ClassAuditingData.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ClassAuditingData.java @@ -31,6 +31,7 @@ import static org.hibernate.envers.tools.Tools.*; /** * @author Adam Warski (adam at warski dot org) * @author Sebastian Komander + * @author Hern&aacut;n Chanfreau */ public class ClassAuditingData implements AuditedPropertiesHolder { private final Map properties; @@ -49,6 +50,10 @@ public class ClassAuditingData implements AuditedPropertiesHolder { secondaryTableDictionary = newHashMap(); } + public boolean isEmpty() { + return properties.isEmpty(); + } + public void addPropertyAuditingData(String propertyName, PropertyAuditingData auditingData) { properties.put(propertyName, auditingData); } @@ -80,4 +85,8 @@ public class ClassAuditingData implements AuditedPropertiesHolder { public boolean isAudited() { return defaultAudited || properties.size() > 0; } + + public boolean contains(String propertyName) { + return properties.containsKey(propertyName); + } } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java index 07c8973361..2f8944edea 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java @@ -31,6 +31,7 @@ import java.util.Map; /** * Audit mapping meta-data for component. * @author Adam Warski (adam at warski dot org) + * @author Hern&aacut;n Chanfreau */ public class ComponentAuditingData extends PropertyAuditingData implements AuditedPropertiesHolder { private final Map properties; @@ -39,6 +40,10 @@ public class ComponentAuditingData extends PropertyAuditingData implements Audit this.properties = newHashMap(); } + public boolean isEmpty() { + return properties.isEmpty(); + } + public void addPropertyAuditingData(String propertyName, PropertyAuditingData auditingData) { properties.put(propertyName, auditingData); } @@ -46,4 +51,8 @@ public class ComponentAuditingData extends PropertyAuditingData implements Audit public PropertyAuditingData getPropertyAuditingData(String propertyName) { return properties.get(propertyName); } + + public boolean contains(String propertyName) { + return properties.containsKey(propertyName); + } } \ No newline at end of file