Interface UserCountMethodsProvider

All Known Subinterfaces:
UserCache, UserProvider, UserQueryProvider
All Known Implementing Classes:
JpaUserProvider, MapUserProvider, UserCacheSession, UserStorageManager

public interface UserCountMethodsProvider
This is an optional capability interface that is intended to be implemented by UserStorageProvider that supports count queries. By implementing this interface, count queries could be leveraged when querying users with some offset (firstResult).

Note that all methods in this interface should limit search only to data available within the storage that is represented by this provider. They should not lookup other storage providers for additional information.

  • Method Details

    • getUsersCount

      default int getUsersCount(RealmModel realm)
      Returns the number of users, without consider any service account.
      Parameters:
      realm - the realm
      Returns:
      the number of users
    • getUsersCount

      default int getUsersCount(RealmModel realm, Set<String> groupIds)
      Returns the number of users that are in at least one of the groups given.
      Parameters:
      realm - the realm
      groupIds - set of groups IDs, the returned user needs to belong to at least one of them
      Returns:
      the number of users that are in at least one of the groups
    • getUsersCount

      @Deprecated default int getUsersCount(RealmModel realm, String search)
      Deprecated.
      Use getUsersCount(RealmModel, Map) with an params map containing UserModel.SEARCH instead.
      Returns the number of users that would be returned by a call to searchForUserStream
      Parameters:
      realm - the realm
      search - case insensitive list of strings separated by whitespaces.
      Returns:
      number of users that match the search
    • getUsersCount

      @Deprecated default int getUsersCount(RealmModel realm, String search, Set<String> groupIds)
      Deprecated.
      Use getUsersCount(RealmModel, Map, Set) with an params map containing UserModel.SEARCH instead.
      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.
      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(RealmModel realm, Map<String,String> params)
      Returns the number of users that match the given filter parameters.
      Parameters:
      realm - the realm
      params - filter parameters
      Returns:
      number of users that match the given filters
    • getUsersCount

      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.
      Parameters:
      params - filter parameters
      realm - the realm
      groupIds - set if groups to check for
      Returns:
      number of users that match the given filters and groups
    • countUsersInGroups

      static int countUsersInGroups(Stream<UserModel> users, Set<String> groupIds)
      Returns the number of users from the given list of users that are in at least one of the groups given in the groups set.
      Parameters:
      users - list of users to check
      groupIds - id of groups that should be checked for
      Returns:
      number of users that are in at least one of the groups
    • getUsersCount

      default int getUsersCount(RealmModel realm, boolean includeServiceAccount)
      Returns the number of users.
      Parameters:
      realm - the realm
      includeServiceAccount - if true, the number of users will also include service accounts. Otherwise, only the number of users.
      Returns:
      the number of users