Package org.silverpeas.core.admin.user
Class GroupManager
- java.lang.Object
-
- org.silverpeas.core.admin.user.GroupManager
-
-
Field Summary
Fields Modifier and Type Field Description static String
GROUP
static String
GROUP_MANAGER_ADD_GROUP
static String
GROUP_MANAGER_DELETE_GROUP
static String
GROUP_MANAGER_GET_GROUPS_OF_DOMAIN
static String
GROUP_MANAGER_UPDATE_GROUP
static String
IN_GROUP
static String
IN_SILVERPEAS_MESSAGE
-
Constructor Summary
Constructors Modifier Constructor Description protected
GroupManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
addGroup(GroupDetail group, boolean onlyInSilverpeas, boolean indexation)
Add the given group in Silverpeasvoid
addUserInGroup(String sUserId, String sGroupId)
Add a user to a groupvoid
addUsersInGroup(List<String> userIds, String groupId)
List<GroupDetail>
deleteGroup(GroupDetail group, boolean onlyInSilverpeas)
Delete the group with the given Id The delete is apply recursively to the sub-groupsstatic GroupManager
get()
List<GroupDetail>
getAllDirectGroupsOfUser(String sUserId)
Get the direct group ids, whatever theirGroupState
, containing a user.List<GroupDetail>
getAllGroups()
List<String>
getAllGroupsOfUser(String userId)
Get allGroupState.VALID
group ids containing a user.List<GroupDetail>
getAllRootGroups()
Gets all the root user groups in Silverpeas.List<String>
getAllSubGroupIdsRecursively(String superGroupId)
Get the all theGroupState.VALID
subgroup ids of a given group.List<String>
getDirectGroupIdsInRole(String roleId, boolean includeRemoved)
List<String>
getDirectGroupIdsInSpaceRole(String spaceRoleId, boolean includeRemoved)
List<GroupDetail>
getDirectGroupsOfUser(String userId)
Get the directGroupState.VALID
group ids containing a user.GroupDetail
getGroup(String groupId)
Get group information with the given id from SilverpeasGroupDetail
getGroupByNameInDomain(String sGroupName, String sDomainFatherId)
Get group information with the given group nameString
getGroupIdBySpecificIdAndDomainId(String sSpecificId, String sDomainId)
Get the Silverpeas group id of group qualified by given specific Id and domain idSilverpeasList<GroupDetail>
getGroupsMatchingCriteria(GroupsSearchCriteria criteria)
Gets theGroupState.VALID
groups that match the specified criteria.List<GroupDetail>
getGroupsOfDomain(String domainId)
Get the groups of domain, including these withGroupState.REMOVED
state.List<String>
getManageableGroupIds(String userId, List<String> groupIds)
int
getNBUsersDirectlyInGroup(String groupId)
List<String>
getPathToGroup(String groupId)
Get the path from root to a given groupList<GroupDetail>
getRecursivelySubGroups(String groupId)
List<GroupDetail>
getRemovedGroupsOfDomains(String... domainIds)
Gets all the removed groups in the specified domains.GroupDetail[]
getRootGroupsOfDomain(String sDomainId)
List<GroupDetail>
getSubGroups(String groupId)
List<GroupDetail>
getSynchronizedGroups()
int
getTotalUserCountInGroup(String domainId, String groupId)
Gets the total number of users in the specified group, that is to say the number of distinct users in the specified group and in its subgroups.List<String>
getUsersDirectlyInGroup(String groupId)
boolean
isGroupExist(String sName)
/** Check if the given group existsList<GroupDetail>
removeGroup(GroupDetail group, boolean indexation)
Removes the given group in Silverpeas.void
removeUserFromGroup(String sUserId, String sGroupId)
Remove a user from a groupvoid
removeUsersFromGroup(List<String> userIds, String groupId)
List<GroupDetail>
restoreGroup(GroupDetail group, boolean indexation)
Restores the given group in Silverpeas.String
updateGroup(GroupDetail group, boolean onlyInSilverpeas)
Update the given group
-
-
-
Field Detail
-
GROUP
public static final String GROUP
- See Also:
- Constant Field Values
-
GROUP_MANAGER_GET_GROUPS_OF_DOMAIN
public static final String GROUP_MANAGER_GET_GROUPS_OF_DOMAIN
- See Also:
- Constant Field Values
-
GROUP_MANAGER_ADD_GROUP
public static final String GROUP_MANAGER_ADD_GROUP
- See Also:
- Constant Field Values
-
GROUP_MANAGER_UPDATE_GROUP
public static final String GROUP_MANAGER_UPDATE_GROUP
- See Also:
- Constant Field Values
-
IN_GROUP
public static final String IN_GROUP
- See Also:
- Constant Field Values
-
GROUP_MANAGER_DELETE_GROUP
public static final String GROUP_MANAGER_DELETE_GROUP
- See Also:
- Constant Field Values
-
IN_SILVERPEAS_MESSAGE
public static final String IN_SILVERPEAS_MESSAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public static GroupManager get()
-
getGroupsMatchingCriteria
public SilverpeasList<GroupDetail> getGroupsMatchingCriteria(GroupsSearchCriteria criteria) throws AdminException
Gets theGroupState.VALID
groups that match the specified criteria.- Parameters:
criteria
- the criteria in searching of user groups.- Returns:
- a slice of the list of user groups matching the criteria or an empty list of no ones are found.
- Throws:
AdminException
- if an error occurs while getting the user groups.
-
getTotalUserCountInGroup
public int getTotalUserCountInGroup(String domainId, String groupId) throws AdminException
Gets the total number of users in the specified group, that is to say the number of distinct users in the specified group and in its subgroups.- Parameters:
domainId
- the unique identifier to which the group belong.groupId
- the unique identifier of the group.- Returns:
- the total users count in the specified group.
- Throws:
AdminException
- if an error occurs while computing the user count.
-
addUserInGroup
public void addUserInGroup(String sUserId, String sGroupId) throws AdminException
Add a user to a group- Parameters:
sUserId
-sGroupId
-- Throws:
AdminException
-
addUsersInGroup
public void addUsersInGroup(List<String> userIds, String groupId) throws AdminException
- Throws:
AdminException
-
removeUserFromGroup
public void removeUserFromGroup(String sUserId, String sGroupId) throws AdminException
Remove a user from a group- Parameters:
sUserId
-sGroupId
-- Throws:
AdminException
-
removeUsersFromGroup
public void removeUsersFromGroup(List<String> userIds, String groupId) throws AdminException
- Throws:
AdminException
-
getDirectGroupIdsInSpaceRole
public List<String> getDirectGroupIdsInSpaceRole(String spaceRoleId, boolean includeRemoved) throws AdminException
- Throws:
AdminException
-
getDirectGroupsOfUser
public List<GroupDetail> getDirectGroupsOfUser(String userId) throws AdminException
Get the directGroupState.VALID
group ids containing a user. Groups that the user is linked to by transitivity are not returned.- Parameters:
userId
- an identifier of a user.- Returns:
- a list of
GroupDetail
instance. - Throws:
AdminException
- in any technical error.
-
getAllDirectGroupsOfUser
public List<GroupDetail> getAllDirectGroupsOfUser(String sUserId) throws AdminException
Get the direct group ids, whatever theirGroupState
, containing a user. Groups that the user is linked to by transitivity are not returned.- Parameters:
sUserId
- an identifier of a user.- Returns:
- a list of
GroupDetail
instance. - Throws:
AdminException
- in any technical error.
-
getAllGroupsOfUser
public List<String> getAllGroupsOfUser(String userId) throws AdminException
Get allGroupState.VALID
group ids containing a user. So, groups that the user is linked to by transitivity are returned too (recursive treatment).- Parameters:
userId
- identifier of a user.- Returns:
- list of group identifiers.
- Throws:
AdminException
- on any technical error.
-
getGroupIdBySpecificIdAndDomainId
public String getGroupIdBySpecificIdAndDomainId(String sSpecificId, String sDomainId) throws AdminException
Get the Silverpeas group id of group qualified by given specific Id and domain id- Parameters:
sSpecificId
-sDomainId
-- Returns:
- Throws:
AdminException
-
getAllGroups
public List<GroupDetail> getAllGroups() throws AdminException
- Throws:
AdminException
-
getAllRootGroups
public List<GroupDetail> getAllRootGroups() throws AdminException
Gets all the root user groups in Silverpeas.- Returns:
- a list of root user groups.
- Throws:
AdminException
- if an error occurs while getting the root groups.
-
getSubGroups
public List<GroupDetail> getSubGroups(String groupId) throws AdminException
- Throws:
AdminException
-
getRecursivelySubGroups
public List<GroupDetail> getRecursivelySubGroups(String groupId) throws AdminException
- Throws:
AdminException
-
getPathToGroup
public List<String> getPathToGroup(String groupId) throws AdminException
Get the path from root to a given group- Parameters:
groupId
-- Returns:
- Throws:
AdminException
-
isGroupExist
public boolean isGroupExist(String sName) throws AdminException
/** Check if the given group exists- Parameters:
sName
-- Returns:
- true if a group with the given name
- Throws:
AdminException
-
getGroup
public GroupDetail getGroup(String groupId) throws AdminException
Get group information with the given id from Silverpeas- Parameters:
groupId
-- Returns:
- Throws:
AdminException
-
getAllSubGroupIdsRecursively
public List<String> getAllSubGroupIdsRecursively(String superGroupId) throws AdminException
Get the all theGroupState.VALID
subgroup ids of a given group.- Parameters:
superGroupId
- the identifier of the parent group.- Returns:
- a list of group identifier.
- Throws:
AdminException
- in case of any technical error.
-
getGroupByNameInDomain
public GroupDetail getGroupByNameInDomain(String sGroupName, String sDomainFatherId) throws AdminException
Get group information with the given group name- Parameters:
sGroupName
-sDomainFatherId
-- Returns:
- Throws:
AdminException
-
getRootGroupsOfDomain
public GroupDetail[] getRootGroupsOfDomain(String sDomainId) throws AdminException
- Parameters:
sDomainId
-- Returns:
- Throws:
AdminException
-
getSynchronizedGroups
public List<GroupDetail> getSynchronizedGroups() throws AdminException
- Throws:
AdminException
-
getGroupsOfDomain
public List<GroupDetail> getGroupsOfDomain(String domainId) throws AdminException
Get the groups of domain, including these withGroupState.REMOVED
state.- Parameters:
domainId
- the identifier of the domain.- Returns:
- a list of
GroupDetail
instance. - Throws:
AdminException
- if any technical occurs.
-
getDirectGroupIdsInRole
public List<String> getDirectGroupIdsInRole(String roleId, boolean includeRemoved) throws AdminException
- Throws:
AdminException
-
addGroup
public String addGroup(GroupDetail group, boolean onlyInSilverpeas, boolean indexation) throws AdminException
Add the given group in Silverpeas- Parameters:
group
-onlyInSilverpeas
-indexation
-- Returns:
- Throws:
AdminException
-
restoreGroup
public List<GroupDetail> restoreGroup(GroupDetail group, boolean indexation) throws AdminException
Restores the given group in Silverpeas.- Parameters:
group
- the group to restore.indexation
- true to perform indexation.- Returns:
- all parent group ids (including given group at first position).
- Throws:
AdminException
- if the restore fails.
-
removeGroup
public List<GroupDetail> removeGroup(GroupDetail group, boolean indexation) throws AdminException
Removes the given group in Silverpeas.- Parameters:
group
- the group to remove.indexation
- true to perform indexation.- Returns:
- all removed subgroup ids (including given group at first position).
- Throws:
AdminException
- if the remove fails.
-
deleteGroup
public List<GroupDetail> deleteGroup(GroupDetail group, boolean onlyInSilverpeas) throws AdminException
Delete the group with the given Id The delete is apply recursively to the sub-groups- Parameters:
group
-onlyInSilverpeas
-- Returns:
- Throws:
AdminException
-
updateGroup
public String updateGroup(GroupDetail group, boolean onlyInSilverpeas) throws AdminException
Update the given group- Parameters:
group
-onlyInSilverpeas
-- Returns:
- Throws:
AdminException
-
getManageableGroupIds
public List<String> getManageableGroupIds(String userId, List<String> groupIds) throws AdminException
- Throws:
AdminException
-
getNBUsersDirectlyInGroup
public int getNBUsersDirectlyInGroup(String groupId) throws AdminException
- Throws:
AdminException
-
getUsersDirectlyInGroup
public List<String> getUsersDirectlyInGroup(String groupId) throws AdminException
- Throws:
AdminException
-
getRemovedGroupsOfDomains
public List<GroupDetail> getRemovedGroupsOfDomains(String... domainIds) throws AdminException
Gets all the removed groups in the specified domains. If no domains are given, then all the removed groups in Silverpeas are returned.- Parameters:
domainIds
- zero, one or more unique identifiers of group domains in Silverpeas.- Returns:
- a list of the removed groups in Silverpeas. If no groups are removed in the specified domains, then an empty list is returned.
- Throws:
AdminException
- if the removed groups cannot be fetched or if an unexpected exception is thrown.
-
-