Class GroupAdapter
- java.lang.Object
- 
- org.keycloak.models.cache.infinispan.GroupAdapter
 
- 
- All Implemented Interfaces:
- GroupModel,- RoleMapperModel
 
 public class GroupAdapter extends Object implements GroupModel - Version:
- $Revision: 1 $
- Author:
- Bill Burke
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.keycloak.models.GroupModelGroupModel.GroupPathChangeEvent, GroupModel.GroupRemovedEvent, GroupModel.SearchableFields, GroupModel.Streams
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected CachedGroupcachedprotected RealmCacheSessioncacheSessionprotected booleaninvalidatedprotected KeycloakSessionkeycloakSessionprotected RealmModelrealmprotected GroupModelupdated- 
Fields inherited from interface org.keycloak.models.GroupModelCOMPARE_BY_NAME
 
- 
 - 
Constructor SummaryConstructors Constructor Description GroupAdapter(CachedGroup cached, RealmCacheSession cacheSession, KeycloakSession keycloakSession, RealmModel realm)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(GroupModel subGroup)Automatically calls setParent() on the subGroupvoiddeleteRoleMapping(RoleModel role)Removes the given role mapping from this object.booleanequals(Object o)Map<String,List<String>>getAttributes()Stream<String>getAttributeStream(String name)Returns group attributes that match the given name as a stream.Stream<RoleModel>getClientRoleMappingsStream(ClientModel app)Returns stream of client roles that are directly set to this object for the given client.protected voidgetDelegateForUpdate()StringgetFirstAttribute(String name)StringgetId()StringgetName()GroupModelgetParent()StringgetParentId()Stream<RoleModel>getRealmRoleMappingsStream()Returns stream of realm roles that are directly set to this object.Stream<RoleModel>getRoleMappingsStream()Returns stream of all role (both realm all client) that are directly set to this object.Stream<GroupModel>getSubGroupsStream()Returns all sub groups for the parent group as a stream.voidgrantRole(RoleModel role)Grants the given role to this object.booleanhasDirectRole(RoleModel role)Returnstrue, if this object is directly assigned the given role.inthashCode()booleanhasRole(RoleModel role)Returnstrueif this object is directly or indirectly assigned the given role,falseotherwise.voidinvalidate()protected booleanisUpdated()voidremoveAttribute(String name)voidremoveChild(GroupModel subGroup)Automatically calls setParent() on the subGroupvoidsetAttribute(String name, List<String> values)voidsetName(String name)voidsetParent(GroupModel group)You must also call addChild on the parent group, addChild on RealmModel if there is no parent groupvoidsetSingleAttribute(String name, String value)Set single value of specified attribute.
 
- 
- 
- 
Field Detail- 
cachedprotected final CachedGroup cached 
 - 
cacheSessionprotected final RealmCacheSession cacheSession 
 - 
keycloakSessionprotected final KeycloakSession keycloakSession 
 - 
realmprotected final RealmModel realm 
 - 
updatedprotected volatile GroupModel updated 
 - 
invalidatedprotected volatile boolean invalidated 
 
- 
 - 
Constructor Detail- 
GroupAdapterpublic GroupAdapter(CachedGroup cached, RealmCacheSession cacheSession, KeycloakSession keycloakSession, RealmModel realm) 
 
- 
 - 
Method Detail- 
getDelegateForUpdateprotected void getDelegateForUpdate() 
 - 
invalidatepublic void invalidate() 
 - 
isUpdatedprotected boolean isUpdated() 
 - 
getIdpublic String getId() - Specified by:
- getIdin interface- GroupModel
 
 - 
getNamepublic String getName() - Specified by:
- getNamein interface- GroupModel
 
 - 
setNamepublic void setName(String name) - Specified by:
- setNamein interface- GroupModel
 
 - 
setSingleAttributepublic void setSingleAttribute(String name, String value) Description copied from interface:GroupModelSet single value of specified attribute. Remove all other existing values- Specified by:
- setSingleAttributein interface- GroupModel
 
 - 
setAttributepublic void setAttribute(String name, List<String> values) - Specified by:
- setAttributein interface- GroupModel
 
 - 
removeAttributepublic void removeAttribute(String name) - Specified by:
- removeAttributein interface- GroupModel
 
 - 
getFirstAttributepublic String getFirstAttribute(String name) - Specified by:
- getFirstAttributein interface- GroupModel
- Returns:
- null if there is not any value of specified attribute or first value otherwise. Don't throw exception if there are more values of the attribute
 
 - 
