org.keycloak.storage.user

## Interface UserQueryProvider.Streams

- All Superinterfaces:
    UserQueryProvider
  All Known Subinterfaces:
    UserCache.Streams, UserProvider.Streams
  All Known Implementing Classes:
    JpaUserProvider, LDAPStorageProvider, MapUserProvider, UserCacheSession, UserStorageManager
  Enclosing interface:
    UserQueryProvider

      public static interface UserQueryProvider.Streams
      extends UserQueryProvider

  The `UserQueryProvider.Streams` interface makes all collection-based methods in `UserQueryProvider` default by providing implementations that delegate to the `Stream`-based variants instead of the other way around.

  It allows for implementations to focus on the `Stream`-based approach for processing sets of data and benefit from the potential memory and performance optimizations of that approach.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.keycloak.storage.user.UserQueryProvider

      `UserQueryProvider.Streams`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default List<UserModel>` | `getGroupMembers(RealmModel realm, GroupModel group)` Get users that belong to a specific group.
    `default List<UserModel>` | `getGroupMembers(RealmModel realm, GroupModel group, int firstResult, int maxResults)` Gets paginated list of users that belong to a specific group.
    `default Stream<UserModel>` | `getGroupMembersStream(RealmModel realm, GroupModel group)` Obtains users that belong to a specific group.
    `Stream<UserModel>` | `getGroupMembersStream(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults)` Obtains users that belong to a specific group.
    `default List<UserModel>` | `getUsers(RealmModel realm)`
    `default List<UserModel>` | `getUsers(RealmModel realm, int firstResult, int maxResults)`
    `default int` | `getUsersCount(Map<String,String> params, RealmModel realm)`
    `default int` | `getUsersCount(Map<String,String> params, RealmModel realm, Set<String> groupIds)`
    `default int` | `getUsersCount(RealmModel realm, Map<String,String> params)` Returns the number of users that match the given filter parameters.
    `default int` | `getUsersCount(RealmModel realm, Map<String,String> params, Set<String> groupIds)` Returns the number of users that match the given filter parameters and is in at least one of the given groups.
    `default int` | `getUsersCount(RealmModel realm, String search)` Returns the number of users that would be returned by a call to `searchForUserStream`
    `default int` | `getUsersCount(RealmModel realm, String search, Set<String> groupIds)` Returns the number of users that would be returned by a call to `searchForUserStream` and are members of at least one of the groups given by the `groupIds` set.
    `default int` | `getUsersCount(String search, RealmModel realm)`
    `default int` | `getUsersCount(String search, RealmModel realm, Set<String> groupIds)`
    `default Stream<UserModel>` | `getUsersStream(RealmModel realm)` Searches all users in the realm.
    `Stream<UserModel>` | `getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults)` Searches all users in the realm, starting from the `firstResult` and containing at most `maxResults`.
    `default List<UserModel>` | `searchForUser(Map<String,String> params, RealmModel realm)` Search for user by a map of parameters.
    `default List<UserModel>` | `searchForUser(Map<String,String> params, RealmModel realm, int firstResult, int maxResults)` Search for user by parameter.
    `default List<UserModel>` | `searchForUser(String search, RealmModel realm)` Searches for users whose username, email, first name or last name contain any of the strings in `search` separated by whitespace.
    `default List<UserModel>` | `searchForUser(String search, RealmModel realm, int firstResult, int maxResults)` Searches for users whose username, email, first name or last name contain any of the strings in `search` separated by whitespace.
    `default List<UserModel>` | `searchForUserByUserAttribute(String attrName, String attrValue, RealmModel realm)` Search for users that have a specific attribute with a specific value.
    `Stream<UserModel>` | `searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue)` Searches for users that have a specific attribute with a specific value.
    `default Stream<UserModel>` | `searchForUserStream(RealmModel realm, Map<String,String> params)` Searches for user by parameter.
    `Stream<UserModel>` | `searchForUserStream(RealmModel realm, Map<String,String> params, Integer firstResult, Integer maxResults)` Searches for user by parameter.
    `default Stream<UserModel>` | `searchForUserStream(RealmModel realm, String search)` Searches for users whose username, email, first name or last name contain any of the strings in `search` separated by whitespace.
    `Stream<UserModel>` | `searchForUserStream(RealmModel realm, String search, Integer firstResult, Integer maxResults)` Searches for users whose username, email, first name or last name contain any of the strings in `search` separated by whitespace.

    - ### Methods inherited from interface org.keycloak.storage.user.UserQueryProvider

      `countUsersInGroups, getRoleMembers, getRoleMembers, getRoleMembersStream, getRoleMembersStream, getUsersCount, getUsersCount, getUsersCount`

- - ### Method Detail

    - #### getUsersCount

          default int getUsersCount(RealmModel realm,
                                    String search)

      Description copied from interface: `UserQueryProvider`
      Returns the number of users that would be returned by a call to `searchForUserStream`
      Specified by:
        `getUsersCount` in interface `UserQueryProvider`
      Parameters:
        `realm` - the realm
        `search` - case insensitive list of strings separated by whitespaces.
      Returns:
        number of users that match the search

    - #### getUsersCount

          default int getUsersCount(String search,
                                    RealmModel realm)

      Specified by:
        `getUsersCount` in interface `UserQueryProvider`

    - #### getUsersCount

          default int getUsersCount(RealmModel realm,
                                    String search,
                                    Set<String> groupIds)

      Description copied from interface: `UserQueryProvider`
      Returns the number of users that would be returned by a call to `searchForUserStream` and are members of at least one of the groups given by the `groupIds` set.
      Specified by:
        `getUsersCount` in interface `UserQueryProvider`
      Parameters:
        `realm` - the realm
        `search` - case insensitive list of strings separated by whitespaces.
        `groupIds` - set of groups IDs, the returned user needs to belong to at least one of them
      Returns:
        number of users that match the search and given groups

    - #### getUsersCount

          default int getUsersCount(String search,
                                    RealmModel realm,
                                    Set<String> groupIds)

      Specified by:
        `getUsersCount` in interface `UserQueryProvider`

    - #### getUsersCount

          default int getUsersCount(RealmModel realm,
                                    Map<String,String> params)

      Description copied from interface: `UserQueryProvider`
      Returns the number of users that match the given filter parameters.
      Specified by:
        `getUsersCount` in interface `UserQueryProvider`
      Parameters:
        `realm` - the realm
        `params` - filter parameters
      Returns:
        number of users that match the given filters

    - #### getUsersCount

          default int getUsersCount(Map<String,String> params,
                                    RealmModel realm)

      Specified by:
        `getUsersCount` in interface `UserQueryProvider`

    - #### getUsersCount

          default int getUsersCount(RealmModel realm,
                                    Map<String,String> params,
                                    Set<String> groupIds)

      Description copied from interface: `UserQueryProvider`
      Returns the number of users that match the given filter parameters and is in at least one of the given groups.
      Specified by:
        `getUsersCount` in interface `UserQueryProvider`
      Parameters:
        `realm` - the realm
        `params` - filter parameters
        `groupIds` - set if groups to check for
      Returns:
        number of users that match the given filters and groups

    - #### getUsersCount

          default int getUsersCount(Map<String,String> params,
                                    RealmModel realm,
                                    Set<String> groupIds)

      Specified by:
        `getUsersCount` in interface `UserQueryProvider`

    - #### getUsers

          default List<UserModel> getUsers(RealmModel realm)

      Specified by:
        `getUsers` in interface `UserQueryProvider`

    - #### getUsersStream

          default Stream<UserModel> getUsersStream(RealmModel realm)

      Description copied from interface: `UserQueryProvider`
      Searches all users in the realm.
      Specified by:
        `getUsersStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
      Returns:
        a non-null `Stream` of users.

    - #### getUsers

          default List<UserModel> getUsers(RealmModel realm,
                                           int firstResult,
                                           int maxResults)

      Specified by:
        `getUsers` in interface `UserQueryProvider`

    - #### getUsersStream

          Stream<UserModel> getUsersStream(RealmModel realm,
                                           Integer firstResult,
                                           Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      Searches all users in the realm, starting from the `firstResult` and containing at most `maxResults`.
      Specified by:
        `getUsersStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `firstResult` - first result to return. Ignored if negative or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users.

    - #### searchForUser

          default List<UserModel> searchForUser(String search,
                                                RealmModel realm)

      Description copied from interface: `UserQueryProvider`
      Searches for users whose username, email, first name or last name contain any of the strings in `search` separated by whitespace.

      If possible, implementations should treat the parameter values as partial match patterns i.e. in RDMBS terms use LIKE.

      This method is used by the admin console search box
      Specified by:
        `searchForUser` in interface `UserQueryProvider`
      Parameters:
        `search` - case insensitive list of string separated by whitespaces.
        `realm` - realm to search within
      Returns:
        list of users that satisfies the given search condition

    - #### searchForUserStream

          default Stream<UserModel> searchForUserStream(RealmModel realm,
                                                        String search)

      Description copied from interface: `UserQueryProvider`
      Searches for users whose username, email, first name or last name contain any of the strings in `search` separated by whitespace.

      If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE).

      This method is used by the admin console search box
      Specified by:
        `searchForUserStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `search` - case insensitive list of string separated by whitespaces.
      Returns:
        a non-null `Stream` of users that match the search string.

    - #### searchForUser

          default List<UserModel> searchForUser(String search,
                                                RealmModel realm,
                                                int firstResult,
                                                int maxResults)

      Description copied from interface: `UserQueryProvider`
      Searches for users whose username, email, first name or last name contain any of the strings in `search` separated by whitespace. The resulting user list should be paginated with respect to parameters `firstResult` and `maxResults`

      If possible, implementations should treat the parameter values as partial match patterns i.e. in RDMBS terms use LIKE.

      This method is used by the admin console search box
      Specified by:
        `searchForUser` in interface `UserQueryProvider`
      Parameters:
        `search` - case insensitive list of string separated by whitespaces.
        `realm` - a reference to the realm
        `firstResult` - first result to return. Ignored if negative or zero.
        `maxResults` - maximum number of results to return. Ignored if negative.
      Returns:
        paginated list of users from the realm that satisfies given search

    - #### searchForUserStream

          Stream<UserModel> searchForUserStream(RealmModel realm,
                                                String search,
                                                Integer firstResult,
                                                Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      Searches for users whose username, email, first name or last name contain any of the strings in `search` separated by whitespace.

      If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE).

      This method is used by the admin console search box
      Specified by:
        `searchForUserStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `search` - case insensitive list of string separated by whitespaces.
        `firstResult` - first result to return. Ignored if negative, zero, or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users that match the search criteria.

    - #### searchForUser

          default List<UserModel> searchForUser(Map<String,String> params,
                                                RealmModel realm)

      Description copied from interface: `UserQueryProvider`
      Search for user by a map of parameters.

      Valid parameters are:
      - `UserModel.FIRST_NAME` - first name (case insensitive string)
      - `UserModel.LAST_NAME` - last name (case insensitive string)
      - `UserModel.EMAIL` - email (case insensitive string)
      - `UserModel.USERNAME` - username (case insensitive string)
      - `UserModel.EMAIL_VERIFIED` - search only for users with verified/non-verified email (true/false)
      - `UserModel.ENABLED` - search only for enabled/disabled users (true/false)
      - `UserModel.IDP_ALIAS` - search only for users that have a federated identity from idp with the given alias configured (case sensitive string)
      - `UserModel.IDP_USER_ID` - search for users with federated identity with the given userId (case sensitive string)
      If possible, implementations should treat the parameter values as partial match patterns i.e. in RDMBS terms use LIKE.

      This method is used by the REST API when querying users.
      Specified by:
        `searchForUser` in interface `UserQueryProvider`
      Parameters:
        `params` - a map containing the search parameters
        `realm` - a reference to the realm
      Returns:
        list of users that satisfies given search conditions

    - #### searchForUserStream

          default Stream<UserModel> searchForUserStream(RealmModel realm,
                                                        Map<String,String> params)

      Description copied from interface: `UserQueryProvider`
      Searches for user by parameter. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE).

      Valid parameters are:
      - `UserModel.FIRST_NAME` - first name (case insensitive string)
      - `UserModel.LAST_NAME` - last name (case insensitive string)
      - `UserModel.EMAIL` - email (case insensitive string)
      - `UserModel.USERNAME` - username (case insensitive string)
      - `UserModel.EMAIL_VERIFIED` - search only for users with verified/non-verified email (true/false)
      - `UserModel.ENABLED` - search only for enabled/disabled users (true/false)
      - `UserModel.IDP_ALIAS` - search only for users that have a federated identity from idp with the given alias configured (case sensitive string)
      - `UserModel.IDP_USER_ID` - search for users with federated identity with the given userId (case sensitive string)
      This method is used by the REST API when querying users.
      Specified by:
        `searchForUserStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `params` - a map containing the search parameters.
      Returns:
        a non-null `Stream` of users that match the search parameters.

    - #### searchForUser

          default List<UserModel> searchForUser(Map<String,String> params,
                                                RealmModel realm,
                                                int firstResult,
                                                int maxResults)

      Description copied from interface: `UserQueryProvider`
      Search for user by parameter.

      Valid parameters are:
      - `UserModel.FIRST_NAME` - first name (case insensitive string)
      - `UserModel.LAST_NAME` - last name (case insensitive string)
      - `UserModel.EMAIL` - email (case insensitive string)
      - `UserModel.USERNAME` - username (case insensitive string)
      - `UserModel.EMAIL_VERIFIED` - search only for users with verified/non-verified email (true/false)
      - `UserModel.ENABLED` - search only for enabled/disabled users (true/false)
      - `UserModel.IDP_ALIAS` - search only for users that have a federated identity from idp with the given alias configured (case sensitive string)
      - `UserModel.IDP_USER_ID` - search for users with federated identity with the given userId (case sensitive string)
      If possible, implementations should treat the parameter values as patterns i.e. in RDMBS terms use LIKE.

      This method is used by the REST API when querying users.
      Specified by:
        `searchForUser` in interface `UserQueryProvider`
      Parameters:
        `params` - a map containing the search parameters.
        `realm` - a reference to the realm.
        `firstResult` - first result to return. Ignored if negative.
        `maxResults` - maximum number of results to return. Ignored if negative.
      Returns:
        a non-null `Stream` of users that match the search criteria.

    - #### searchForUserStream

          Stream<UserModel> searchForUserStream(RealmModel realm,
                                                Map<String,String> params,
                                                Integer firstResult,
                                                Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      Searches for user by parameter. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE).

      Valid parameters are:
      - `UserModel.FIRST_NAME` - first name (case insensitive string)
      - `UserModel.LAST_NAME` - last name (case insensitive string)
      - `UserModel.EMAIL` - email (case insensitive string)
      - `UserModel.USERNAME` - username (case insensitive string)
      - `UserModel.EMAIL_VERIFIED` - search only for users with verified/non-verified email (true/false)
      - `UserModel.ENABLED` - search only for enabled/disabled users (true/false)
      - `UserModel.IDP_ALIAS` - search only for users that have a federated identity from idp with the given alias configured (case sensitive string)
      - `UserModel.IDP_USER_ID` - search for users with federated identity with the given userId (case sensitive string)
      This method is used by the REST API when querying users.
      Specified by:
        `searchForUserStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `params` - a map containing the search parameters.
        `firstResult` - first result to return. Ignored if negative, zero, or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users that match the search criteria.

    - #### getGroupMembers

          default List<UserModel> getGroupMembers(RealmModel realm,
                                                  GroupModel group)

      Description copied from interface: `UserQueryProvider`
      Get users that belong to a specific group.
      Specified by:
        `getGroupMembers` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm
        `group` - a reference to the group
      Returns:
        a list of all users that are members of the given group

    - #### getGroupMembersStream

          default Stream<UserModel> getGroupMembersStream(RealmModel realm,
                                                          GroupModel group)

      Description copied from interface: `UserQueryProvider`
      Obtains users that belong to a specific group.
      Specified by:
        `getGroupMembersStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `group` - a reference to the group.
      Returns:
        a non-null `Stream` of users that belong to the group.

    - #### getGroupMembers

          default List<UserModel> getGroupMembers(RealmModel realm,
                                                  GroupModel group,
                                                  int firstResult,
                                                  int maxResults)

      Description copied from interface: `UserQueryProvider`
      Gets paginated list of users that belong to a specific group.
      Specified by:
        `getGroupMembers` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm
        `group` - a reference to the group
        `firstResult` - first result to return. Ignored if negative or zero.
        `maxResults` - maximum number of results to return. Ignored if negative.
      Returns:
        paginated list of members of the given group

    - #### getGroupMembersStream

          Stream<UserModel> getGroupMembersStream(RealmModel realm,
                                                  GroupModel group,
                                                  Integer firstResult,
                                                  Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      Obtains users that belong to a specific group.
      Specified by:
        `getGroupMembersStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `group` - a reference to the group.
        `firstResult` - first result to return. Ignored if negative, zero, or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users that belong to the group.

    - #### searchForUserByUserAttribute

          default List<UserModel> searchForUserByUserAttribute(String attrName,
                                                               String attrValue,
                                                               RealmModel realm)

      Description copied from interface: `UserQueryProvider`
      Search for users that have a specific attribute with a specific value.
      Specified by:
        `searchForUserByUserAttribute` in interface `UserQueryProvider`
      Parameters:
        `attrName` - a name of the attribute that will be searched
        `attrValue` - a value of the attribute that will be searched
        `realm` - a reference to the realm
      Returns:
        list of users with the given attribute name and value

    - #### searchForUserByUserAttributeStream

          Stream<UserModel> searchForUserByUserAttributeStream(RealmModel realm,
                                                               String attrName,
                                                               String attrValue)

      Description copied from interface: `UserQueryProvider`
      Searches for users that have a specific attribute with a specific value.
      Specified by:
        `searchForUserByUserAttributeStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `attrName` - the attribute name.
        `attrValue` - the attribute value.
      Returns:
        a non-null `Stream` of users that match the search criteria.

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