HHH-11737 - Remove dependency on org.hibernate.criterion package.
This commit is contained in:
parent
5ff2289da4
commit
f9aa6e6d2e
|
@ -23,11 +23,7 @@ import org.hibernate.envers.query.projection.AuditProjection;
|
|||
import org.hibernate.envers.query.projection.internal.EntityAuditProjection;
|
||||
|
||||
/**
|
||||
* TODO: ilike
|
||||
*
|
||||
* @author Adam Warski (adam at warski dot org)
|
||||
*
|
||||
* @see org.hibernate.criterion.Restrictions
|
||||
*/
|
||||
@SuppressWarnings({"JavaDoc"})
|
||||
public class AuditEntity {
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.envers.query.criteria;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.hibernate.criterion.MatchMode;
|
||||
import org.hibernate.envers.boot.internal.EnversService;
|
||||
import org.hibernate.envers.internal.entities.EntityInstantiator;
|
||||
import org.hibernate.envers.query.criteria.internal.BetweenAuditExpression;
|
||||
|
@ -86,7 +85,16 @@ public class AuditProperty<T> implements AuditProjection {
|
|||
|
||||
/**
|
||||
* Apply an "ilike" constraint
|
||||
* @deprecated since 5.2, use {@link #ilike(String, MatchMode)}. To be removed in 6.0.
|
||||
*/
|
||||
@Deprecated
|
||||
public AuditCriterion ilike(String value, org.hibernate.criterion.MatchMode matchMode) {
|
||||
return new IlikeAuditExpression( alias, propertyNameGetter, matchMode.toMatchString( value ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply on "ilike" constraint
|
||||
*/
|
||||
public AuditCriterion ilike(String value, MatchMode matchMode) {
|
||||
return new IlikeAuditExpression( alias, propertyNameGetter, matchMode.toMatchString( value ) );
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.envers.query.criteria;
|
||||
|
||||
/**
|
||||
* A strategy for matching strings using "like".
|
||||
*
|
||||
* @author Chris Cranford
|
||||
*/
|
||||
public enum MatchMode {
|
||||
/**
|
||||
* Match the pattern exactly.
|
||||
*/
|
||||
EXACT {
|
||||
@Override
|
||||
public String toMatchString(String pattern) {
|
||||
return pattern;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Match the start of the string to the pattern.
|
||||
*/
|
||||
START {
|
||||
@Override
|
||||
public String toMatchString(String pattern) {
|
||||
return pattern + '%';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Match the end of the string to the pattern.
|
||||
*/
|
||||
END {
|
||||
@Override
|
||||
public String toMatchString(String pattern) {
|
||||
return '%' + pattern;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Match the pattern anywhere in the string.
|
||||
*/
|
||||
ANYWHERE {
|
||||
@Override
|
||||
public String toMatchString(String pattern) {
|
||||
return '%' + pattern + '%';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert the pattern by prepending/append "%".
|
||||
*
|
||||
* @param pattern The pattern to convert according to the mode.
|
||||
* @return The converted pattern.
|
||||
*/
|
||||
public abstract String toMatchString(String pattern);
|
||||
}
|
|
@ -11,10 +11,10 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import org.hibernate.criterion.MatchMode;
|
||||
import org.hibernate.envers.RevisionType;
|
||||
import org.hibernate.envers.enhanced.SequenceIdRevisionEntity;
|
||||
import org.hibernate.envers.query.AuditEntity;
|
||||
import org.hibernate.envers.query.criteria.MatchMode;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
import org.hibernate.envers.test.Priority;
|
||||
import org.hibernate.envers.test.entities.StrIntTestEntity;
|
||||
|
|
Loading…
Reference in New Issue