Class AuditProperty<T>
- java.lang.Object
-
- org.hibernate.envers.query.criteria.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.
-
-
Constructor Summary
Constructors Constructor Description AuditProperty(String alias, PropertyNameGetter propertyNameGetter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProjectionToQuery(EnversService enversService, AuditReaderImplementor auditReader, Map<String,String> aliasToEntityNameMap, Map<String,String> aliasToComponentPropertyNameMap, String baseAlias, QueryBuilder queryBuilder)
Adds an audit projection to the specified query.AuditOrder
asc()
Sort the results by the property in ascending orderAuditCriterion
between(T lo, T hi)
Apply a "between" constraintObject
convertQueryResult(EnversService enversService, EntityInstantiator entityInstantiator, String entityName, Number revision, Object value)
AuditProjection
count()
Projection counting the valuesAuditProjection
countDistinct()
Projection counting distinct valuesAuditOrder
desc()
Sort the results by the property in descending orderAuditProjection
distinct()
Projection on distinct valuesAuditCriterion
eq(T value)
Apply an "equal" constraintAuditCriterion
eqFunction(AuditFunction otherFunction)
Apply an "equal" constraint to a functionAuditCriterion
eqProperty(String otherPropertyName)
Apply an "equal" constraint to another propertyAuditCriterion
eqProperty(String otherAlias, String otherPropertyName)
Apply an "equal" constraint to another propertyAuditProjection
function(String functionName)
Projection using a custom functionAuditCriterion
ge(T value)
Apply a "greater than or equal" constraintAuditCriterion
geFunction(AuditFunction otherFunction)
Apply a "greater than or equal" constraint to a functionAuditCriterion
geProperty(String otherPropertyName)
Apply a "greater than or equal" constraint to another propertyAuditCriterion
geProperty(String otherAlias, String otherPropertyName)
Apply a "greater than or equal" constraint to another propertyString
getAlias(String baseAlias)
Get the alias associated with the audit projection.PropertyNameGetter
getPropertyNameGetter()
AuditCriterion
gt(T value)
Apply a "greater than" constraintAuditCriterion
gtFunction(AuditFunction otherFunction)
Apply a "greater than" constraint to a functionAuditCriterion
gtProperty(String otherPropertyName)
Apply a "greater than" constraint to another propertyAuditCriterion
gtProperty(String otherAlias, String otherPropertyName)
Apply a "greater than" constraint to another propertyAuditCriterion
hasChanged()
AuditCriterion
hasNotChanged()
AuditCriterion
ilike(String value, MatchMode matchMode)
Apply on "ilike" constraintAuditCriterion
ilike(T value)
Apply an "ilike" constraintAuditCriterion
in(Collection values)
Apply an "in" constraintAuditCriterion
in(T[] values)
Apply an "in" constraintAuditCriterion
isNotNull()
Apply an "is not null" constraint to the another propertyAuditCriterion
isNull()
Apply an "is null" constraintAuditCriterion
le(T value)
Apply a "less than or equal" constraintAuditCriterion
leFunction(AuditFunction otherFunction)
Apply a "less than or equal" constraint to a functionAuditCriterion
leProperty(String otherPropertyName)
Apply a "less than or equal" constraint to another propertyAuditCriterion
leProperty(String otherAlias, String otherPropertyName)
Apply a "less than or equal" constraint to another propertyAuditCriterion
like(String value, MatchMode matchMode)
Apply a "like" constraintAuditCriterion
like(T value)
Apply a "like" constraintAuditCriterion
lt(T value)
Apply a "less than" constraintAuditCriterion
ltFunction(AuditFunction otherFunction)
Apply a "less than" constraint to a functionAuditCriterion
ltProperty(String otherPropertyName)
Apply a "less than" constraint to another propertyAuditCriterion
ltProperty(String otherAlias, String otherPropertyName)
Apply a "less than" constraint to another propertyAuditProjection
max()
Projection on the maximum valueAggregatedAuditExpression
maximize()
Apply a "maximalize" constraint, with the ability to specify further constraints on the maximized propertyAuditProjection
min()
Projection on the minimum valueAggregatedAuditExpression
minimize()
Apply a "minimize" constraint, with the ability to specify further constraints on the minimized propertyAuditCriterion
ne(T value)
Apply a "not equal" constraintAuditCriterion
neFunction(AuditFunction otherFunction)
Apply a "not equal" constraint to a functionAuditCriterion
neProperty(String otherPropertyName)
Apply a "not equal" constraint to another propertyAuditCriterion
neProperty(String otherAlias, String otherPropertyName)
Apply a "not equal" constraint to another property
-
-
-
Constructor Detail
-
AuditProperty
public AuditProperty(String alias, PropertyNameGetter propertyNameGetter)
-
-
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 interfaceAuditProjection
- Parameters:
baseAlias
- the base alias if one exists; may be null- Returns:
- the alias
-
getPropertyNameGetter
public PropertyNameGetter getPropertyNameGetter()
-
hasChanged
public AuditCriterion hasChanged()
-
hasNotChanged
public AuditCriterion hasNotChanged()
-
eq
public AuditCriterion eq(T value)
Apply an "equal" constraint
-
ne
public AuditCriterion ne(T value)
Apply a "not equal" constraint
-
like
public AuditCriterion like(T value)
Apply a "like" constraint
-
like
public AuditCriterion like(String value, MatchMode matchMode)
Apply a "like" constraint
-
ilike
public AuditCriterion ilike(T value)
Apply an "ilike" constraint
-
ilike
public AuditCriterion ilike(String value, MatchMode matchMode)
Apply on "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
-
in
public AuditCriterion in(T[] values)
Apply an "in" constraint
-
in
public AuditCriterion in(Collection values)
Apply an "in" 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.
-
eqFunction
public AuditCriterion eqFunction(AuditFunction otherFunction)
Apply an "equal" constraint to a function
-
neFunction
public AuditCriterion neFunction(AuditFunction otherFunction)
Apply a "not equal" constraint to a function
-
ltFunction
public AuditCriterion ltFunction(AuditFunction otherFunction)
Apply a "less than" constraint to a function
-
leFunction
public AuditCriterion leFunction(AuditFunction otherFunction)
Apply a "less than or equal" constraint to a function
-
gtFunction
public AuditCriterion gtFunction(AuditFunction otherFunction)
Apply a "greater than" constraint to a function
-
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
-
max
public AuditProjection max()
Projection on the maximum value
-
min
public AuditProjection min()
Projection on the minimum value
-
count
public AuditProjection count()
Projection counting the values
-
countDistinct
public AuditProjection countDistinct()
Projection counting distinct values
-
distinct
public AuditProjection distinct()
Projection on distinct values
-
function
public AuditProjection function(String functionName)
Projection using a custom function
-
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 interfaceAuditProjection
- Parameters:
enversService
- the Envers serviceauditReader
- the audit reader implementoraliasToEntityNameMap
- the entity name alias mapbaseAlias
- the base alias, if one is specified; may be nullqueryBuilder
- 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 interfaceAuditProjection
- Parameters:
enversService
- the Envers serviceentityInstantiator
- the entity instantiatorentityName
- the name of the entity for which the projection has been addedrevision
- the revisionvalue
- the value to convert- Returns:
- the converted value
-
-