Class GroupManager

    • Constructor Detail

      • GroupManager

        protected GroupManager()
    • Method Detail

      • getGroupsMatchingCriteria

        public SilverpeasList<GroupDetail> getGroupsMatchingCriteria​(GroupsSearchCriteria criteria)
                                                              throws AdminException
        Gets the GroupState.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 - the unique identifier of the user.
        sGroupId - the unique identifier of the group.
        Throws:
        AdminException - if the user cannot be added into the group.
      • removeUserFromGroup

        public void removeUserFromGroup​(String sUserId,
                                        String sGroupId)
                                 throws AdminException
        Remove a user from a group
        Parameters:
        sUserId - the unique identifier of the user.
        sGroupId - the unique identifier of the group.
        Throws:
        AdminException - if the removing of the user from the group fails.
      • getAllDirectGroupsOfUser

        public List<GroupDetail> getAllDirectGroupsOfUser​(String sUserId)
                                                   throws AdminException
        Get the direct group ids, whatever their GroupState, 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 all GroupState.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 identifier of the group by its identifier specific to the specified domain.
        Parameters:
        sSpecificId - the specific identifier of the group in the user domain it belongs to.
        sDomainId - the unique identifier of the domain in which the group is defined.
        Returns:
        the unique identifier of the group in Silverpeas.
        Throws:
        AdminException - if an error occurs while getting the unique identifier of the group.
      • 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.
      • getPathToGroup

        public List<String> getPathToGroup​(String groupId)
                                    throws AdminException
        Get the path from root to the given group.
        Parameters:
        groupId - the unique identifier of a group.
        Returns:
        a list of hierachical parent groups, from the root one to the direct parent of the specified group.
        Throws:
        AdminException - if an error occurs while getting the path of the specified group.
      • isGroupExist

        public boolean isGroupExist​(String sName)
                             throws AdminException
        /** Check if there is at least one group in Silverpeas having the specified name.
        Parameters:
        sName - the name of a group.
        Returns:
        true if at least one group with the given name exists in Silverpeas. False otherwise.
        Throws:
        AdminException - if an error occurs while checking the name.
      • getGroup

        public GroupDetail getGroup​(String groupId)
                             throws AdminException
        Get group information with the given id from Silverpeas
        Parameters:
        groupId - the unique identifier of a group.
        Returns:
        the group with the given identifier.
        Throws:
        AdminException - if an error occurs while getting the group and setting its direct users.
      • getAllSubGroupIdsRecursively

        public List<String> getAllSubGroupIdsRecursively​(String superGroupId)
                                                  throws AdminException
        Get the all the GroupState.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 name and in the specified domain.
        Parameters:
        sGroupName - the name of a group.
        sDomainFatherId - the unique identifier of a domain.
        Returns:
        the group or null if no such group exists.
        Throws:
        AdminException - if an error occurs while getting the group details.
      • getRootGroupsOfDomain

        public GroupDetail[] getRootGroupsOfDomain​(String sDomainId)
                                            throws AdminException
        Gets all the root groups of the specified domain.
        Parameters:
        sDomainId - the unique identifier of a domain.
        Returns:
        an array with all the root groups details.
        Throws:
        AdminException - if an error occurs while getting the root groups of the given domain.
      • addGroup

        public String addGroup​(GroupDetail group,
                               boolean onlyInSilverpeas,
                               boolean indexation)
                        throws AdminException
        Add the given group in Silverpeas
        Parameters:
        group - the group to add.
        onlyInSilverpeas - a flag indicating if the group has to be added in Silverpeas only and not also in the domain. The mixed domain is a specific domain of Silverpeas and the flag should be true for a group to add into this domain.
        indexation - a flag indicating if the group has to be indexed once added.
        Returns:
        the unique identifier of the added group.
        Throws:
        AdminException - if an error occurs while adding the group in Silverpeas.
      • 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 - the group to delete.
        onlyInSilverpeas - a flag indicating if the group has to be delete in Silverpeas only and not also in the domain. The mixed domain is a specific domain of Silverpeas and the flag should be true for a group of this domain.
        Returns:
        a list of all the deleted groups (the group itself and its children groups).
        Throws:
        AdminException - if an error occurs while deleting the group and its children groups.
      • updateGroup

        public String updateGroup​(GroupDetail group,
                                  boolean onlyInSilverpeas)
                           throws AdminException
        Update the given group
        Parameters:
        group - the new details of the group.
        onlyInSilverpeas - a flag indicating if the group has to be updated in Silverpeas only and not also in the domain. The mixed domain is a specific domain of Silverpeas and the flag should be true for a group of this domain.
        Returns:
        the unique identifier of the updated group.
        Throws:
        AdminException - if an error occurs while updating the group with the given details.
      • 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.