Class ChatUsersRegistration


  • @Service
    public class ChatUsersRegistration
    extends Object
    Registers into the remote Chat server an existing Silverpeas user with all of its relationships. If the user is already registered then nothing is performed.
    Author:
    mmoquillon
    • Constructor Detail

      • ChatUsersRegistration

        public ChatUsersRegistration()
    • Method Detail

      • isChatServiceEnabled

        public boolean isChatServiceEnabled()
        Is the chat service enabled in Silverpeas?
        Returns:
        true if the chat service is enabled and then the users can be registered into the chat service. False otherwise.
      • isAlreadyRegistered

        public boolean isAlreadyRegistered​(User user)
        Is the specified user already registered into the remote chat server?
        Parameters:
        user - the user to check the existence.
        Returns:
        true if the user has an account in the remote chat server, false otherwise.
        Throws:
        ChatServerException - a runtime exception if an error occurs while communicating with the remote chat server.
      • registerUser

        public void registerUser​(User user)
        Registers the specified user into the remote chat server. If the user is already registered into the remote chat server, then nothing is performed. If the chat service isn't enabled then nothing is performed. If the Silverpeas domain of the user isn't mapped to a chat domain, then nothing is performed. If the specified user hasn't the right to access the chat service (id est if he doesn't belong to a group allowed to access the chat service in the case this feature is enabled), then nothing is performed.

        With the user registration, his relationships are also browsed in order to create each of them into the remote chat server. If a user targeted by a relationship hasn't yet an account in the chat server, then he's registered before creating the relationship in the server.

        Parameters:
        user - the user to register if not yet done.
        Throws:
        ChatServerException - a runtime exception if the registration fails.