Search in sources :

Example 1 with AuditOverrides

use of org.hibernate.envers.AuditOverrides in project hibernate-orm by hibernate.

the class AuditedPropertiesReader method addPropertyAuditingOverrides.

/**
	 * Add the {@link AuditOverride} annotations.
	 *
	 * @param property the property being processed
	 * @param propertyData the Envers auditing data for this property
	 */
private void addPropertyAuditingOverrides(XProperty property, PropertyAuditingData propertyData) {
    final AuditOverride annotationOverride = property.getAnnotation(AuditOverride.class);
    if (annotationOverride != null) {
        propertyData.addAuditingOverride(annotationOverride);
    }
    final AuditOverrides annotationOverrides = property.getAnnotation(AuditOverrides.class);
    if (annotationOverrides != null) {
        propertyData.addAuditingOverrides(annotationOverrides);
    }
}
Also used : AuditOverrides(org.hibernate.envers.AuditOverrides) AuditOverride(org.hibernate.envers.AuditOverride)

Example 2 with AuditOverrides

use of org.hibernate.envers.AuditOverrides in project hibernate-orm by hibernate.

the class AuditedPropertiesReader method computeAuditOverrides.

/**
	 * @param clazz Source class.
	 *
	 * @return List of @AuditOverride annotations applied at class level.
	 */
private List<AuditOverride> computeAuditOverrides(XClass clazz) {
    final AuditOverrides auditOverrides = clazz.getAnnotation(AuditOverrides.class);
    final AuditOverride auditOverride = clazz.getAnnotation(AuditOverride.class);
    if (auditOverrides == null && auditOverride != null) {
        return Arrays.asList(auditOverride);
    } else if (auditOverrides != null && auditOverride == null) {
        return Arrays.asList(auditOverrides.value());
    } else if (auditOverrides != null && auditOverride != null) {
        throw new MappingException("@AuditOverrides annotation should encapsulate all @AuditOverride declarations. " + "Please revise Envers annotations applied to class " + clazz.getName() + ".");
    }
    return Collections.emptyList();
}
Also used : AuditOverrides(org.hibernate.envers.AuditOverrides) AuditOverride(org.hibernate.envers.AuditOverride) MappingException(org.hibernate.MappingException)

Aggregations

AuditOverride (org.hibernate.envers.AuditOverride)2 AuditOverrides (org.hibernate.envers.AuditOverrides)2 MappingException (org.hibernate.MappingException)1