Fix for HHH-4646 and HHH-5177
added methods isEmpty() and contains(key)
This commit is contained in:
parent
5b782a83ea
commit
873fe754e3
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String, PropertyAuditingData> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String, PropertyAuditingData> 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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue