Package jetbrains.buildServer.groups
Interface UserGroupManager
-
public interface UserGroupManager
A user group manager. Responsible for creation, deletion, and etc of user groups.- Since:
- 4.5
- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_GROUP_KEY_LENGTH
Maximum length of the group key.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addUserGroupListener(UserGroupListener listener)
Adds the specified listener to the manager's list.SUserGroup
createUserGroup(java.lang.String key, java.lang.String name, java.lang.String description)
Creates a new user group.void
deleteUserGroup(SUserGroup group)
Deletes a user group.SUserGroup
findUserGroupByKey(java.lang.String key)
Given a group key method finds the corresponding user group.SUserGroup
findUserGroupByName(java.lang.String name)
Given a group name method finds the corresponding user group.java.util.Set<SUserGroup>
findUserGroupsByPropertyValue(PropertyKey propertyKey, java.lang.String propertyValue, boolean caseSensitive)
Returns set of the user groups having specified property.java.util.List<UserGroup>
getAllHostGroupsOf(User user)
Returns topologically ordered list of all groups containing specified user, directly or through intermediate subgroups.SUserGroup
getAllUsersGroup()
Returns the all-users group.java.util.List<UserGroup>
getHostGroupsOf(User user)
Returns the list of groups that host specified user (directly).java.util.Collection<SUserGroup>
getRootUserGroups()
Returns the collection of root user groups, i.e.java.util.Collection<SUserGroup>
getUserGroups()
Returns the collection of all user groups.boolean
isAllUsersGroup(SUserGroup group)
Returns true, if the specified group is the all-users group.void
removeUserGroupListener(UserGroupListener listener)
Removes the listener from the manager's list.void
renameUserGroup(java.lang.String key, java.lang.String name)
Renames a user group.
-
-
-
Field Detail
-
MAX_GROUP_KEY_LENGTH
static final int MAX_GROUP_KEY_LENGTH
Maximum length of the group key.- See Also:
- Constant Field Values
-
-
Method Detail
-
createUserGroup
@NotNull SUserGroup createUserGroup(@NotNull java.lang.String key, @NotNull java.lang.String name, @NotNull java.lang.String description) throws UserGroupException
Creates a new user group.The
key
is specified by user, but must be unique among all user groups. An attempt to create a user group with existing key results in exception.The
name
must be unique too. Similarly, in case of duplication an exception is thrown.- Parameters:
key
- user group keyname
- user group namedescription
- user group description- Returns:
- a newly created user group
- Throws:
UserGroupException
- if specified key already exists
-
deleteUserGroup
void deleteUserGroup(@NotNull SUserGroup group)
Deletes a user group.Note: the
group
would be deleted from all parent groups automatically, and all subgroups will be reattached to thegroup
's parents.group
's direct users aren't moved anywhere.- Parameters:
group
- a group to delete
-
renameUserGroup
void renameUserGroup(@NotNull java.lang.String key, @NotNull java.lang.String name) throws UserGroupException
Renames a user group.- Parameters:
key
- the group keyname
- new group name- Throws:
UserGroupException
- if the group is not found, or cannot be renamed- See Also:
SUserGroup.setName(String)
-
getUserGroups
@NotNull java.util.Collection<SUserGroup> getUserGroups()
Returns the collection of all user groups.- Returns:
- collection of user groups
- See Also:
getRootUserGroups()
-
getRootUserGroups
@NotNull java.util.Collection<SUserGroup> getRootUserGroups()
Returns the collection of root user groups, i.e. the ones that are not included in any other group.- Returns:
- collection of root user groups
- See Also:
getUserGroups()
-
getHostGroupsOf
@NotNull java.util.List<UserGroup> getHostGroupsOf(@NotNull User user)
Returns the list of groups that host specified user (directly).- Parameters:
user
- the user- Returns:
- list of host groups
-
getAllHostGroupsOf
@NotNull java.util.List<UserGroup> getAllHostGroupsOf(@NotNull User user)
Returns topologically ordered list of all groups containing specified user, directly or through intermediate subgroups.- Parameters:
user
- the user- Returns:
- list of all groups containing the user
-
findUserGroupByKey
@Nullable SUserGroup findUserGroupByKey(@NotNull java.lang.String key)
Given a group key method finds the corresponding user group.- Parameters:
key
- the user group key- Returns:
- user group, or null
-
findUserGroupByName
@Nullable SUserGroup findUserGroupByName(@NotNull java.lang.String name)
Given a group name method finds the corresponding user group.- Parameters:
name
- the user group name- Returns:
- user group, or null
-
findUserGroupsByPropertyValue
@NotNull java.util.Set<SUserGroup> findUserGroupsByPropertyValue(@NotNull PropertyKey propertyKey, @Nullable java.lang.String propertyValue, boolean caseSensitive)
Returns set of the user groups having specified property.- Parameters:
propertyKey
- property keypropertyValue
- property valuecaseSensitive
- whether to perform case sensitive search- Returns:
- see above
- Since:
- 9.0
-
addUserGroupListener
void addUserGroupListener(@NotNull UserGroupListener listener)
Adds the specified listener to the manager's list.- Parameters:
listener
- the listener to add
-
removeUserGroupListener
void removeUserGroupListener(@NotNull UserGroupListener listener)
Removes the listener from the manager's list.- Parameters:
listener
- the listener to remove
-
getAllUsersGroup
@NotNull SUserGroup getAllUsersGroup()
Returns the all-users group.- Returns:
- the all-users group
-
isAllUsersGroup
boolean isAllUsersGroup(@NotNull SUserGroup group)
Returns true, if the specified group is the all-users group.- Parameters:
group
- the group to check- Returns:
- true if the specified group is the all-users group, false otherwise
-
-