org.keycloak.models.map.storage.chm

## Class MapModelCriteriaBuilder<K,V extends AbstractEntity,M>

- java.lang.Object
- - org.keycloak.models.map.storage.chm.MapModelCriteriaBuilder<K,V,M>

- All Implemented Interfaces:
    ModelCriteriaBuilder<M>

      public class MapModelCriteriaBuilder<K,V extends AbstractEntity,M>
      extends Object
      implements ModelCriteriaBuilder<M>

  Author:
    hmlnarik

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `MapModelCriteriaBuilder.UpdatePredicatesFunc<K,V extends AbstractEntity,M>`

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.map.storage.ModelCriteriaBuilder

      `ModelCriteriaBuilder.Operator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapModelCriteriaBuilder(StringKeyConvertor<K> keyConvertor, Map<SearchableModelField<M>,MapModelCriteriaBuilder.UpdatePredicatesFunc<K,V,M>> fieldPredicates)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MapModelCriteriaBuilder<K,V,M>` | `and(ModelCriteriaBuilder<M>... builders)` Creates and returns a new instance of `ModelCriteriaBuilder` that combines the given builders with the Boolean AND operator.
    `MapModelCriteriaBuilder<K,V,M>` | `compare(SearchableModelField<M> modelField, ModelCriteriaBuilder.Operator op, Object... values)` 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.
    `protected Object[]` | `convertValuesToKeyType(Object[] values)`
    `protected MapModelCriteriaBuilder<K,V,M>` | `fieldCompare(ModelCriteriaBuilder.Operator op, Function<V,?> getter, Object[] values)`
    `protected MapModelCriteriaBuilder<K,V,M>` | `fieldCompare(Predicate<Object> valueComparator, Function<V,?> getter)`
    `Predicate<? super V>` | `getEntityFilter()`
    `Predicate<? super K>` | `getKeyFilter()`
    `protected MapModelCriteriaBuilder<K,V,M>` | `idCompare(ModelCriteriaBuilder.Operator op, Object[] values)`
    `MapModelCriteriaBuilder<K,V,M>` | `not(ModelCriteriaBuilder<M> builder)` Creates and returns a new instance of `ModelCriteriaBuilder` that negates the given builder.
    `MapModelCriteriaBuilder<K,V,M>` | `or(ModelCriteriaBuilder<M>... builders)` Creates and returns a new instance of `ModelCriteriaBuilder` that combines the given builders with the Boolean OR operator.

    - ### 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

      `unwrap`

- - ### Constructor Detail

    - #### MapModelCriteriaBuilder

          public MapModelCriteriaBuilder(StringKeyConvertor<K> keyConvertor,
                                         Map<SearchableModelField<M>,MapModelCriteriaBuilder.UpdatePredicatesFunc<K,V,M>> fieldPredicates)

  - ### Method Detail

    - #### compare

          public MapModelCriteriaBuilder<K,V,M> compare(SearchableModelField<M> modelField,
                                                        ModelCriteriaBuilder.Operator op,
                                                        Object... values)

      Description copied from interface: `ModelCriteriaBuilder`
      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. The resulting constraint is a logical conjunction (i.e. AND) of the original constraint present in this `ModelCriteriaBuilder` and the given operator.
      Specified by:
        `compare` in interface `ModelCriteriaBuilder<M>`
      Parameters:
        `modelField` - Field on the logical model to be constrained
        `op` - Operator
        `values` - Additional operands of the operator.
      Returns:

    - #### and

          @SafeVarargs
          public final MapModelCriteriaBuilder<K,V,M> and(ModelCriteriaBuilder<M>... builders)

      Description copied from interface: `ModelCriteriaBuilder`
      Creates and returns a new instance of `ModelCriteriaBuilder` that combines the given builders with the Boolean AND operator.

      Predicate coming out of `and` on an empty array of `builders` (i.e. empty conjunction) is always `true`.

             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 interface `ModelCriteriaBuilder<M>`

    - #### or

          @SafeVarargs
          public final MapModelCriteriaBuilder<K,V,M> or(ModelCriteriaBuilder<M>... builders)

      Description copied from interface: `ModelCriteriaBuilder`
      Creates and returns a new instance of `ModelCriteriaBuilder` that combines the given builders with the Boolean OR operator.

      Predicate coming out of `or` on an empty array of `builders` (i.e. empty disjunction) is always `false`.

             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 interface `ModelCriteriaBuilder<M>`

    - #### not

          public MapModelCriteriaBuilder<K,V,M> not(ModelCriteriaBuilder<M> builder)

      Description copied from interface: `ModelCriteriaBuilder`
      Creates and returns a new instance of `ModelCriteriaBuilder` that negates the given builder.

      Note that if the `builder` has no condition yet, there is nothing to negate: empty negation is always `true`.

      Specified by:
        `not` in interface `ModelCriteriaBuilder<M>`
      Returns:

    - #### getKeyFilter

          public Predicate<? super K> getKeyFilter()

    - #### getEntityFilter

          public Predicate<? super V> getEntityFilter()

    - #### idCompare

          protected MapModelCriteriaBuilder<K,V,M> idCompare(ModelCriteriaBuilder.Operator op,
                                                             Object[] values)

    - #### convertValuesToKeyType

          protected Object[] convertValuesToKeyType(Object[] values)

    - #### fieldCompare

          protected MapModelCriteriaBuilder<K,V,M> fieldCompare(ModelCriteriaBuilder.Operator op,
                                                                Function<V,?> getter,
                                                                Object[] values)

    - #### fieldCompare

          protected MapModelCriteriaBuilder<K,V,M> fieldCompare(Predicate<Object> valueComparator,
                                                                Function<V,?> getter)

Copyright © 2021 JBoss by Red Hat. All rights reserved.