Class ChatUser

  • All Implemented Interfaces:
    Serializable, Comparable<User>, User

    public class ChatUser
    extends UserDetail
    A Silverpeas user with an account in a Chat service. The Silverpeas Chat Engine uses the services of an external chat server; so each user in Silverpeas has also an account in the chat server and hence has a unique identifier in that chat service.
    Author:
    remipassmoilesel
    See Also:
    Serialized Form
    • Method Detail

      • getById

        public static ChatUser getById​(String userId)
        Gets a chat user from the specified Silverpeas unique identifier.
        Parameters:
        userId - the unique identifier of a user in Silverpeas.
        Returns:
        a user having an account in Silverpeas.
      • getCurrentRequester

        public static ChatUser getCurrentRequester()
        Gets the user behind the current request to Silverpeas and that have an account in the chat service.
        Returns:
        the current requester as a ChatUser.
      • fromUser

        public static ChatUser fromUser​(User user)
        Creates a new ChatUser from the specified Silverpeas user. It will convert the specified user to a chat user.
        Parameters:
        user - a Silverpeas user.
        Returns:
        a Chat service user.
      • getChatId

        public String getChatId()
        Gets the unique identifier of this user in the chat service. It is made up of the user login plus the domain of the chat service; they are concatenated with @ as separator.
        Returns:
        the unique identifier of the user the the chat service.
      • getChatLogin

        public String getChatLogin()
        Gets the chat service login of this user. The login format is defined by the RFC-7622 in which it represents the localpart field conforming the UsernameCaseMapped profile of the PRECIS IdentifierClass defined in RFC-7613.
        Returns:
        the login of the user in the chat service.
      • getChatPassword

        public String getChatPassword()
        Gets the chat service password of this user.
        Returns:
        the password associated with its login in the chat service.
      • getChatDomain

        public String getChatDomain()
        Gets the chat domain to which this user belongs. The chat domain is read from the property file org/silverpeas/chat/settings/chat.properties and it depends on the Silverpeas domain of the user. If no chat domain is mapped to the Silverpeas domain of the user, then the default one (the one set by the chat.xmpp.domain.default property) is returned.
        Returns:
        the name of the chat domain of the user or an empty string if no chat domain is mapped to the Silverpeas domain of the user.
      • isChatEnabled

        public boolean isChatEnabled()
        Is the chat service is enabled for this user? It is enabled if both the chat service is enabled in Silverpeas, the user domain he belongs to is mapped to a chat domain in the chat service and he belongs to a group of users in Silverpeas that is allowed to access the chat service.
        Returns:
        true if the chat is enabled for the user. False otherwise.
      • isRegistered

        public boolean isRegistered()
        Has the user already an account in the chat server?
        Returns:
        true if isChatEnabled() returns true and if the user has an account in the chat server, false otherwise or if ChatServerException has been detected.
      • isAtLeastInOneGroup

        public boolean isAtLeastInOneGroup​(List<String> groupIds)
        Is the user at least in one of the following groups of users in Silverpeas? This method is mainly used to check the ACL on the chat client functionalities when bootstrapping later.
        Parameters:
        groupIds - a list of unique identifiers of group of users in Silverpeas.
        Returns:
        true if the user is at least in one of the specified groups.
      • getId

        public String getId()
        Description copied from interface: User
        The unique identifier of the user into Silverpeas.
        Specified by:
        getId in interface User
        Overrides:
        getId in class UserDetail
        Returns:
        identifier as string.
      • getDomainId

        public String getDomainId()
        Description copied from interface: User
        Gets the user domain id.
        Specified by:
        getDomainId in interface User
        Overrides:
        getDomainId in class UserDetail
        Returns:
        user domain id as string.
      • isDomainRestricted

        public boolean isDomainRestricted()
        Description copied from interface: User
        Indicates if the user is restricted to access the resource in its own domain only.
        Specified by:
        isDomainRestricted in interface User
        Overrides:
        isDomainRestricted in class UserDetail
        Returns:
        true if it's restricted, false otherwise.
      • isDomainAdminRestricted

        public boolean isDomainAdminRestricted()
        Description copied from interface: User
        Indicates if the user has admin account and is restricted to access the resource in its own domain only.
        Specified by:
        isDomainAdminRestricted in interface User
        Overrides:
        isDomainAdminRestricted in class UserDetail
        Returns:
        true if it's restricted, false otherwise.
      • getLogin

        public String getLogin()
        Description copied from interface: User
        Gets the user login.
        Specified by:
        getLogin in interface User
        Overrides:
        getLogin in class UserDetail
        Returns:
        user login as string.
      • getLastName

        public String getLastName()
        Description copied from interface: User
        Gets the last name of the user.
        Specified by:
        getLastName in interface User
        Overrides:
        getLastName in class UserDetail
        Returns:
        last name as string.
      • getFirstName

        public String getFirstName()
        Description copied from interface: User
        Gets the first name of the user.
        Specified by:
        getFirstName in interface User
        Overrides:
        getFirstName in class UserDetail
        Returns:
        first name as string.
      • geteMail

        public String geteMail()
        Description copied from interface: User
        Gets the user email.
        Specified by:
        geteMail in interface User
        Overrides:
        geteMail in class UserDetail
        Returns:
        user email as string.
      • getSaveDate

        public Date getSaveDate()
        Description copied from interface: User
        Gets the date of the last user save.
        Specified by:
        getSaveDate in interface User
        Overrides:
        getSaveDate in class UserDetail
        Returns:
        the date of the last user save as Date.
      • getVersion

        public int getVersion()
        Description copied from interface: User
        Gets the version of the user data. The number of time the entity has been saved in other words.
        Specified by:
        getVersion in interface User
        Overrides:
        getVersion in class UserDetail
        Returns:
        the version of the last save as integer.
      • getStateSaveDate

        public Date getStateSaveDate()
        Description copied from interface: User
        Gets the last date of the last user save.
        Specified by:
        getStateSaveDate in interface User
        Overrides:
        getStateSaveDate in class UserDetail
        Returns:
        the date of last user state save (when it changes) as Date.
      • isFullyDefined

        public boolean isFullyDefined()
        Description copied from interface: User
        Indicates if the mandatory user data are defined.
        Specified by:
        isFullyDefined in interface User
        Overrides:
        isFullyDefined in class UserDetail
        Returns:
        true if all mandatory are defined, false otherwise.
      • getDisplayedName

        public String getDisplayedName()
        Description copied from interface: User
        Default first name and last name concatenation.
        Specified by:
        getDisplayedName in interface User
        Overrides:
        getDisplayedName in class UserDetail
        Returns:
        concatenation of first name and last name as string (without outer space).
      • isAnonymous

        public boolean isAnonymous()
        Description copied from interface: User
        Indicates if the user is an anonymous one.
        Specified by:
        isAnonymous in interface User
        Overrides:
        isAnonymous in class UserDetail
        Returns:
        true if anonymous, false otherwise.
      • isSystem

        public boolean isSystem()
        Description copied from interface: User
        Is this user the system one? A system user is a virtual one played by the Silverpeas platform to perform tasks that aren't invoked explicitly by a user in Silverpeas but triggered either by a scheduler or a batch process like a workflow.
        Specified by:
        isSystem in interface User
        Overrides:
        isSystem in class UserDetail
        Returns:
        true if this user is the virtual system one. False otherwise.
      • isBlanked

        public boolean isBlanked()
        Description copied from interface: User
        Indicates if the user was blanked after its deletion. Blank a user means its data has been blanked and therefore any of his contributions in Silverpeas can be figured out; his contributions were anonymized.
        Specified by:
        isBlanked in interface User
        Overrides:
        isBlanked in class UserDetail
        Returns:
        true if the user was blanked.
      • isAccessAdmin

        public boolean isAccessAdmin()
        Description copied from interface: User
        Indicates if the user has admin access on the platform.
        Specified by:
        isAccessAdmin in interface User
        Overrides:
        isAccessAdmin in class UserDetail
        Returns:
        true if admin access, false otherwise.
      • isAccessDomainManager

        public boolean isAccessDomainManager()
        Description copied from interface: User
        Indicates if the user has domain manager access on the platform.
        Specified by:
        isAccessDomainManager in interface User
        Overrides:
        isAccessDomainManager in class UserDetail
        Returns:
        true if domain manager access, false otherwise.
      • isAccessSpaceManager

        public boolean isAccessSpaceManager()
        Description copied from interface: User
        Indicates if the user has space manager access on the platform.
        Specified by:
        isAccessSpaceManager in interface User
        Overrides:
        isAccessSpaceManager in class UserDetail
        Returns:
        true if space manager access, false otherwise.
      • isAccessPdcManager

        public boolean isAccessPdcManager()
        Description copied from interface: User
        Indicates if the user has PDC manager access on the platform.
        Specified by:
        isAccessPdcManager in interface User
        Overrides:
        isAccessPdcManager in class UserDetail
        Returns:
        true if PDC manager access, false otherwise.
      • isAccessUser

        public boolean isAccessUser()
        Description copied from interface: User
        Indicates if the user has user access on the platform.
        Specified by:
        isAccessUser in interface User
        Overrides:
        isAccessUser in class UserDetail
        Returns:
        true if user access, false otherwise.
      • isAccessGuest

        public boolean isAccessGuest()
        Description copied from interface: User
        Indicates if the user has guest access on the platform.
        Specified by:
        isAccessGuest in interface User
        Overrides:
        isAccessGuest in class UserDetail
        Returns:
        true if guest access, false otherwise.
      • isAccessUnknown

        public boolean isAccessUnknown()
        Description copied from interface: User
        Indicates if the user has unknown access on the platform.
        Specified by:
        isAccessUnknown in interface User
        Overrides:
        isAccessUnknown in class UserDetail
        Returns:
        true if unknown access, false otherwise.
      • isValidState

        public boolean isValidState()
        Description copied from interface: User
        This method is the only one able to indicate the user validity state. Please do not use User.getState() to retrieve user validity information.
        Specified by:
        isValidState in interface User
        Overrides:
        isValidState in class UserDetail
        Returns:
        true if valid state, false otherwise.
      • isDeletedState

        public boolean isDeletedState()
        Description copied from interface: User
        This method is the only one able to indicate the user deletion state. Please do not use User.getState() to retrieve user deletion information.
        Specified by:
        isDeletedState in interface User
        Overrides:
        isDeletedState in class UserDetail
        Returns:
        true if deleted state, false otherwise.
      • isRemovedState

        public boolean isRemovedState()
        Description copied from interface: User
        This method is the only one able to indicate the user removed state. Please do not use User.getState() to retrieve user removed information.
        Specified by:
        isRemovedState in interface User
        Overrides:
        isRemovedState in class UserDetail
        Returns:
        true if deleted state, false otherwise.
      • isBlockedState

        public boolean isBlockedState()
        Description copied from interface: User
        This method is the only one able to indicate the user blocked state. Please do not use User.getState() to retrieve user blocked information.
        Specified by:
        isBlockedState in interface User
        Overrides:
        isBlockedState in class UserDetail
        Returns:
        true if blocked state, false otherwise.
      • isDeactivatedState

        public boolean isDeactivatedState()
        Description copied from interface: User
        This method is the only one able to indicate the user deactivated state. Please do not use User.getState() to retrieve user deactivated information.
        Specified by:
        isDeactivatedState in interface User
        Overrides:
        isDeactivatedState in class UserDetail
        Returns:
        true if deactivated state, false otherwise.
      • isExpiredState

        public boolean isExpiredState()
        Description copied from interface: User
        This method is the only one able to indicate the user expiration state. Please do not use User.getState() to retrieve user expiration information.
        Specified by:
        isExpiredState in interface User
        Overrides:
        isExpiredState in class UserDetail
        Returns:
        true if user is expired.
      • isConnected

        public boolean isConnected()
        Description copied from interface: User
        Indicates if the user is currently connected to Silverpeas.
        Specified by:
        isConnected in interface User
        Overrides:
        isConnected in class UserDetail
        Returns:
        true if the user is currently connected to Silverpeas, false otherwise.
      • getAvatar

        public String getAvatar()
        Description copied from interface: User
        Gets the avatar URL of the user.
        Specified by:
        getAvatar in interface User
        Overrides:
        getAvatar in class UserDetail
        Returns:
        the avatar URL as string.
      • getStatus

        public String getStatus()
        Description copied from interface: User
        Gets the current status filled by the user itself.
        Specified by:
        getStatus in interface User
        Overrides:
        getStatus in class UserDetail
        Returns:
        current status as string.
      • getDurationOfCurrentSession

        public String getDurationOfCurrentSession()
        Description copied from interface: User
        Gets the duration of the current user session since its last registered login date.
        Specified by:
        getDurationOfCurrentSession in interface User
        Overrides:
        getDurationOfCurrentSession in class UserDetail
        Returns:
        the formatted duration of the current user session, or empty string if the user is not connected.