Interface IChatManager

  • All Known Implementing Classes:
    ChatManager

    @StableMinor(version="17.0",
                 sinceVersion="4.0")
    public interface IChatManager
    Interface for managing Chat Objects
    Since:
    4.0.5
    Version:
    $Revision: 26586 $ $Date: 2024-08-26 21:06:04 -0300 (Mon, 26 Aug 2024) $
    • Method Detail

      • getUser

        ChatUserConfig getUser​(SessionConfig sessionConfig,
                               java.lang.String userId,
                               java.lang.String conversationId,
                               java.lang.String userSessionId,
                               ITransaction transaction)
                        throws PortalException
        Returns a chat user given the portal user id, conversation id and optionally the user sessionId
        Parameters:
        sessionConfig -
        userId -
        conversationId -
        userSessionId -
        transaction -
        Returns:
        Throws:
        PortalException
      • updateActiveUserState

        void updateActiveUserState​(SessionConfig sessionConfig,
                                   ITransaction transaction)
                            throws PortalException
        Checks if any of the active users have not updated their last acces date. If not, change their state to inactive
        Parameters:
        sessionConfig -
        transaction -
        Throws:
        PortalException
      • reachedUserLimit

        boolean reachedUserLimit​(SessionConfig sessionConfig,
                                 java.lang.String conversationId,
                                 ITransaction transaction)
                          throws PortalException
        Returns true if the conversation has reached its user limit
        Parameters:
        sessionConfig -
        conversationId -
        transaction -
        Returns:
        Throws:
        PortalException
      • deleteConversation

        void deleteConversation​(SessionConfig sessionConfig,
                                java.lang.String conversationId,
                                ITransaction transaction)
                         throws PortalException
        Deletes the given chat conversation.
        Parameters:
        sessionConfig -
        conversationId -
        transaction -
        Throws:
        PortalException
      • openStartedConversations

        void openStartedConversations​(SessionConfig sessionConfig,
                                      ITransaction transaction)
                               throws PortalException
        Opens the conversations whose startTime has already been reached.
        Parameters:
        sessionConfig - the user session information.
        transaction - the transaction for persistence access.
        Throws:
        PortalException
        Since:
        4.0.11
      • getMessages

        java.util.Collection<ChatMessageConfig> getMessages​(SessionConfig sessionConfig,
                                                            java.lang.String conversationId,
                                                            ITransaction transaction)
                                                     throws PortalException
        Returns all the messages for a given conversationId. The messages are returned ordered by creation date.
        Parameters:
        sessionConfig -
        messageId -
        transaction -
        Returns:
        Throws:
        PortalException
      • getLatestMessages

        @Deprecated
        java.util.List<ChatMessageConfig> getLatestMessages​(SessionConfig sessionConfig,
                                                            java.lang.String conversationId,
                                                            java.lang.String chatUserId,
                                                            int maxMessages,
                                                            boolean getMessagesToModerate,
                                                            java.util.Date greaterThanDate,
                                                            ITransaction transaction)
                                                     throws PortalException
        Returns up to maxMessages messageConfigs for a given conversationId. If more than maxMessages exist, the most recent messages are returned. The messages are returned ordered by creation date.
        Parameters:
        sessionConfig - the user session information.
        conversationId - the conversation identifier.
        chatUserId - the chat user identifier. If null no private messages are returned. If specified the private messages for that user are returned.
        maxMessages - the maximum number of messages to be returned.
        getMessagesToModerate - if true the messages to moderate are also returned.
        greaterThanDate - if not null, only the message with sent date-time greater than this argument are returned.
        transaction - the transaction for persistence access.
        Returns:
        the messages.
        Throws:
        PortalException
      • getLatestMessages

        java.util.List<ChatMessageConfig> getLatestMessages​(SessionConfig sessionConfig,
                                                            java.lang.String conversationId,
                                                            java.lang.String chatUserId,
                                                            int firstMessageIndex,
                                                            int maxMessages,
                                                            boolean getMessagesToModerate,
                                                            java.util.Date greaterThanDate,
                                                            ITransaction transaction)
                                                     throws PortalException
        Returns up to maxMessages messageConfigs for a given conversationId. If more than maxMessages exist, the most recent messages are returned. The messages returned start at the firstMessage zero-based index. The messages are returned ordered by descending sent date-time.
        Parameters:
        sessionConfig - the user session information.
        conversationId - the conversation identifier.
        chatUserId - the chat user identifier. If null no private messages are returned. If specified the private messages for that user are returned.
        firstMessageIndex - the index of the first message to be returned. This index is zero based. May be used for pagination.
        maxMessages - the maximum number of messages to be returned.
        getMessagesToModerate - if true the messages to moderate are also returned.
        greaterThanDate - if not null, only the message with sent date-time greater than this argument are returned.
        transaction - the transaction for persistence access.
        Returns:
        the list of messages.
        Throws:
        PortalException
        Since:
        4.0.11
      • getMessagesXml

        java.lang.String getMessagesXml​(SessionConfig sessionConfig,
                                        java.util.Collection<ChatMessageConfig> chatMessageConfigs,
                                        boolean getMessagesToModerate,
                                        java.util.List<IResource> resources,
                                        ITransaction transaction)
                                 throws PortalException
        Returns the xml for the given messages. The collection's iterator ordering will be used.
        Parameters:
        sessionConfig - the user session information.
        chatMessageConfigs - the messages collection.
        getMessagesToModerate - if true the messages to moderate are also returned.
        resources - resources used for localization.
        transaction - the transaction for persistence access.
        Returns:
        the xml.
        Throws:
        PortalException
        Since:
        4.0.11
      • getLatestMessagesCount

        int getLatestMessagesCount​(SessionConfig sessionConfig,
                                   java.lang.String conversationId,
                                   java.lang.String chatUserId,
                                   boolean getMessagesToModerate,
                                   java.util.Date greaterThanDate,
                                   ITransaction transaction)
                            throws PortalException
        Returns the number of messages that exists and would be available for the #getLatestMessages(String, String, int, int, boolean, Date, ITransaction) method.
        Parameters:
        sessionConfig - the user session information.
        conversationId - the conversation identifier.
        chatUserId - the chat user identifier. If null no private messages are returned. If specified the private messages for that user are returned.
        getMessagesToModerate - if true the messages to moderate are also returned.
        greaterThanDate - if not null, only the message with sent date-time greater than this argument are returned.
        transaction - the transaction for persistence access.
        Returns:
        the number of messages.
        Throws:
        PortalException
        Since:
        4.0.11
      • deleteMessage

        void deleteMessage​(SessionConfig sessionConfig,
                           java.lang.String messageId,
                           ITransaction transaction)
                    throws PortalException
        Deletes the given message Id from its conversation.
        Parameters:
        sessionConfig -
        messageId -
        transaction -
        Throws:
        PortalException