org.keycloak.models.jpa

## Class JpaRealmProvider

- java.lang.Object
- - org.keycloak.models.jpa.JpaRealmProvider

- All Implemented Interfaces:
    ClientProvider, GroupProvider, RealmProvider, RoleProvider, Provider, ClientLookupProvider, GroupLookupProvider, RoleLookupProvider

      public class JpaRealmProvider
      extends Object
      implements RealmProvider, ClientProvider, GroupProvider, RoleProvider

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected javax.persistence.EntityManager` | `em`
    `protected static org.jboss.logging.Logger` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JpaRealmProvider(KeycloakSession session, javax.persistence.EntityManager em)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ClientModel` | `addClient(RealmModel realm, String clientId)` Adds a client with given `clientId` to the given realm.
    `ClientModel` | `addClient(RealmModel realm, String id, String clientId)` Adds a client with given internal ID and `clientId` to the given realm.
    `RoleModel` | `addClientRole(ClientModel client, String name)` Adds a client role with given `name` to the given client.
    `RoleModel` | `addClientRole(ClientModel client, String id, String name)` Adds a client role with given internal ID and `name` to the given client.
    `RoleModel` | `addRealmRole(RealmModel realm, String name)` Adds a realm role with given `name` to the given realm.
    `RoleModel` | `addRealmRole(RealmModel realm, String id, String name)` Adds a realm role with given internal ID and `name` to the given realm.
    `void` | `addTopLevelGroup(RealmModel realm, GroupModel subGroup)` Removes parent group for the given group in the given realm.
    `void` | `close()`
    `ClientInitialAccessModel` | `createClientInitialAccessModel(RealmModel realm, int expiration, int count)`
    `GroupModel` | `createGroup(RealmModel realm, String id, String name, GroupModel toParent)` Creates a new group with the given name, id, name and parent to the given realm.
    `RealmModel` | `createRealm(String name)`
    `RealmModel` | `createRealm(String id, String name)`
    `void` | `decreaseRemainingCount(RealmModel realm, ClientInitialAccessModel clientInitialAccess)`
    `boolean` | `deleteLocalizationText(RealmModel realm, String locale, String key)`
    `boolean` | `deleteLocalizationTextsByLocale(RealmModel realm, String locale)`
    `Stream<ClientModel>` | `getAlwaysDisplayInConsoleClientsStream(RealmModel realm)` Returns a stream of clients that are expected to always show up in account console.
    `ClientModel` | `getClientByClientId(RealmModel realm, String clientId)` Exact search for a client by its public client identifier.
    `ClientModel` | `getClientById(RealmModel realm, String id)` Exact search for a client by its internal ID.
    `ClientInitialAccessModel` | `getClientInitialAccessModel(RealmModel realm, String id)`
    `RoleModel` | `getClientRole(ClientModel client, String name)` Exact search for a client role by given name.
    `Stream<RoleModel>` | `getClientRolesStream(ClientModel client, Integer first, Integer max)` Returns the client roles of the given client.
    `ClientScopeModel` | `getClientScopeById(String id, RealmModel realm)`
    `long` | `getClientsCount(RealmModel realm)` Returns number of clients in the given realm
    `Stream<ClientModel>` | `getClientsStream(RealmModel realm)` Returns all the clients of the given realm as a stream.
    `Stream<ClientModel>` | `getClientsStream(RealmModel realm, Integer firstResult, Integer maxResults)` Returns the clients of the given realm as a stream.
    `GroupModel` | `getGroupById(RealmModel realm, String id)` Returns a group from the given realm with the corresponding id
    `Stream<GroupModel>` | `getGroupsByRoleStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults)` Returns groups with the given role in the given realm.
    `Long` | `getGroupsCount(RealmModel realm, Boolean onlyTopGroups)` Returns a number of groups/top level groups (i.e.
    `Long` | `getGroupsCount(RealmModel realm, Stream<String> ids, String search)` Returns a number of groups that contains the search string in the name
    `Long` | `getGroupsCountByNameContaining(RealmModel realm, String search)` Returns number of groups with the given string in name for the given realm.
    `Stream<GroupModel>` | `getGroupsStream(RealmModel realm)` Returns groups for the given realm.
    `Stream<GroupModel>` | `getGroupsStream(RealmModel realm, Stream<String> ids)` Returns a list of groups with given ids.
    `Stream<GroupModel>` | `getGroupsStream(RealmModel realm, Stream<String> ids, Integer first, Integer max)` Returns a paginated list of groups with given ids.
    `Stream<GroupModel>` | `getGroupsStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max)` Returns a paginated stream of groups with given ids and given search value in group names.
    `String` | `getLocalizationTextsById(RealmModel realm, String locale, String key)`
    `MigrationModel` | `getMigrationModel()`
    `RealmModel` | `getRealm(String id)`
    `RealmModel` | `getRealmByName(String name)`
    `RoleModel` | `getRealmRole(RealmModel realm, String name)` Exact search for a role by given name.
    `Stream<RoleModel>` | `getRealmRolesStream(RealmModel realm)` Returns all the realm roles of the given realm as a stream.
    `Stream<RoleModel>` | `getRealmRolesStream(RealmModel realm, Integer first, Integer max)` Returns the realm roles of the given realm as a stream.
    `Stream<RealmModel>` | `getRealmsStream()`
    `Stream<RealmModel>` | `getRealmsWithProviderTypeStream(Class<?> providerType)`
    `RoleModel` | `getRoleById(RealmModel realm, String id)` Exact search for a role by its internal ID..
    `protected Stream<RoleModel>` | `getRolesStream(javax.persistence.TypedQuery<RoleEntity> query, RealmModel realm, Integer first, Integer max)`
    `Stream<GroupModel>` | `getTopLevelGroupsStream(RealmModel realm)` Returns all top level groups (i.e.
    `Stream<GroupModel>` | `getTopLevelGroupsStream(RealmModel realm, Integer first, Integer max)` Returns top level groups (i.e.
    `Stream<ClientInitialAccessModel>` | `listClientInitialAccessStream(RealmModel realm)`
    `void` | `moveGroup(RealmModel realm, GroupModel group, GroupModel toParent)` This method is used for moving groups in group structure, for example: making an existing child group child group of some other group, setting a top level group (i.e.
    `void` | `preRemove(RealmModel realm, RoleModel role)` This function is called when a role is removed; this serves for removing references from groups to roles.
    `boolean` | `removeClient(RealmModel realm, String id)` Removes given client from the given realm.
    `void` | `removeClientInitialAccessModel(RealmModel realm, String id)`
    `void` | `removeClients(RealmModel realm)` Removes all clients from the given realm.
    `void` | `removeExpiredClientInitialAccess()`
    `boolean` | `removeGroup(RealmModel realm, GroupModel group)` Removes the given group for the given realm.
    `boolean` | `removeRealm(String id)`
    `boolean` | `removeRole(RoleModel role)` Removes given realm role from the given realm.
    `void` | `removeRoles(ClientModel client)` Removes all roles from the given client.
    `void` | `removeRoles(RealmModel realm)` Removes all roles from the given realm.
    `void` | `saveLocalizationText(RealmModel realm, String locale, String key, String text)`
    `void` | `saveLocalizationTexts(RealmModel realm, String locale, Map<String,String> localizationTexts)`
    `Stream<ClientModel>` | `searchClientsByClientIdStream(RealmModel realm, String clientId, Integer firstResult, Integer maxResults)` Case-insensitive search for clients that contain the given string in their public client identifier.
    `Stream<RoleModel>` | `searchForClientRolesStream(ClientModel client, String search, Integer first, Integer max)` Case-insensitive search for client roles that contain the given string in their name or description.
    `Stream<GroupModel>` | `searchForGroupByNameStream(RealmModel realm, String search, Integer first, Integer max)` Returns groups with the given string in name for the given realm.
    `protected Stream<RoleModel>` | `searchForRoles(javax.persistence.TypedQuery<RoleEntity> query, RealmModel realm, String search, Integer first, Integer max)`
    `Stream<RoleModel>` | `searchForRolesStream(RealmModel realm, String search, Integer first, Integer max)` Case-insensitive search for roles that contain the given string in their name or description.
    `boolean` | `updateLocalizationText(RealmModel realm, String locale, String key, String text)`

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

      `addClientRole, addClientRole, createGroup, createGroup, createGroup, getAlwaysDisplayInConsoleClients, getClientByClientId, getClientById, getClientRole, getClientRoles, getClientRoles, getClients, getClients, getGroupById, getGroups, getGroupsByRole, getRealmRoles, getRealmRoles, getRealms, getRealmsWithProviderType, getRoleById, getTopLevelGroups, getTopLevelGroups, listClientInitialAccess, removeClient, removeRole, searchClientsByClientId, searchForClientRoles, searchForGroupByName, searchForRoles`

    - ### Methods inherited from interface org.keycloak.models.RoleProvider

      `getClientRolesStream`

- - ### Field Detail

    - #### logger

          protected static final org.jboss.logging.Logger logger

    - #### em

          protected javax.persistence.EntityManager em

  - ### Constructor Detail

    - #### JpaRealmProvider

          public JpaRealmProvider(KeycloakSession session,
                                  javax.persistence.EntityManager em)

  - ### Method Detail

    - #### getMigrationModel

          public MigrationModel getMigrationModel()

      Specified by:
        `getMigrationModel` in interface `RealmProvider`

    - #### createRealm

          public RealmModel createRealm(String name)

      Specified by:
        `createRealm` in interface `RealmProvider`

    - #### createRealm

          public RealmModel createRealm(String id,
                                        String name)

      Specified by:
        `createRealm` in interface `RealmProvider`

    - #### getRealm

          public RealmModel getRealm(String id)

      Specified by:
        `getRealm` in interface `RealmProvider`

    - #### getRealmsWithProviderTypeStream

          public Stream<RealmModel> getRealmsWithProviderTypeStream(Class<?> providerType)

      Specified by:
        `getRealmsWithProviderTypeStream` in interface `RealmProvider`

    - #### getRealmsStream

          public Stream<RealmModel> getRealmsStream()

      Specified by:
        `getRealmsStream` in interface `RealmProvider`

    - #### getRealmByName

          public RealmModel getRealmByName(String name)

      Specified by:
        `getRealmByName` in interface `RealmProvider`

    - #### removeRealm

          public boolean removeRealm(String id)

      Specified by:
        `removeRealm` in interface `RealmProvider`

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

    - #### addRealmRole

          public RoleModel addRealmRole(RealmModel realm,
                                        String name)

      Description copied from interface: `RoleProvider`
      Adds a realm role with given `name` to the given realm. The internal ID of the role will be created automatically.
      Specified by:
        `addRealmRole` in interface `RealmProvider`
      Specified by:
        `addRealmRole` in interface `RoleProvider`
      Parameters:
        `realm` - Realm owning this role.
        `name` - String name of the role.
      Returns:
        Model of the created role.

    - #### addRealmRole

          public RoleModel addRealmRole(RealmModel realm,
                                        String id,
                                        String name)

      Description copied from interface: `RoleProvider`
      Adds a realm role with given internal ID and `name` to the given realm.
      Specified by:
        `addRealmRole` in interface `RealmProvider`
      Specified by:
        `addRealmRole` in interface `RoleProvider`
      Parameters:
        `realm` - Realm owning this role.
        `id` - Internal ID of the role or `null` if one is to be created by the underlying store
        `name` - String name of the role.
      Returns:
        Model of the created client.

    - #### getRealmRole

          public RoleModel getRealmRole(RealmModel realm,
                                        String name)

      Description copied from interface: `RoleLookupProvider`
      Exact search for a role by given name.
      Specified by:
        `getRealmRole` in interface `RealmProvider`
      Specified by:
        `getRealmRole` in interface `RoleLookupProvider`
      Parameters:
        `realm` - Realm.
        `name` - String name of the role.
      Returns:
        Model of the role, or `null` if no role is found.

    - #### addClientRole

          public RoleModel addClientRole(ClientModel client,
                                         String name)

      Description copied from interface: `RoleProvider`
      Adds a client role with given `name` to the given client. The internal ID of the role will be created automatically.
      Specified by:
        `addClientRole` in interface `RoleProvider`
      Parameters:
        `client` - Client owning this role.
        `name` - String name of the role.
      Returns:
        Model of the created role.

    - #### addClientRole

          public RoleModel addClientRole(ClientModel client,
                                         String id,
                                         String name)

      Description copied from interface: `RoleProvider`
      Adds a client role with given internal ID and `name` to the given client.
      Specified by:
        `addClientRole` in interface `RoleProvider`
      Parameters:
        `client` - Client owning this role.
        `id` - Internal ID of the client role or `null` if one is to be created by the underlying store.
        `name` - String name of the role.
      Returns:
        Model of the created role.

    - #### getRealmRolesStream

          public Stream<RoleModel> getRealmRolesStream(RealmModel realm)

      Description copied from interface: `RoleProvider`
      Returns all the realm roles of the given realm as a stream. Effectively the same as the call `getRealmRolesStream(realm, null, null)`.
      Specified by:
        `getRealmRolesStream` in interface `RoleProvider`
      Parameters:
        `realm` - Realm.
      Returns:
        Stream of the roles. Never returns `null`.

    - #### getClientRole

          public RoleModel getClientRole(ClientModel client,
                                         String name)

      Description copied from interface: `RoleLookupProvider`
      Exact search for a client role by given name.
      Specified by:
        `getClientRole` in interface `RoleLookupProvider`
      Parameters:
        `client` - Client.
        `name` - String name of the role.
      Returns:
        Model of the role, or `null` if no role is found.

    - #### getRealmRolesStream

          public Stream<RoleModel> getRealmRolesStream(RealmModel realm,
                                                       Integer first,
                                                       Integer max)

      Description copied from interface: `RoleProvider`
      Returns the realm roles of the given realm as a stream.
      Specified by:
        `getRealmRolesStream` in interface `RoleProvider`
      Parameters:
        `realm` - Realm.
        `first` - First result to return. Ignored if negative or `null`.
        `max` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of the roles. Never returns `null`.

    - #### getClientRolesStream

          public Stream<RoleModel> getClientRolesStream(ClientModel client,
                                                        Integer first,
                                                        Integer max)

      Description copied from interface: `RoleProvider`
      Returns the client roles of the given client.
      Specified by:
        `getClientRolesStream` in interface `RoleProvider`
      Parameters:
        `client` - Client.
        `first` - First result to return. Ignored if negative or `null`.
        `max` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        List of the roles. Never returns `null`.

    - #### getRolesStream

          protected Stream<RoleModel> getRolesStream(javax.persistence.TypedQuery<RoleEntity> query,
                                                     RealmModel realm,
                                                     Integer first,
                                                     Integer max)

    - #### searchForClientRolesStream

          public Stream<RoleModel> searchForClientRolesStream(ClientModel client,
                                                              String search,
                                                              Integer first,
                                                              Integer max)

      Description copied from interface: `RoleLookupProvider`
      Case-insensitive search for client roles that contain the given string in their name or description.
      Specified by:
        `searchForClientRolesStream` in interface `RoleLookupProvider`
      Parameters:
        `client` - Client.
        `search` - String to search by role's name or description.
        `first` - First result to return. Ignored if negative or `null`.
        `max` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of the client roles their name or description contains given search string. Never returns `null`.

    - #### searchForRolesStream

          public Stream<RoleModel> searchForRolesStream(RealmModel realm,
                                                        String search,
                                                        Integer first,
                                                        Integer max)

      Description copied from interface: `RoleLookupProvider`
      Case-insensitive search for roles that contain the given string in their name or description.
      Specified by:
        `searchForRolesStream` in interface `RoleLookupProvider`
      Parameters:
        `realm` - Realm.
        `search` - Searched substring of the role's name or description.
        `first` - First result to return. Ignored if negative or `null`.
        `max` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of the realm roles their name or description contains given search string. Never returns `null`.

    - #### searchForRoles

          protected Stream<RoleModel> searchForRoles(javax.persistence.TypedQuery<RoleEntity> query,
                                                     RealmModel realm,
                                                     String search,
                                                     Integer first,
                                                     Integer max)

    - #### removeRole

          public boolean removeRole(RoleModel role)

      Description copied from interface: `RoleProvider`
      Removes given realm role from the given realm.
      Specified by:
        `removeRole` in interface `RoleProvider`
      Parameters:
        `role` - Role to be removed.
      Returns:
        `true` if the role existed and has been removed, `false` otherwise.

    - #### removeRoles

          public void removeRoles(RealmModel realm)

      Description copied from interface: `RoleProvider`
      Removes all roles from the given realm.
      Specified by:
        `removeRoles` in interface `RoleProvider`
      Parameters:
        `realm` - Realm.

    - #### removeRoles

          public void removeRoles(ClientModel client)

      Description copied from interface: `RoleProvider`
      Removes all roles from the given client.
      Specified by:
        `removeRoles` in interface `RoleProvider`
      Parameters:
        `client` - Client.

    - #### getRoleById

          public RoleModel getRoleById(RealmModel realm,
                                       String id)

      Description copied from interface: `RoleLookupProvider`
      Exact search for a role by its internal ID..
      Specified by:
        `getRoleById` in interface `RoleLookupProvider`
      Parameters:
        `realm` - Realm.
        `id` - Internal ID of the role.
      Returns:
        Model of the role.

    - #### getGroupById

          public GroupModel getGroupById(RealmModel realm,
                                         String id)

      Description copied from interface: `GroupLookupProvider`
      Returns a group from the given realm with the corresponding id
      Specified by:
        `getGroupById` in interface `RealmProvider`
      Specified by:
        `getGroupById` in interface `GroupLookupProvider`
      Parameters:
        `realm` - Realm.
        `id` - Id.
      Returns:
        GroupModel with the corresponding id.

    - #### moveGroup

          public void moveGroup(RealmModel realm,
                                GroupModel group,
                                GroupModel toParent)

      Description copied from interface: `GroupProvider`
      This method is used for moving groups in group structure, for example:
      - making an existing child group child group of some other group,
      - setting a top level group (i.e. group without parent group) child of some group,
      - making a child group top level group (i.e. removing its parent group).
      Specified by:
        `moveGroup` in interface `GroupProvider`
      Specified by:
        `moveGroup` in interface `RealmProvider`
      Parameters:
        `realm` - Realm owning this group.
        `group` - Group to update.
        `toParent` - New parent group, or `null` if we are moving the group to top level group.

    - #### getGroupsStream

          public Stream<GroupModel> getGroupsStream(RealmModel realm)

      Description copied from interface: `GroupProvider`
      Returns groups for the given realm.
      Specified by:
        `getGroupsStream` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
      Returns:
        Stream of groups in the Realm.

    - #### getGroupsStream

          public Stream<GroupModel> getGroupsStream(RealmModel realm,
                                                    Stream<String> ids,
                                                    String search,
                                                    Integer first,
                                                    Integer max)

      Description copied from interface: `GroupProvider`
      Returns a paginated stream of groups with given ids and given search value in group names.
      Specified by:
        `getGroupsStream` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
        `ids` - List of ids.
        `search` - Case insensitive string which will be searched for. Ignored if null.
        `first` - Index of the first result to return. Ignored if negative or `null`.
        `max` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        List of desired groups.

    - #### getGroupsStream

          public Stream<GroupModel> getGroupsStream(RealmModel realm,
                                                    Stream<String> ids,
                                                    Integer first,
                                                    Integer max)

      Description copied from interface: `GroupProvider`
      Returns a paginated list of groups with given ids. Effectively the same as `getGroupsStream(realm, ids, null, first, max)`.
      Specified by:
        `getGroupsStream` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
        `ids` - List of ids.
        `first` - Index of the first result to return. Ignored if negative or `null`.
        `max` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        List of GroupModels with the specified ids

    - #### getGroupsStream

          public Stream<GroupModel> getGroupsStream(RealmModel realm,
                                                    Stream<String> ids)

      Description copied from interface: `GroupProvider`
      Returns a list of groups with given ids. Effectively the same as `getGroupsStream(realm, ids, null, null, null)`.
      Specified by:
        `getGroupsStream` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
        `ids` - List of ids.
      Returns:
        List of GroupModels with the specified ids

    - #### getGroupsCount

          public Long getGroupsCount(RealmModel realm,
                                     Stream<String> ids,
                                     String search)

      Description copied from interface: `GroupProvider`
      Returns a number of groups that contains the search string in the name
      Specified by:
        `getGroupsCount` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
        `ids` - List of ids.
        `search` - Case insensitive string which will be searched for. Ignored if null.
      Returns:
        Number of groups.

    - #### getGroupsCount

          public Long getGroupsCount(RealmModel realm,
                                     Boolean onlyTopGroups)

      Description copied from interface: `GroupProvider`
      Returns a number of groups/top level groups (i.e. groups without parent group) for the given realm.
      Specified by:
        `getGroupsCount` in interface `GroupProvider`
      Specified by:
        `getGroupsCount` in interface `RealmProvider`
      Parameters:
        `realm` - Realm.
        `onlyTopGroups` - When true the function returns a count of top level groups only.
      Returns:
        Number of groups/top level groups.

    - #### getClientsCount

          public long getClientsCount(RealmModel realm)

      Description copied from interface: `ClientProvider`
      Returns number of clients in the given realm
      Specified by:
        `getClientsCount` in interface `ClientProvider`
      Specified by:
        `getClientsCount` in interface `RealmProvider`
      Parameters:
        `realm` - Realm.
      Returns:
        Number of the clients in the given realm.

    - #### getGroupsCountByNameContaining

          public Long getGroupsCountByNameContaining(RealmModel realm,
                                                     String search)

      Description copied from interface: `GroupProvider`
      Returns number of groups with the given string in name for the given realm.
      Specified by:
        `getGroupsCountByNameContaining` in interface `GroupProvider`
      Specified by:
        `getGroupsCountByNameContaining` in interface `RealmProvider`
      Parameters:
        `realm` - Realm.
        `search` - Case insensitive string which will be searched for.
      Returns:
        Number of groups with the given string in its name.

    - #### getGroupsByRoleStream

          public Stream<GroupModel> getGroupsByRoleStream(RealmModel realm,
                                                          RoleModel role,
                                                          Integer firstResult,
                                                          Integer maxResults)

      Description copied from interface: `GroupProvider`
      Returns groups with the given role in the given realm.
      Specified by:
        `getGroupsByRoleStream` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
        `role` - Role.
        `firstResult` - First result to return. Ignored if negative or `null`.
        `maxResults` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of groups with the given role.

    - #### getTopLevelGroupsStream

          public Stream<GroupModel> getTopLevelGroupsStream(RealmModel realm)

      Description copied from interface: `GroupProvider`
      Returns all top level groups (i.e. groups without parent group) for the given realm.
      Specified by:
        `getTopLevelGroupsStream` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
      Returns:
        Stream of all top level groups in the realm.

    - #### getTopLevelGroupsStream

          public Stream<GroupModel> getTopLevelGroupsStream(RealmModel realm,
                                                            Integer first,
                                                            Integer max)

      Description copied from interface: `GroupProvider`
      Returns top level groups (i.e. groups without parent group) for the given realm.
      Specified by:
        `getTopLevelGroupsStream` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
        `first` - First result to return. Ignored if negative or `null`.
        `max` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of top level groups in the realm.

    - #### removeGroup

          public boolean removeGroup(RealmModel realm,
                                     GroupModel group)

      Description copied from interface: `GroupProvider`
      Removes the given group for the given realm.
      Specified by:
        `removeGroup` in interface `GroupProvider`
      Specified by:
        `removeGroup` in interface `RealmProvider`
      Parameters:
        `realm` - Realm.
        `group` - Group.
      Returns:
        true if the group was removed, false if group doesn't exist or doesn't belong to the given realm

    - #### createGroup

          public GroupModel createGroup(RealmModel realm,
                                        String id,
                                        String name,
                                        GroupModel toParent)

      Description copied from interface: `GroupProvider`
      Creates a new group with the given name, id, name and parent to the given realm.
      Specified by:
        `createGroup` in interface `GroupProvider`
      Specified by:
        `createGroup` in interface `RealmProvider`
      Parameters:
        `realm` - Realm.
        `id` - Id, will be generated if `null`.
        `name` - Name.
        `toParent` - Parent group, or `null` if the group is top level group
      Returns:
        Model of the created group

    - #### addTopLevelGroup

          public void addTopLevelGroup(RealmModel realm,
                                       GroupModel subGroup)

      Description copied from interface: `GroupProvider`
      Removes parent group for the given group in the given realm.
      Specified by:
        `addTopLevelGroup` in interface `GroupProvider`
      Specified by:
        `addTopLevelGroup` in interface `RealmProvider`
      Parameters:
        `realm` - Realm.
        `subGroup` - Group.

    - #### preRemove

          public void preRemove(RealmModel realm,
                                RoleModel role)

      Description copied from interface: `GroupProvider`
      This function is called when a role is removed; this serves for removing references from groups to roles.
      Specified by:
        `preRemove` in interface `GroupProvider`
      Parameters:
        `realm` - Realm.
        `role` - Role which will be removed.

    - #### addClient

          public ClientModel addClient(RealmModel realm,
                                       String clientId)

      Description copied from interface: `ClientProvider`
      Adds a client with given `clientId` to the given realm. The internal ID of the client will be created automatically.
      Specified by:
        `addClient` in interface `ClientProvider`
      Specified by:
        `addClient` in interface `RealmProvider`
      Parameters:
        `realm` - Realm owning this client.
        `clientId` - String that identifies the client to the external parties. Maps to `client_id` in OIDC or `entityID` in SAML.
      Returns:
        Model of the created client.

    - #### addClient

          public ClientModel addClient(RealmModel realm,
                                       String id,
                                       String clientId)

      Description copied from interface: `ClientProvider`
      Adds a client with given internal ID and `clientId` to the given realm.
      Specified by:
        `addClient` in interface `ClientProvider`
      Specified by:
        `addClient` in interface `RealmProvider`
      Parameters:
        `realm` - Realm owning this client.
        `id` - Internal ID of the client or `null` if one is to be created by the underlying store
        `clientId` - String that identifies the client to the external parties. Maps to `client_id` in OIDC or `entityID` in SAML.
      Returns:
        Model of the created client.

    - #### getClientsStream

          public Stream<ClientModel> getClientsStream(RealmModel realm)

      Description copied from interface: `ClientProvider`
      Returns all the clients of the given realm as a stream. Effectively the same as the call `getClientsStream(realm, null, null)`.
      Specified by:
        `getClientsStream` in interface `ClientProvider`
      Parameters:
        `realm` - Realm.
      Returns:
        Stream of the clients. Never returns `null`.

    - #### getClientsStream

          public Stream<ClientModel> getClientsStream(RealmModel realm,
                                                      Integer firstResult,
                                                      Integer maxResults)

      Description copied from interface: `ClientProvider`
      Returns the clients of the given realm as a stream.
      Specified by:
        `getClientsStream` in interface `ClientProvider`
      Parameters:
        `realm` - Realm.
        `firstResult` - First result to return. Ignored if negative or `null`.
        `maxResults` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of the clients. Never returns `null`.

    - #### getAlwaysDisplayInConsoleClientsStream

          public Stream<ClientModel> getAlwaysDisplayInConsoleClientsStream(RealmModel realm)

      Description copied from interface: `ClientProvider`
      Returns a stream of clients that are expected to always show up in account console.
      Specified by:
        `getAlwaysDisplayInConsoleClientsStream` in interface `ClientProvider`
      Parameters:
        `realm` - Realm owning the clients.
      Returns:
        Stream of the clients. Never returns `null`.

    - #### getClientById

          public ClientModel getClientById(RealmModel realm,
                                           String id)

      Description copied from interface: `ClientLookupProvider`
      Exact search for a client by its internal ID.
      Specified by:
        `getClientById` in interface `ClientLookupProvider`
      Parameters:
        `realm` - Realm to limit the search.
        `id` - Internal ID
      Returns:
        Model of the client, or `null` if no client is found.

    - #### getClientByClientId

          public ClientModel getClientByClientId(RealmModel realm,
                                                 String clientId)

      Description copied from interface: `ClientLookupProvider`
      Exact search for a client by its public client identifier.
      Specified by:
        `getClientByClientId` in interface `ClientLookupProvider`
      Parameters:
        `realm` - Realm to limit the search for clients.
        `clientId` - String that identifies the client to the external parties. Maps to `client_id` in OIDC or `entityID` in SAML.
      Returns:
        Model of the client, or `null` if no client is found.

    - #### searchClientsByClientIdStream

          public Stream<ClientModel> searchClientsByClientIdStream(RealmModel realm,
                                                                   String clientId,
                                                                   Integer firstResult,
                                                                   Integer maxResults)

      Description copied from interface: `ClientLookupProvider`
      Case-insensitive search for clients that contain the given string in their public client identifier.
      Specified by:
        `searchClientsByClientIdStream` in interface `ClientLookupProvider`
      Parameters:
        `realm` - Realm to limit the search for clients.
        `clientId` - Searched substring of the public client identifier (`client_id` in OIDC or `entityID` in SAML.)
        `firstResult` - First result to return. Ignored if negative or `null`.
        `maxResults` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of ClientModel or an empty stream if no client is found.

    - #### removeClients

          public void removeClients(RealmModel realm)

      Description copied from interface: `ClientProvider`
      Removes all clients from the given realm.
      Specified by:
        `removeClients` in interface `ClientProvider`
      Parameters:
        `realm` - Realm.

    - #### removeClient

          public boolean removeClient(RealmModel realm,
                                      String id)

      Description copied from interface: `ClientProvider`
      Removes given client from the given realm.
      Specified by:
        `removeClient` in interface `ClientProvider`
      Parameters:
        `realm` - Realm.
        `id` - Internal ID of the client
      Returns:
        `true` if the client existed and has been removed, `false` otherwise.

    - #### getClientScopeById

          public ClientScopeModel getClientScopeById(String id,
                                                     RealmModel realm)

      Specified by:
        `getClientScopeById` in interface `RealmProvider`

    - #### searchForGroupByNameStream

          public Stream<GroupModel> searchForGroupByNameStream(RealmModel realm,
                                                               String search,
                                                               Integer first,
                                                               Integer max)

      Description copied from interface: `GroupLookupProvider`
      Returns groups with the given string in name for the given realm.
      Specified by:
        `searchForGroupByNameStream` in interface `GroupLookupProvider`
      Parameters:
        `realm` - Realm.
        `search` - Case sensitive searched string.
        `first` - First result to return. Ignored if negative or `null`.
        `max` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of groups with the given string in name.

    - #### createClientInitialAccessModel

          public ClientInitialAccessModel createClientInitialAccessModel(RealmModel realm,
                                                                         int expiration,
                                                                         int count)

      Specified by:
        `createClientInitialAccessModel` in interface `RealmProvider`

    - #### getClientInitialAccessModel

          public ClientInitialAccessModel getClientInitialAccessModel(RealmModel realm,
                                                                      String id)

      Specified by:
        `getClientInitialAccessModel` in interface `RealmProvider`

    - #### removeClientInitialAccessModel

          public void removeClientInitialAccessModel(RealmModel realm,
                                                     String id)

      Specified by:
        `removeClientInitialAccessModel` in interface `RealmProvider`

    - #### listClientInitialAccessStream

          public Stream<ClientInitialAccessModel> listClientInitialAccessStream(RealmModel realm)

      Specified by:
        `listClientInitialAccessStream` in interface `RealmProvider`

    - #### removeExpiredClientInitialAccess

          public void removeExpiredClientInitialAccess()

      Specified by:
        `removeExpiredClientInitialAccess` in interface `RealmProvider`

    - #### decreaseRemainingCount

          public void decreaseRemainingCount(RealmModel realm,
                                             ClientInitialAccessModel clientInitialAccess)

      Specified by:
        `decreaseRemainingCount` in interface `RealmProvider`

    - #### updateLocalizationText

          public boolean updateLocalizationText(RealmModel realm,
                                                String locale,
                                                String key,
                                                String text)

      Specified by:
        `updateLocalizationText` in interface `RealmProvider`

    - #### saveLocalizationText

          public void saveLocalizationText(RealmModel realm,
                                           String locale,
                                           String key,
                                           String text)

      Specified by:
        `saveLocalizationText` in interface `RealmProvider`

    - #### saveLocalizationTexts

          public void saveLocalizationTexts(RealmModel realm,
                                            String locale,
                                            Map<String,String> localizationTexts)

      Specified by:
        `saveLocalizationTexts` in interface `RealmProvider`

    - #### deleteLocalizationTextsByLocale

          public boolean deleteLocalizationTextsByLocale(RealmModel realm,
                                                         String locale)

      Specified by:
        `deleteLocalizationTextsByLocale` in interface `RealmProvider`

    - #### getLocalizationTextsById

          public String getLocalizationTextsById(RealmModel realm,
                                                 String locale,
                                                 String key)

      Specified by:
        `getLocalizationTextsById` in interface `RealmProvider`

    - #### deleteLocalizationText

          public boolean deleteLocalizationText(RealmModel realm,
                                                String locale,
                                                String key)

      Specified by:
        `deleteLocalizationText` in interface `RealmProvider`

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