Class DescriptiveModelCriteria<M,Self extends DescriptiveModelCriteria<M,Self>>
- java.lang.Object
- 
- org.keycloak.models.map.storage.criteria.DescriptiveModelCriteria<M,Self>
 
- 
- All Implemented Interfaces:
- ModelCriteriaBuilder<M,Self>
 - Direct Known Subclasses:
- DefaultModelCriteria,- FileCriteriaBuilder
 
 public abstract class DescriptiveModelCriteria<M,Self extends DescriptiveModelCriteria<M,Self>> extends Object implements ModelCriteriaBuilder<M,Self> Descriptive model criteria implementation which in other words represents a Boolean formula on searchable fields.- Author:
- hmlnarik
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceDescriptiveModelCriteria.AtomicFormulaTester<M>- 
Nested classes/interfaces inherited from interface org.keycloak.models.map.storage.ModelCriteriaBuilderModelCriteriaBuilder.Operator
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected ModelCriteriaNode<M>node
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedDescriptiveModelCriteria(ModelCriteriaNode<M> node)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Selfand(Self... mcbs)Creates and returns a new instance ofModelCriteriaBuilderthat combines the given builders with the Boolean AND operator.Selfcompare(SearchableModelField<? super M> modelField, ModelCriteriaBuilder.Operator op, Object... value)Adds a constraint for the given model field to this criteria builder and returns a criteria builder that is combined with the the new constraint.<C extends ModelCriteriaBuilder<M,C>>
 CflashToModelCriteriaBuilder(C mcb)Copies contents of thisModelCriteriaBuilderinto anotherModelCriteriaBuilder.ModelCriteriaNode<M>getNode()<T extends DescriptiveModelCriteria<?,?>>
 ObjectgetSingleRestrictionArgument(String fieldName)Returns the realm ID which limits the results of this criteria.protected abstract SelfinstantiateForNode(ModelCriteriaNode<M> targetNode)booleanisEmpty()Selfnot(Self mcb)Creates and returns a new instance ofModelCriteriaBuilderthat negates the given builder.Selfoptimize()Optimizes this formula into anotherModelCriteriaBuilder, using the values ofModelCriteriaNode.ExtOperator.__TRUE__andModelCriteriaNode.ExtOperator.__FALSE__accordingly.Selfor(Self... mcbs)Creates and returns a new instance ofModelCriteriaBuilderthat combines the given builders with the Boolean OR operator.SelfpartiallyEvaluate(DescriptiveModelCriteria.AtomicFormulaTester<M> tester)StringtoString()
 
- 
- 
- 
Field Detail- 
nodeprotected final ModelCriteriaNode<M> node 
 
- 
 - 
Constructor Detail- 
DescriptiveModelCriteriaprotected DescriptiveModelCriteria(ModelCriteriaNode<M> node) 
 
- 
 - 
Method Detail- 
comparepublic Self compare(SearchableModelField<? super M> modelField, ModelCriteriaBuilder.Operator op, Object... value) Description copied from interface:ModelCriteriaBuilderAdds a constraint for the given model field to this criteria builder and returns a criteria builder that is combined with the the new constraint. The resulting constraint is a logical conjunction (i.e. AND) of the original constraint present in thisModelCriteriaBuilderand the given operator.- Specified by:
- comparein interface- ModelCriteriaBuilder<M,Self extends DescriptiveModelCriteria<M,Self>>
- Parameters:
- modelField- Field on the logical model to be constrained
- op- Operator
- value- Additional operands of the operator.
- Returns:
 
 - 
instantiateForNodeprotected abstract Self instantiateForNode(ModelCriteriaNode<M> targetNode) 
 - 
andpublic Self and(Self... mcbs) Description copied from interface:ModelCriteriaBuilderCreates and returns a new instance ofModelCriteriaBuilderthat combines the given builders with the Boolean AND operator.Predicate coming out of andon 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:
- andin interface- ModelCriteriaBuilder<M,Self extends DescriptiveModelCriteria<M,Self>>
 
 - 
orpublic Self or(Self... mcbs) Description copied from interface:ModelCriteriaBuilderCreates and returns a new instance ofModelCriteriaBuilderthat combines the given builders with the Boolean OR operator.Predicate coming out of oron 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:
- orin interface- ModelCriteriaBuilder<M,Self extends DescriptiveModelCriteria<M,Self>>
 
 - 
notpublic Self not(Self mcb) Description copied from interface:ModelCriteriaBuilderCreates and returns a new instance ofModelCriteriaBuilderthat negates the given builder.Note that if the builderhas no condition yet, there is nothing to negate: empty negation is alwaystrue.- Specified by:
- notin interface- ModelCriteriaBuilder<M,Self extends DescriptiveModelCriteria<M,Self>>
- Returns:
 
 - 
flashToModelCriteriaBuilderpublic <C extends ModelCriteriaBuilder<M,C>> C flashToModelCriteriaBuilder(C mcb) Copies contents of thisModelCriteriaBuilderinto anotherModelCriteriaBuilder.- Parameters:
- mcb-- ModelCriteriaBuilderto copy the contents onto
- Returns:
- Updated ModelCriteriaBuilder
 
 - 
partiallyEvaluatepublic Self partiallyEvaluate(DescriptiveModelCriteria.AtomicFormulaTester<M> tester) 
 - 
optimizepublic Self optimize() Optimizes this formula into anotherModelCriteriaBuilder, using the values ofModelCriteriaNode.ExtOperator.__TRUE__andModelCriteriaNode.ExtOperator.__FALSE__accordingly.- Returns:
- New instance of
 
 - 
getSingleRestrictionArgumentpublic <T extends DescriptiveModelCriteria<?,?>> Object getSingleRestrictionArgument(String fieldName) Returns the realm ID which limits the results of this criteria. Does not support formulae which include negation of a condition containing the given field. Only supports plain equality (ModelCriteriaBuilder.Operator.EQ), ignores all instances of the field comparison which do not use plain equality.- Returns:
- nullif the field is not contained in the formula, there are multiple mutually different field values in the formula, or the formula contains field check within a negation.
 
 - 
isEmptypublic boolean isEmpty() 
 - 
getNodepublic ModelCriteriaNode<M> getNode() 
 
- 
 
-