Class ChatUsersRegistration


  • @Service
    public class ChatUsersRegistration
    extends Object
    Registration of a user in the remote Chat server.
    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.
      • unregisterUser

        public void unregisterUser​(User user)
        Unregisters the specified user from the remote chat server. If the chat service isn't enabled then nothing is done. If the user isn't registered into the chat service then nothing is done.
        Parameters:
        user - the user to unregister.
        Throws:
        ChatServerException - a runtime exception if the user cannot be unregistered.
        API Note:
        This is a shortcut of the ChatServer.deleteUser(User) method but by checking the chat service is enabled and the user has an account on the remote chat service.