Class AuditProperty<T>

  • All Implemented Interfaces:
    AuditProjection
    Direct Known Subclasses:
    AuditId

    public class AuditProperty<T>
    extends Object
    implements AuditProjection
    Create restrictions, projections and specify order for a property of an audited entity.
    • Method Detail

      • getAlias

        public String getAlias​(String baseAlias)
        Description copied from interface: AuditProjection
        Get the alias associated with the audit projection.
        Specified by:
        getAlias in interface AuditProjection
        Parameters:
        baseAlias - the base alias if one exists; may be null
        Returns:
        the alias
      • ne

        public AuditCriterion ne​(T value)
        Apply a "not equal" constraint
      • ilike

        public AuditCriterion ilike​(T value)
        Apply an "ilike" constraint
      • gt

        public AuditCriterion gt​(T value)
        Apply a "greater than" constraint
      • lt

        public AuditCriterion lt​(T value)
        Apply a "less than" constraint
      • le

        public AuditCriterion le​(T value)
        Apply a "less than or equal" constraint
      • ge

        public AuditCriterion ge​(T value)
        Apply a "greater than or equal" constraint
      • between

        public AuditCriterion between​(T lo,
                                      T hi)
        Apply a "between" constraint
      • isNull

        public AuditCriterion isNull()
        Apply an "is null" constraint
      • eqProperty

        public AuditCriterion eqProperty​(String otherPropertyName)
        Apply an "equal" constraint to another property
      • eqProperty

        public AuditCriterion eqProperty​(String otherAlias,
                                         String otherPropertyName)
        Apply an "equal" constraint to another property
        Parameters:
        otherAlias - the alias of the entity which owns the other property.
      • neProperty

        public AuditCriterion neProperty​(String otherPropertyName)
        Apply a "not equal" constraint to another property
      • neProperty

        public AuditCriterion neProperty​(String otherAlias,
                                         String otherPropertyName)
        Apply a "not equal" constraint to another property
        Parameters:
        otherAlias - the alias of the entity which owns the other property.
      • ltProperty

        public AuditCriterion ltProperty​(String otherPropertyName)
        Apply a "less than" constraint to another property
      • ltProperty

        public AuditCriterion ltProperty​(String otherAlias,
                                         String otherPropertyName)
        Apply a "less than" constraint to another property
        Parameters:
        otherAlias - the alias of the entity which owns the other property.
      • leProperty

        public AuditCriterion leProperty​(String otherPropertyName)
        Apply a "less than or equal" constraint to another property
      • leProperty

        public AuditCriterion leProperty​(String otherAlias,
                                         String otherPropertyName)
        Apply a "less than or equal" constraint to another property
        Parameters:
        otherAlias - the alias of the entity which owns the other property.
      • gtProperty

        public AuditCriterion gtProperty​(String otherPropertyName)
        Apply a "greater than" constraint to another property
      • gtProperty

        public AuditCriterion gtProperty​(String otherAlias,
                                         String otherPropertyName)
        Apply a "greater than" constraint to another property
        Parameters:
        otherAlias - the alias of the entity which owns the other property.
      • geProperty

        public AuditCriterion geProperty​(String otherPropertyName)
        Apply a "greater than or equal" constraint to another property
      • geProperty

        public AuditCriterion geProperty​(String otherAlias,
                                         String otherPropertyName)
        Apply a "greater than or equal" constraint to another property
        Parameters:
        otherAlias - the alias of the entity which owns the other property.
      • geFunction

        public AuditCriterion geFunction​(AuditFunction otherFunction)
        Apply a "greater than or equal" constraint to a function
      • isNotNull

        public AuditCriterion isNotNull()
        Apply an "is not null" constraint to the another property
      • maximize

        public AggregatedAuditExpression maximize()
        Apply a "maximalize" constraint, with the ability to specify further constraints on the maximized property
      • minimize

        public AggregatedAuditExpression minimize()
        Apply a "minimize" constraint, with the ability to specify further constraints on the minimized property
      • countDistinct

        public AuditProjection countDistinct()
        Projection counting distinct values
      • distinct

        public AuditProjection distinct()
        Projection on distinct values
      • addProjectionToQuery

        public void addProjectionToQuery​(EnversService enversService,
                                         AuditReaderImplementor auditReader,
                                         Map<String,​String> aliasToEntityNameMap,
                                         Map<String,​String> aliasToComponentPropertyNameMap,
                                         String baseAlias,
                                         QueryBuilder queryBuilder)
        Description copied from interface: AuditProjection
        Adds an audit projection to the specified query.
        Specified by:
        addProjectionToQuery in interface AuditProjection
        Parameters:
        enversService - the Envers service
        auditReader - the audit reader implementor
        aliasToEntityNameMap - the entity name alias map
        baseAlias - the base alias, if one is specified; may be null
        queryBuilder - the query builder
      • asc

        public AuditOrder asc()
        Sort the results by the property in ascending order
      • desc

        public AuditOrder desc()
        Sort the results by the property in descending order
      • convertQueryResult

        public Object convertQueryResult​(EnversService enversService,
                                         EntityInstantiator entityInstantiator,
                                         String entityName,
                                         Number revision,
                                         Object value)
        Specified by:
        convertQueryResult in interface AuditProjection
        Parameters:
        enversService - the Envers service
        entityInstantiator - the entity instantiator
        entityName - the name of the entity for which the projection has been added
        revision - the revision
        value - the value to convert
        Returns:
        the converted value