getAttributeStreampublic Stream<String> getAttributeStream(String name) Description copied from interface:GroupModelReturns group attributes that match the given name as a stream.- Specified by:
- getAttributeStreamin interface- GroupModel
- Parameters:
- name-- StringName of the attribute to be used as a filter.
- Returns:
- Stream of all attribute values or empty stream if there are not any values. Never return null.
 
 - 
getAttributespublic Map<String,List<String>> getAttributes() - Specified by:
- getAttributesin interface- GroupModel
 
 - 
getRealmRoleMappingsStreampublic Stream<RoleModel> getRealmRoleMappingsStream() Description copied from interface:RoleMapperModelReturns stream of realm roles that are directly set to this object.- Specified by:
- getRealmRoleMappingsStreamin interface- RoleMapperModel
- Returns:
- Stream of RoleModel. Never returnsnull.
 
 - 
getClientRoleMappingsStreampublic Stream<RoleModel> getClientRoleMappingsStream(ClientModel app) Description copied from interface:RoleMapperModelReturns stream of client roles that are directly set to this object for the given client.- Specified by:
- getClientRoleMappingsStreamin interface- RoleMapperModel
- Parameters:
- app-- ClientModelClient to get the roles for.
- Returns:
- Stream of RoleModel. Never returnsnull.
 
 - 
hasDirectRolepublic boolean hasDirectRole(RoleModel role) Description copied from interface:RoleMapperModelReturnstrue, if this object is directly assigned the given role.- Specified by:
- hasDirectRolein interface- RoleMapperModel
- Parameters:
- role- the role
- Returns:
- see description
- See Also:
- if you want to check whether this object is directly or indirectly assigned to a role
 
 - 
hasRolepublic boolean hasRole(RoleModel role) Description copied from interface:RoleMapperModelReturnstrueif this object is directly or indirectly assigned the given role,falseotherwise.For example, trueis returned for hasRole(R) if:- R is directly assigned to this object
- R is indirectly assigned to this object via composites
- R is not assigned to this object but this object belongs to a group G which is assigned the role R
- R is not assigned to this object but this object belongs to a group G, and G belongs to group H which is assigned the role R
 - Specified by:
- hasRolein interface- RoleMapperModel
- Returns:
- see description
- See Also:
- if you want to check if this object is directly assigned to a role
 
 - 
grantRolepublic void grantRole(RoleModel role) Description copied from interface:RoleMapperModelGrants the given role to this object.- Specified by:
- grantRolein interface- RoleMapperModel
 
 - 
getRoleMappingsStreampublic Stream<RoleModel> getRoleMappingsStream() Description copied from interface:RoleMapperModelReturns stream of all role (both realm all client) that are directly set to this object.- Specified by:
- getRoleMappingsStreamin interface- RoleMapperModel
- Returns:
- Stream of RoleModel. Never returnsnull.
 
 - 
deleteRoleMappingpublic void deleteRoleMapping(RoleModel role) Description copied from interface:RoleMapperModelRemoves the given role mapping from this object.- Specified by:
- deleteRoleMappingin interface- RoleMapperModel
- Parameters:
- role- Role to remove
 
 - 
getParentpublic GroupModel getParent() - Specified by:
- getParentin interface- GroupModel
 
 - 
getParentIdpublic String getParentId() - Specified by:
- getParentIdin interface- GroupModel
 
 - 
getSubGroupsStreampublic Stream<GroupModel> getSubGroupsStream() Description copied from interface:GroupModelReturns all sub groups for the parent group as a stream.- Specified by:
- getSubGroupsStreamin interface- GroupModel
- Returns:
- Stream of GroupModel. Never returnsnull.
 
 - 
setParentpublic void setParent(GroupModel group) Description copied from interface:GroupModelYou must also call addChild on the parent group, addChild on RealmModel if there is no parent group- Specified by:
- setParentin interface- GroupModel
 
 - 
addChildpublic void addChild(GroupModel subGroup) Description copied from interface:GroupModelAutomatically calls setParent() on the subGroup- Specified by:
- addChildin interface- GroupModel
 
 - 
removeChildpublic void removeChild(GroupModel subGroup) Description copied from interface:GroupModelAutomatically calls setParent() on the subGroup- Specified by:
- removeChildin interface- GroupModel
 
 
- 
 
-