Class JpaModelCriteriaBuilder<E,M,Self extends JpaModelCriteriaBuilder<E,M,Self>>
- java.lang.Object
-
- org.keycloak.models.map.storage.jpa.JpaModelCriteriaBuilder<E,M,Self>
-
- Type Parameters:
E
- EntityM
- ModelSelf
- specific implementation of this class
- All Implemented Interfaces:
ModelCriteriaBuilder<M,Self>
- Direct Known Subclasses:
JpaAdminEventModelCriteriaBuilder
,JpaAuthEventModelCriteriaBuilder
,JpaClientModelCriteriaBuilder
,JpaClientScopeModelCriteriaBuilder
,JpaGroupModelCriteriaBuilder
,JpaLockModelCriteriaBuilder
,JpaPermissionModelCriteriaBuilder
,JpaPolicyModelCriteriaBuilder
,JpaRealmModelCriteriaBuilder
,JpaResourceModelCriteriaBuilder
,JpaResourceServerModelCriteriaBuilder
,JpaRoleModelCriteriaBuilder
,JpaRootAuthenticationSessionModelCriteriaBuilder
,JpaScopeModelCriteriaBuilder
,JpaSingleUseObjectModelCriteriaBuilder
,JpaUserLoginFailureModelCriteriaBuilder
,JpaUserModelCriteriaBuilder
,JpaUserSessionModelCriteriaBuilder
public abstract class JpaModelCriteriaBuilder<E,M,Self extends JpaModelCriteriaBuilder<E,M,Self>> extends Object implements ModelCriteriaBuilder<M,Self>
Abstract class containing methods common to all Jpa*ModelCriteriaBuilder implementations
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.models.map.storage.ModelCriteriaBuilder
ModelCriteriaBuilder.Operator
-
-
Constructor Summary
Constructors Constructor Description JpaModelCriteriaBuilder(Function<JpaPredicateFunction<E>,Self> instantiator)
JpaModelCriteriaBuilder(Function<JpaPredicateFunction<E>,Self> instantiator, JpaPredicateFunction<E> predicateFunc)
JpaModelCriteriaBuilder(Function<JpaPredicateFunction<E>,Self> instantiator, JpaPredicateFunction<E> predicateFunc, boolean isDistinct)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Self
and(Self... builders)
Creates and returns a new instance ofModelCriteriaBuilder
that combines the given builders with the Boolean AND operator.protected String
convertToJson(Object input)
JpaPredicateFunction<E>
getPredicateFunc()
protected Set<UUID>
getUuidsForInOperator(Object[] values, SearchableModelField<?> modelField)
protected Collection<?>
getValuesForInOperator(Object[] values, SearchableModelField<?> modelField)
protected javax.persistence.criteria.Predicate
hashExpression(javax.persistence.criteria.CriteriaBuilder cb, javax.persistence.criteria.Join<E,?> join, String columnName, Object value)
boolean
isDistinct()
Self
not(Self builder)
Creates and returns a new instance ofModelCriteriaBuilder
that negates the given builder.Self
or(Self... builders)
Creates and returns a new instance ofModelCriteriaBuilder
that combines the given builders with the Boolean OR operator.protected void
validateValue(Object[] value, SearchableModelField<? super M> field, ModelCriteriaBuilder.Operator op, Class<?>... expectedTypes)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.keycloak.models.map.storage.ModelCriteriaBuilder
compare
-
-
-
-
Constructor Detail
-
JpaModelCriteriaBuilder
public JpaModelCriteriaBuilder(Function<JpaPredicateFunction<E>,Self> instantiator)
-
JpaModelCriteriaBuilder
public JpaModelCriteriaBuilder(Function<JpaPredicateFunction<E>,Self> instantiator, JpaPredicateFunction<E> predicateFunc)
-
JpaModelCriteriaBuilder
public JpaModelCriteriaBuilder(Function<JpaPredicateFunction<E>,Self> instantiator, JpaPredicateFunction<E> predicateFunc, boolean isDistinct)
-
-
Method Detail
-
validateValue
protected void validateValue(Object[] value, SearchableModelField<? super M> field, ModelCriteriaBuilder.Operator op, Class<?>... expectedTypes)
-
and
@SafeVarargs public final Self and(Self... builders)
Description copied from interface:ModelCriteriaBuilder
Creates and returns a new instance ofModelCriteriaBuilder
that combines the given builders with the Boolean AND operator.Predicate coming out of
and
on an empty array ofbuilders
(i.e. empty conjunction) is alwaystrue
.cb = storage.getCriteriaBuilder(); storage.read(cb.or( cb.and(cb.compare(FIELD1, EQ, 1), cb.compare(FIELD2, EQ, 2)), cb.and(cb.compare(FIELD1, EQ, 3), cb.compare(FIELD2, EQ, 4)) );
- Specified by:
and
in interfaceModelCriteriaBuilder<E,M>
-
or
@SafeVarargs public final Self or(Self... builders)
Description copied from interface:ModelCriteriaBuilder
Creates and returns a new instance ofModelCriteriaBuilder
that combines the given builders with the Boolean OR operator.Predicate coming out of
or
on an empty array ofbuilders
(i.e. empty disjunction) is alwaysfalse
.cb = storage.getCriteriaBuilder(); storage.read(cb.or( cb.compare(FIELD1, EQ, 1).compare(FIELD2, EQ, 2), cb.compare(FIELD1, EQ, 3).compare(FIELD2, EQ, 4) );
- Specified by:
or
in interfaceModelCriteriaBuilder<E,M>
-
not
public Self not(Self builder)
Description copied from interface:ModelCriteriaBuilder
Creates and returns a new instance ofModelCriteriaBuilder
that negates the given builder.Note that if the
builder
has no condition yet, there is nothing to negate: empty negation is alwaystrue
.- Specified by:
not
in interfaceModelCriteriaBuilder<E,M>
- Returns:
-
getPredicateFunc
public JpaPredicateFunction<E> getPredicateFunc()
-
isDistinct
public boolean isDistinct()
-
getValuesForInOperator
protected Collection<?> getValuesForInOperator(Object[] values, SearchableModelField<?> modelField)
-
getUuidsForInOperator
protected Set<UUID> getUuidsForInOperator(Object[] values, SearchableModelField<?> modelField)
-
-