Class UserManager

    • Constructor Detail

      • UserManager

        protected UserManager()
    • Method Detail

      • getDomainsByUserLogin

        public List<String> getDomainsByUserLogin​(String login)
                                           throws AdminException
        Gets all the domains in which there is a user with the specified login.
        Parameters:
        login - the login of a user in a domain.
        Returns:
        the list of domain identifiers in which there is a user with the given login.
        Throws:
        AdminException - if the getting of the domains fails.
      • isUserExisting

        public boolean isUserExisting​(String id)
                               throws AdminException
        Is the user with the specified identifier exists in Silverpeas?
        Parameters:
        id - the unique identifier of the user to check its existance.
        Returns:
        true if such a user exist or false otherwise.
        Throws:
        AdminException
      • getNumberOfUsersInDomain

        public int getNumberOfUsersInDomain​(String domainId)
                                     throws AdminException
        Gets the number of users in the specified domain.
        Parameters:
        domainId - the unique identifier of the domain.
        Returns:
        the user count in the given domain.
        Throws:
        AdminException - if an error occurs while counting the user in the domain.
      • getUserCount

        public int getUserCount()
                         throws AdminException
        Gets the total number of users in Silverpeas, whatever the domain to which they belong.
        Returns:
        the total number of users in Silverpeas.
        Throws:
        AdminException - if the user counting fails.
      • getAllUsersInGroups

        public UserDetail[] getAllUsersInGroups​(List<String> groupIds)
                                         throws AdminException
        Gets the users that are at least in one of the specified groups or one of their subgroups.
        Parameters:
        groupIds - the unique identifiers of the groups.
        Returns:
        all the users that are in the specified groups and subgroups.
        Throws:
        AdminException - if the getting of users fails.
      • getUsersMatchingCriteria

        public ListSlice<UserDetail> getUsersMatchingCriteria​(UserDetailsSearchCriteria criteria)
                                                       throws AdminException
        Gets the users that match the specified criteria.
        Parameters:
        criteria - the criteria in searching of user details.
        Returns:
        a slice of the list of user details matching the criteria or an empty list of no ones are found.
        Throws:
        AdminException - if an error occurs while getting the user details.
      • getAllUserIdsInGroups

        public List<String> getAllUserIdsInGroups​(List<String> groupIds)
                                           throws AdminException
        Gets the identifier of the users that are at least in one of the specified group or one of their sub-groups
        Parameters:
        groupIds - the idenfifiers of the groups.
        Returns:
        a list of user identifiers.
        Throws:
        AdminException - if the getting fails.
      • getAllUsersInDomain

        public UserDetail[] getAllUsersInDomain​(String sDomainId,
                                                boolean includeRemoved)
                                         throws AdminException
        Gets all the users that belong to the specified domain in order to perform a synchronization with the service backing the domain.
        Parameters:
        sDomainId - the unique identifier of a domain in Silverpeas.
        includeRemoved - true to include removed users, false otherwise.
        Returns:
        an array with all the users in that domain.
        Throws:
        AdminException - if the getting fails.
      • getAllUserIdsInDomain

        public List<String> getAllUserIdsInDomain​(String sDomainId)
                                           throws AdminException
        Gets the identifier of all the users that belong to the specified domain.
        Parameters:
        sDomainId - the unique identifier of the domain in Silverpeas.
        Returns:
        an array with all the user identifiers.
        Throws:
        AdminException - if the getting of the user identifiers fails.
      • getUserIdsByDomainAndByAccessLevel

        public String[] getUserIdsByDomainAndByAccessLevel​(String sDomainId,
                                                           UserAccessLevel accessLevel)
                                                    throws AdminException
        Gets the identifier of all the users that belong to the specified domain and that have the given access level.
        Parameters:
        sDomainId - the unique identifier of a domain in Silverpeas.
        accessLevel - the access level of the users to get.
        Returns:
        an array with all the user identifiers.
        Throws:
        AdminException - if the getting of the user identifiers fails.
      • getManageableSpaceIds

        public Integer[] getManageableSpaceIds​(String sUserId,
                                               List<String> groupIds)
                                        throws AdminException
        Gets the identifiers of all the spaces that are manageable by given user and by the specified groups of users.
        Parameters:
        sUserId - the unique identifier of the space managers.
        groupIds - the unique identifiers of the groups in which users are space managers.
        Returns:
        an array with the identifiers of the spaces.
        Throws:
        AdminException - if an error occurs while getting the space identifiers.
      • getAllUsersIds

        public List<String> getAllUsersIds()
                                    throws AdminException
        Gets the identifier of all the users in Silverpeas.
        Returns:
        an array with the identifier of all the users in Silverpeas.
        Throws:
        AdminException - if an error occurs while getting all the user identifiers.
      • getAllAdminIds

        public String[] getAllAdminIds​(UserDetail fromUser)
                                throws AdminException
        Gets the identifier of all the administrators in the Silverpeas domain of the specified user. These administrators are the users that have the administrative access right or that are the domain manager.
        Parameters:
        fromUser - the user from which the query for administrators are performed. The administrators must be in the same domain than this user.
        Returns:
        an array with the identifier of all the administrators in the domain of the given user.
        Throws:
        AdminException - if an error occurs while querying the administrators.
      • getUserFull

        public UserFull getUserFull​(String sUserId)
                             throws AdminException
        Get full information about the user with the given unique identifier (only info in cache table) from its domain.
        Parameters:
        sUserId - the unique identifier of the user to get.
        Returns:
        a UserFull instance.
        Throws:
        AdminException - if an error occurs while getting the user.
      • listUserFulls

        public List<UserFull> listUserFulls​(Collection<String> userIds)
                                     throws AdminException
        Gets full information about users corresponding to given unique identifiers (only info in cache table) from its domain.
        Parameters:
        userIds - the unique identifiers of user to get.
        Returns:
        list of UserFull instance.
        Throws:
        AdminException - if an error occurs while getting the user.
      • getUserDetail

        public UserDetail getUserDetail​(String sUserId)
                                 throws AdminException
        Get the user corresponding to the given user Id (only infos in cache table).

        If the user does not exists, null is returned.

        Parameters:
        sUserId - the identifier of searched identifier.
        Returns:
        the corresponding UserDetail instance if any, null otherwise.
        Throws:
        AdminException - on technical error.
      • getUserIdBySpecificIdAndDomainId

        public String getUserIdBySpecificIdAndDomainId​(String sSpecificId,
                                                       String sDomainId)
                                                throws AdminException
        Gets the unique identifier of the user in Silverpeas having the specified specific identifier in the given domain.

        If the user does not exists, null is returned.

        Parameters:
        sSpecificId - the specific identifier of the searched user in the given domain.
        sDomainId - the identifier of the domain the user belongs to.
        Returns:
        the corresponding UserDetail instance if any, null otherwise.
        Throws:
        AdminException - on technical error.
      • getUsersBySpecificIdsAndDomainId

        public List<UserDetail> getUsersBySpecificIdsAndDomainId​(Collection<String> specificIds,
                                                                 String domainId)
                                                          throws AdminException
        Gets all the users having the specified unique identifier for the given domain.
        Parameters:
        specificIds - an array of domain specific identifiers.
        domainId - the unique identifier of the domain.
        Returns:
        a list of users matching the identifiers specific to the given domain.
        Throws:
        AdminException
      • getUserIdByLoginAndDomain

        public String getUserIdByLoginAndDomain​(String sLogin,
                                                String sDomainId)
                                         throws AdminException
        Gets the unique identifier of the user in Silverpeas that is qualified by the given login (ignoring the case) and that belongs to the specified domain.

        If the user does not exists, null is returned.

        Parameters:
        sLogin - the login of the searched user in the specified domain.
        sDomainId - the identifier of the domain the user belongs to.
        Returns:
        the corresponding UserDetail instance if any, null otherwise.
        Throws:
        AdminException - on technical error.
      • addUser

        public String addUser​(UserDetail userDetail,
                              boolean addOnlyInSilverpeas,
                              boolean indexation)
                       throws AdminException
        Adds the given user in Silverpeas and optionally in the specified domain in Silverpeas (this only works with domains that can be directly managed by Silverpeas).
        Parameters:
        userDetail - the detail about the user to add.
        addOnlyInSilverpeas - does the user be registered into only Silverpeas? If false, the user will be also registered into the domain the user has to belong to.
        indexation - true to perform indexation.
        Returns:
        the unique identifier of the added user. This identifier is set by the registering process.
        Throws:
        AdminException - if the user registering fails.
      • restoreUser

        public String restoreUser​(UserDetail user,
                                  boolean indexation)
                           throws AdminException
        Restores the given user in Silverpeas.
        Parameters:
        user - the user to restore.
        indexation - true to perform indexation.
        Returns:
        the unique identifier of the restored user.
        Throws:
        AdminException - if the restore fails.
      • removeUser

        public String removeUser​(UserDetail user,
                                 boolean indexation)
                          throws AdminException
        Removes the given user in Silverpeas.
        Parameters:
        user - the user to remove.
        indexation - true to perform indexation.
        Returns:
        the unique identifier of the removed user.
        Throws:
        AdminException - if the remove fails.
      • deleteUser

        public String deleteUser​(UserDetail user,
                                 boolean onlyInSilverpeas)
                          throws AdminException
        Deletes the given user in Silverpeas and optionally in the domain he belongs to (this only works with domains that can be directly managed by Silverpeas).
        Parameters:
        user - the user to delete.
        onlyInSilverpeas - the user has to be deleted only in Silverpeas or also in the domain he belongs to?
        Returns:
        the unique identifier of the deleted user.
        Throws:
        AdminException - if the deletion fails.
      • blankUser

        public void blankUser​(UserDetail user)
                       throws AdminException
        Blanks any profile information about the specified user. This method can be invoked only for already deleted users. Although a user is deleted, profile information are kept in the data source in order to keep the links between him and its contributions within Silverpeas. At his own request, those data can be cleared in the data source so that the links are broken. Nevertheless, to keep the coherence with all of the operations in Silverpeas and to keep them simple, the tuple associated with the user profile isn't deleted in the data source, only the data inside it are blanked. One consequence to this method is to remove its last name and to replace its first name by the term "Anonymous".
        Parameters:
        user - the user to blank in Silverpeas.
        Throws:
        AdminException - if the user isn't deleted or if an error occurs while blanking it.
      • updateUser

        public String updateUser​(UserDetail user,
                                 boolean indexation)
                          throws AdminException
        Updates the given user (only in silverpeas, the user isn't updated in the domain he belongs to).
        Parameters:
        user - the user to update.
        indexation - true to perform indexation.
        Returns:
        the unique identifier of the user that was updated.
        Throws:
        AdminException - if an error occurs while updating the user.
      • updateUserFull

        public String updateUserFull​(UserFull userFull)
                              throws AdminException
        Updates the given user both in Silverpeas and in the domain to which the user belongs.
        Parameters:
        userFull - the user with full information about him.
        Returns:
        the unique identifier of the updated user.
        Throws:
        AdminException - if the update fails.
      • isEmailExisting

        public boolean isEmailExisting​(String email)
                                throws AdminException
        Checks if an existing user already have the given email.
        Parameters:
        email - email to check
        Returns:
        true if at least one user with given email is found. False otherwise.
        Throws:
        AdminException - if the checking fails.
      • getAllUsers

        public List<UserDetail> getAllUsers()
                                     throws AdminException
        Gets all users (except deleted ones) from all domains.
        Returns:
        a List of UserDetail sort by alphabetical order
        Throws:
        AdminException - if getting all the users fails.
      • getAllUsersFromNewestToOldest

        public List<UserDetail> getAllUsersFromNewestToOldest()
                                                       throws AdminException
        Get all users (except deleted ones) from all domains
        Returns:
        a List of UserDetail sort by reverse creation order
        Throws:
        AdminException - if the getting fails.
      • getUsersOfDomains

        public List<UserDetail> getUsersOfDomains​(List<String> domainIds)
                                           throws AdminException
        Get all users (except deleted ones) from specified domains
        Returns:
        a List of UserDetail sort by alphabetical order
        Throws:
        AdminException - if getting all the users in the specified domains fails.
      • getRemovedUsersOfDomains

        public List<UserDetail> getRemovedUsersOfDomains​(String... domainIds)
                                                  throws AdminException
        Gets all the removed users in the specified domains. If no domains are given, then all the removed users in Silverpeas are returned.
        Parameters:
        domainIds - zero, one or more unique identifiers of user domains in Silverpeas.
        Returns:
        a list of the removed users in Silverpeas. If no users are removed in the specified domains, then an empty list is returned.
        Throws:
        AdminException - if the removed users cannot be fetched or if an unexpected exception is thrown.
      • getNonBlankedDeletedUsersOfDomains

        public List<UserDetail> getNonBlankedDeletedUsersOfDomains​(String... domainIds)
                                                            throws AdminException
        Gets all the deleted users in the specified domains. If no domains are given, then all the deleted users in Silverpeas are returned.
        Parameters:
        domainIds - zero, one or more unique identifiers of user domains in Silverpeas.
        Returns:
        a list of the deleted users in Silverpeas. If no users are deleted in the specified domains, then an empty list is returned.
        Throws:
        AdminException - if the deleted users cannot be fetched or if an unexpected exception is thrown.
      • getUsersOfDomainsFromNewestToOldest

        public List<UserDetail> getUsersOfDomainsFromNewestToOldest​(List<String> domainIds)
                                                             throws AdminException
        Get all users (except deleted ones) from specified domains
        Returns:
        a List of UserDetail sort by reverse creation order
        Throws:
        AdminException - if the getting of all the users in the specified domains fails.