Package org.keycloak.models
Interface GroupModel
- All Superinterfaces:
Model,RoleMapperModel
- All Known Implementing Classes:
GroupAdapter,GroupAdapter
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic enum -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(GroupModel subGroup) Automatically calls setParent() on the subGroupdefault booleangetAttributeStream(String name) Returns group attributes that match the given name as a stream.default LongGet timestamp of group creation.getFirstAttribute(String name) getId()Returns the unique identifier of this model.default LongGet timestamp of last group modification.getName()default LongReturns the number of groups contained beneath this group.Returns all sub groups for the parent group as a stream.default Stream<GroupModel>getSubGroupsStream(Integer firstResult, Integer maxResults) Returns all sub groups for the parent group as a stream, paginated.default Stream<GroupModel>getSubGroupsStream(String search, Boolean exact, Integer firstResult, Integer maxResults) Returns all subgroups for the parent group matching the search as a stream, paginated.default Stream<GroupModel>getSubGroupsStream(String search, Integer firstResult, Integer maxResults) Returns all sub groups for the parent group matching the fuzzy search as a stream, paginated.default GroupModel.TypegetType()voidremoveAttribute(String name) voidremoveChild(GroupModel subGroup) Automatically calls setParent() on the subGroupvoidsetAttribute(String name, List<String> values) default voidsetCreatedTimestamp(Long timestamp) voidsetDescription(String description) default voidsetLastModifiedTimestamp(Long timestamp) voidvoidsetParent(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.Methods inherited from interface org.keycloak.models.RoleMapperModel
deleteRoleMapping, getClientRoleMappingsStream, getRealmRoleMappingsStream, getRoleMappingsStream, grantRole, hasDirectRole, hasRole
-
Field Details
-
COMPARE_BY_NAME
-
-
Method Details
-
getCreatedTimestamp
Get timestamp of group creation. May be null for groups created before this feature introduction. -
setCreatedTimestamp
-
getLastModifiedTimestamp
Get timestamp of last group modification. May be null for groups that have not been modified since this feature was introduced. -
setLastModifiedTimestamp
-
getId
String getId()Description copied from interface:ModelReturns the unique identifier of this model. The identifier is generated by the persistence layer and is not supposed to be manually set. It is used internally to identify the model and should not be confused with any user-facing identifier, such as a username or email.
The identifier is immutable and should not be changed after the model is created.
-
getName
String getName() -
setName
-
getDescription
String getDescription() -
setDescription
-
setSingleAttribute
Set single value of specified attribute. Remove all other existing values- Parameters:
name-value-
-
setAttribute
-
removeAttribute
-
getFirstAttribute
- Parameters:
name-- 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
-
getAttributeStream
Returns group attributes that match the given name as a stream.- 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.
-
getAttributes
-
getParent
GroupModel getParent() -
getParentId
String getParentId() -
getSubGroupsStream
Stream<GroupModel> getSubGroupsStream()Returns all sub groups for the parent group as a stream. The stream is sorted by the group name.- Returns:
- Stream of
GroupModel. Never returnsnull.
-
getSubGroupsStream
default Stream<GroupModel> getSubGroupsStream(String search, Integer firstResult, Integer maxResults) Returns all sub groups for the parent group matching the fuzzy search as a stream, paginated. Stream is sorted by the group name.- Parameters:
search- searched string. If empty ornullall subgroups are returned.- Returns:
- Stream of
GroupModel. Never returnsnull.
-
getSubGroupsStream
Returns all sub groups for the parent group as a stream, paginated.- Parameters:
firstResult- First result to return. Ignored if negative ornull.maxResults- Maximum number of results to return. Ignored if negative ornull.- Returns:
-
getSubGroupsStream
default Stream<GroupModel> getSubGroupsStream(String search, Boolean exact, Integer firstResult, Integer maxResults) Returns all subgroups for the parent group matching the search as a stream, paginated. Stream is sorted by the group name.- Parameters:
search- search string. If empty ornullall subgroups are returned.exact- toggles fuzzy searchingfirstResult- First result to return. Ignored if negative ornull.maxResults- Maximum number of results to return. Ignored if negative ornull.- Returns:
- Stream of
GroupModel. Never returnsnull.
-
getSubGroupsCount
Returns the number of groups contained beneath this group.- Returns:
- The number of groups beneath this group. Never returns
null.
-
setParent
You must also call addChild on the parent group, addChild on RealmModel if there is no parent group- Parameters:
group-
-
addChild
Automatically calls setParent() on the subGroup- Parameters:
subGroup-
-
removeChild
Automatically calls setParent() on the subGroup- Parameters:
subGroup-
-
escapeSlashesInGroupPath
default boolean escapeSlashesInGroupPath() -
getType
-
getOrganization
OrganizationModel getOrganization()- Returns:
- Organization this group belongs to, or null if the group is of
GroupModel.Type.REALM.
-