lumis.collaboration.chat
Class ChatManager

Package class diagram package ChatManager
java.lang.Object
  extended by lumis.collaboration.chat.ChatManager
All Implemented Interfaces:
IChatManager

public class ChatManager
extends Object
implements IChatManager

Responsible for managing all chat conversations

Since:
4.0.5

Field Summary
protected  IResource resource
           
 
Constructor Summary
ChatManager()
           
 
Method Summary
 void addConversation(SessionConfig sessionConfig, ChatConversationConfig conversationConfig, ITransaction transaction)
          Adds a chat conversation.
 void addMessage(SessionConfig sessionConfig, ChatMessageConfig messageConfig, ITransaction transaction)
          Adds a chat message to a conversation.
 void addUser(SessionConfig sessionConfig, ChatUserConfig userConfig, ITransaction transaction)
          Adds a chat user
 void closeExpiredConversations(SessionConfig sessionConfig, ITransaction transaction)
          closes expired conversations.
 void deleteConversation(SessionConfig sessionConfig, String conversationId, ITransaction transaction)
          Deletes the given chat conversation.
 void deleteMessage(SessionConfig sessionConfig, String messageId, ITransaction transaction)
          Deletes the given message Id from its conversation.
 void deleteUser(SessionConfig sessionConfig, String userId, ITransaction transaction)
          Deletes the given user.
 Collection<ChatUserConfig> getActiveUsers(SessionConfig sessionConfig, String conversationId, ITransaction transaction)
          Returns all the active chat users given the conversation id
 Collection<ChatUserConfig> getActiveUsersWithExpiredLastAccess(SessionConfig sessionConfig, ITransaction transaction)
           
 ChatConversationConfig getConversation(SessionConfig sessionConfig, String conversationId, ITransaction transaction)
          Returns a chat conversation config object.
 List<ChatMessageConfig> getLatestMessages(SessionConfig sessionConfig, String conversationId, String chatUserId, int maxMessages, boolean getMessagesToModerate, Date greaterThanDate, ITransaction transaction)
          Deprecated. 
 List<ChatMessageConfig> getLatestMessages(SessionConfig sessionConfig, String conversationId, String chatUserId, int firstMessageIndex, int maxMessages, boolean getMessagesToModerate, Date greaterThanDate, ITransaction transaction)
          Returns up to maxMessages messageConfigs for a given conversationId.
 int getLatestMessagesCount(SessionConfig sessionConfig, String conversationId, String chatUserId, boolean getMessagesToModerate, Date greaterThanDate, ITransaction transaction)
          Returns the number of messages that exists and would be available for the #getLatestMessages(String, String, int, int, boolean, Date, ITransaction) method.
 ChatMessageConfig getMessage(SessionConfig sessionConfig, String messageId, ITransaction transaction)
          Returns a message config object.
 Collection<ChatMessageConfig> getMessages(SessionConfig sessionConfig, String conversationId, ITransaction transaction)
          Returns all the messages for a given conversationId.
 String getMessagesXml(SessionConfig sessionConfig, Collection<ChatMessageConfig> chatMessageConfigs, boolean getMessagesToModerate, List<IResource> resources, ITransaction transaction)
          Returns the xml for the given messages.
 ChatUserConfig getUser(SessionConfig sessionConfig, String id, ITransaction transaction)
          Returns a chat user given the chat user id
 ChatUserConfig getUser(SessionConfig sessionConfig, String userId, String conversationId, String userSessionId, ITransaction transaction)
          Returns a chat user given the portal user id, conversation id and optionally the user sessionId
 Collection<ChatUserConfig> getUsers(SessionConfig sessionConfig, String conversationId, ITransaction transaction)
          Returns all the chat users given the conversation id
 void openStartedConversations(SessionConfig sessionConfig, ITransaction transaction)
          Opens the conversations whose startTime has already been reached.
 boolean reachedUserLimit(SessionConfig sessionConfig, String conversationId, ITransaction transaction)
          Returns true if the conversation has reached its user limit
 void updateActiveUserState(SessionConfig sessionConfig, ITransaction transaction)
          Checks if any of the active users have not updated their last acces date.
 void updateLastAccess(SessionConfig sessionConfig, String chatUserId, ITransaction transaction)
          Updates the last access date for the given chat user.
 void userLeftConversation(SessionConfig sessionConfig, ChatUserConfig chatUserConfig, ITransaction transaction)
          Method to indicate that a user left the conversation
 void validateActiveConversation(String conversationId, ITransaction transaction)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resource

