Package org.keycloak.models.jpa
Class RoleAdapter
- java.lang.Object
-
- org.keycloak.models.jpa.RoleAdapter
-
- All Implemented Interfaces:
JpaModel<RoleEntity>
,RoleModel
public class RoleAdapter extends Object implements RoleModel, JpaModel<RoleEntity>
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.models.RoleModel
RoleModel.RoleNameChangeEvent, RoleModel.SearchableFields
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.persistence.EntityManager
em
protected RealmModel
realm
protected RoleEntity
role
protected KeycloakSession
session
-
Constructor Summary
Constructors Constructor Description RoleAdapter(KeycloakSession session, RealmModel realm, javax.persistence.EntityManager em, RoleEntity role)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.keycloak.models.RoleModel
getFirstAttribute
-
-
-
-
Field Detail
-
role
protected RoleEntity role
-
em
protected javax.persistence.EntityManager em
-
realm
protected RealmModel realm
-
session
protected KeycloakSession session
-
-
Constructor Detail
-
RoleAdapter
public RoleAdapter(KeycloakSession session, RealmModel realm, javax.persistence.EntityManager em, RoleEntity role)
-
-
Method Detail
-
getEntity
public RoleEntity getEntity()
- Specified by:
getEntity
in interfaceJpaModel<RoleEntity>
-
setRole
public void setRole(RoleEntity role)
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceRoleModel
-
setDescription
public void setDescription(String description)
- Specified by:
setDescription
in interfaceRoleModel
-
isComposite
public boolean isComposite()
- Specified by:
isComposite
in interfaceRoleModel
-
addCompositeRole
public void addCompositeRole(RoleModel role)
- Specified by:
addCompositeRole
in interfaceRoleModel
-
removeCompositeRole
public void removeCompositeRole(RoleModel role)
- Specified by:
removeCompositeRole
in interfaceRoleModel
-
getCompositesStream
public Stream<RoleModel> getCompositesStream()
Description copied from interface:RoleModel
Returns all composite roles as a stream.- Specified by:
getCompositesStream
in interfaceRoleModel
- Returns:
- Stream of
RoleModel
. Never returnsnull
.
-
getCompositesStream
public Stream<RoleModel> getCompositesStream(String search, Integer first, Integer max)
Description copied from interface:RoleModel
Returns a paginated stream of composite roles ofthis
role that contain given string in its name.- Specified by:
getCompositesStream
in interfaceRoleModel
- Parameters:
search
- Case-insensitive search stringfirst
- Index of the first result to return. Ignored if negative ornull
.max
- Maximum number of results to return. Ignored if negative ornull
.- Returns:
- A stream of requested roles ordered by the role name
-
setSingleAttribute
public void setSingleAttribute(String name, String value)
- Specified by:
setSingleAttribute
in interfaceRoleModel
-
setAttribute
public void setAttribute(String name, List<String> values)
- Specified by:
setAttribute
in interfaceRoleModel
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttribute
in interfaceRoleModel
-
getAttributeStream
public Stream<String> getAttributeStream(String name)
Description copied from interface:RoleModel
Returns all role's attributes that match the given name as a stream.- Specified by:
getAttributeStream
in interfaceRoleModel
- Parameters:
name
-String
Name of an attribute to be used as a filter.- Returns:
- Stream of
String
. Never returnsnull
.
-
getAttributes
public Map<String,List<String>> getAttributes()
- Specified by:
getAttributes
in interfaceRoleModel
-
isClientRole
public boolean isClientRole()
- Specified by:
isClientRole
in interfaceRoleModel
-
getContainerId
public String getContainerId()
- Specified by:
getContainerId
in interfaceRoleModel
-
getContainer
public RoleContainerModel getContainer()
- Specified by:
getContainer
in interfaceRoleModel
-
-