org.keycloak.models

## Interface RoleContainerModel

- All Known Subinterfaces:
    CachedRealmModel, ClientModel, RealmModel
  All Known Implementing Classes:
    AbstractClientModel, AbstractClientStorageAdapter, AbstractReadOnlyClientStorageAdapter, ClientAdapter, ClientAdapter, MapClientAdapter, OpenshiftSAClientAdapter, RealmAdapter, RealmAdapter, UnsupportedOperationsClientStorageAdapter

      public interface RoleContainerModel

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `RoleContainerModel.RoleRemovedEvent`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDefaultRole(String name)` Adds a role with given name to default roles of this object.
    `RoleModel` | `addRole(String name)`
    `RoleModel` | `addRole(String id, String name)`
    `default List<String>` | `getDefaultRoles()` Deprecated. use the stream variant instead
    `Stream<String>` | `getDefaultRolesStream()` Returns all default role names of this object as a stream.
    `String` | `getId()`
    `RoleModel` | `getRole(String name)`
    `default Set<RoleModel>` | `getRoles()` Deprecated.
    `default Set<RoleModel>` | `getRoles(Integer firstResult, Integer maxResults)` Deprecated.
    `Stream<RoleModel>` | `getRolesStream()`
    `Stream<RoleModel>` | `getRolesStream(Integer firstResult, Integer maxResults)`
    `void` | `removeDefaultRoles(String... defaultRoles)` Removes default roles from this object according to `defaultRoles`.
    `boolean` | `removeRole(RoleModel role)`
    `default Set<RoleModel>` | `searchForRoles(String search, Integer first, Integer max)` Deprecated.
    `Stream<RoleModel>` | `searchForRolesStream(String search, Integer first, Integer max)`
    `default void` | `updateDefaultRoles(String... defaultRoles)` Updates default roles of this object.

- - ### Method Detail

    - #### getId

          String getId()

    - #### getRole

          RoleModel getRole(String name)

    - #### addRole

          RoleModel addRole(String name)

    - #### addRole

          RoleModel addRole(String id,
                            String name)

    - #### removeRole

          boolean removeRole(RoleModel role)

    - #### getRoles

          @Deprecated
          default Set<RoleModel> getRoles()

      Deprecated.

    - #### getRolesStream

          Stream<RoleModel> getRolesStream()

    - #### getRoles

          @Deprecated
          default Set<RoleModel> getRoles(Integer firstResult,
                                                      Integer maxResults)

      Deprecated.

    - #### getRolesStream

          Stream<RoleModel> getRolesStream(Integer firstResult,
                                           Integer maxResults)

    - #### searchForRoles

          @Deprecated
          default Set<RoleModel> searchForRoles(String search,
                                                            Integer first,
                                                            Integer max)

      Deprecated.

    - #### searchForRolesStream

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

    - #### getDefaultRoles

          @Deprecated
          default List<String> getDefaultRoles()

      Deprecated. use the stream variant instead
      Returns all the default role names of this object.
      Returns:
        List of the default role names of this object. Never returns `null`.

    - #### getDefaultRolesStream

          Stream<String> getDefaultRolesStream()

      Returns all default role names of this object as a stream.
      Returns:
        stream of default role names of this object. Never returns `null`.

    - #### addDefaultRole

          void addDefaultRole(String name)

      Adds a role with given name to default roles of this object. If the role doesn't exist a new role is created.
      Parameters:
        `name` - of the role to be (created and ) added

    - #### updateDefaultRoles

          default void updateDefaultRoles(String... defaultRoles)

      Updates default roles of this object. It removes all default roles which are not specified by `defaultRoles` and adds all which weren't present in original default roles. In other words it's the same as calling `Set.retainAll` and `Set.addAll`.
      Parameters:
        `defaultRoles` - Array of realm roles to be updated

    - #### removeDefaultRoles

          void removeDefaultRoles(String... defaultRoles)

      Removes default roles from this object according to `defaultRoles`.
      Parameters:
        `defaultRoles` - Role names to be removed from default roles of this object.

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