protected IResource resource
Constructor Detail

ChatManager

public ChatManager()
Method Detail

addUser

public void addUser(SessionConfig sessionConfig,
                    ChatUserConfig userConfig,
                    ITransaction transaction)
             throws PortalException
Description copied from interface: IChatManager
Adds a chat user

Specified by:
addUser in interface IChatManager
Throws:
PortalException

getUser

public ChatUserConfig getUser(SessionConfig sessionConfig,
                              String id,
                              ITransaction transaction)
                       throws PortalException
Description copied from interface: IChatManager
Returns a chat user given the chat user id

Specified by:
getUser in interface IChatManager
Throws:
PortalException

getUser

public ChatUserConfig getUser(SessionConfig sessionConfig,
                              String userId,
                              String conversationId,
                              String userSessionId,
                              ITransaction transaction)
                       throws PortalException
Description copied from interface: IChatManager
Returns a chat user given the portal user id, conversation id and optionally the user sessionId

Specified by:
getUser in interface IChatManager
Returns:
Throws:
PortalException

getUsers

public Collection<ChatUserConfig> getUsers(SessionConfig sessionConfig,
                                           String conversationId,
                                           ITransaction transaction)
                                    throws PortalException
Description copied from interface: IChatManager
Returns all the chat users given the conversation id

Specified by:
getUsers in interface IChatManager
Returns:
Throws:
PortalException

getActiveUsers

public Collection<ChatUserConfig> getActiveUsers(SessionConfig sessionConfig,
                                                 String conversationId,
                                                 ITransaction transaction)
                                          throws PortalException
Description copied from interface: IChatManager
Returns all the active chat users given the conversation id

Specified by:
getActiveUsers in interface IChatManager
Returns:
Throws:
PortalException

reachedUserLimit

public boolean reachedUserLimit(SessionConfig sessionConfig,
                                String conversationId,
                                ITransaction transaction)
                         throws PortalException
Description copied from interface: IChatManager
Returns true if the conversation has reached its user limit

Specified by:
reachedUserLimit in interface IChatManager
Returns:
Throws:
PortalException

getActiveUsersWithExpiredLastAccess

public Collection<ChatUserConfig> getActiveUsersWithExpiredLastAccess(SessionConfig sessionConfig,
                                                                      ITransaction transaction)
                                                               throws PortalException
Throws:
PortalException

deleteUser

public void deleteUser(SessionConfig sessionConfig,
                       String userId,
                       ITransaction transaction)
                throws PortalException
Description copied from interface: IChatManager
Deletes the given user.

Specified by:
deleteUser in interface IChatManager
Throws:
PortalException

addConversation

public void addConversation(SessionConfig sessionConfig,
                            ChatConversationConfig conversationConfig,
                            ITransaction transaction)
                     throws PortalException
Description copied from interface: IChatManager
Adds a chat conversation.

Specified by:
addConversation in interface IChatManager
Throws:
PortalException

getConversation

public ChatConversationConfig getConversation(SessionConfig sessionConfig,
                                              String conversationId,
                                              ITransaction transaction)
                                       throws PortalException
Description copied from interface: IChatManager
Returns a chat conversation config object.

Specified by:
getConversation in interface IChatManager
Throws:
PortalException

deleteConversation

public void deleteConversation(SessionConfig sessionConfig,
                               String conversationId,
                               ITransaction transaction)
                        throws PortalException
Description copied from interface: IChatManager
Deletes the given chat conversation.

Specified by:
deleteConversation in interface IChatManager
Throws:
PortalException

openStartedConversations

public void openStartedConversations(SessionConfig sessionConfig,
                                     ITransaction transaction)
                              throws PortalException
Description copied from interface: IChatManager
Opens the conversations whose startTime has already been reached.

Specified by:
openStartedConversations in interface IChatManager
Parameters:
sessionConfig - the user session information.
transaction - the transaction for persistence access.
Throws:
PortalException

closeExpiredConversations

public void closeExpiredConversations(SessionConfig sessionConfig,
                                      ITransaction transaction)
                               throws PortalException
Description copied from interface: IChatManager
closes expired conversations.

Specified by:
closeExpiredConversations in interface IChatManager
Throws:
PortalException

updateActiveUserState

public void updateActiveUserState(SessionConfig sessionConfig,
                                  ITransaction transaction)
                           throws PortalException
Description copied from interface: IChatManager
Checks if any of the active users have not updated their last acces date. If not, change their state to inactive

Specified by:
updateActiveUserState in interface IChatManager
Throws:
PortalException

userLeftConversation

public void userLeftConversation(SessionConfig sessionConfig,
                                 ChatUserConfig chatUserConfig,
                                 ITransaction transaction)
                          throws PortalException
Description copied from interface: IChatManager
Method to indicate that a user left the conversation

Specified by:
userLeftConversation in interface IChatManager
Throws:
PortalException

addMessage

public void addMessage(SessionConfig sessionConfig,
                       ChatMessageConfig messageConfig,
                       ITransaction transaction)
                throws PortalException
Description copied from interface: IChatManager
Adds a chat message to a conversation.

Specified by:
addMessage in interface IChatManager
Throws:
PortalException

validateActiveConversation

public void validateActiveConversation(String conversationId,
                                       ITransaction transaction)
                                throws PortalException
Throws:
PortalException

getMessage

public ChatMessageConfig getMessage(SessionConfig sessionConfig,
                                    String messageId,
                                    ITransaction transaction)
                             throws PortalException
Description copied from interface: IChatManager
Returns a message config object.

Specified by:
getMessage in interface IChatManager
Throws:
PortalException

getMessages

public Collection<ChatMessageConfig> getMessages(SessionConfig sessionConfig,
                                                 String conversationId,
                                                 ITransaction transaction)
                                          throws PortalException
Description copied from interface: IChatManager
Returns all the messages for a given conversationId. The messages are returned ordered by creation date.

Specified by:
getMessages in interface IChatManager
Returns:
Throws:
PortalException

getLatestMessages

@Deprecated
public List<ChatMessageConfig> getLatestMessages(SessionConfig sessionConfig,
                                                            String conversationId,
                                                            String chatUserId,
                                                            int maxMessages,
                                                            boolean getMessagesToModerate,
                                                            Date greaterThanDate,
                                                            ITransaction transaction)
                                          throws PortalException
Deprecated. 

Description copied from interface: IChatManager
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.

Specified by:
getLatestMessages in interface IChatManager
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

public List<ChatMessageConfig> getLatestMessages(SessionConfig sessionConfig,
                                                 String conversationId,
                                                 String chatUserId,
                                                 int firstMessageIndex,
                                                 int maxMessages,
                                                 boolean getMessagesToModerate,
                                                 Date greaterThanDate,
                                                 ITransaction transaction)
                                          throws PortalException
Description copied from interface: IChatManager
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.

Specified by:
getLatestMessages in interface IChatManager
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

getMessagesXml

public String getMessagesXml(SessionConfig sessionConfig,
                             Collection<ChatMessageConfig> chatMessageConfigs,
                             boolean getMessagesToModerate,
                             List<IResource> resources,
                             ITransaction transaction)
                      throws PortalException
Description copied from interface: IChatManager
Returns the xml for the given messages. The collection's iterator ordering will be used.

Specified by:
getMessagesXml in interface IChatManager
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

getLatestMessagesCount

public int getLatestMessagesCount(SessionConfig sessionConfig,
                                  String conversationId,
                                  String chatUserId,
                                  boolean getMessagesToModerate,
                                  Date greaterThanDate,
                                  ITransaction transaction)
                           throws PortalException
Description copied from interface: IChatManager
Returns the number of messages that exists and would be available for the #getLatestMessages(String, String, int, int, boolean, Date, ITransaction) method.

Specified by:
getLatestMessagesCount in interface IChatManager
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

deleteMessage

public void deleteMessage(SessionConfig sessionConfig,
                          String messageId,
                          ITransaction transaction)
                   throws PortalException
Description copied from interface: IChatManager
Deletes the given message Id from its conversation.

Specified by:
deleteMessage in interface IChatManager
Throws:
PortalException

updateLastAccess

public void updateLastAccess(SessionConfig sessionConfig,
                             String chatUserId,
                             ITransaction transaction)
                      throws PortalException
Description copied from interface: IChatManager
Updates the last access date for the given chat user.

Specified by:
updateLastAccess in interface IChatManager
Throws:
PortalException


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.