public class ChatManager extends Object implements IChatManager
Constructor and Description |
---|
ChatManager() |
Modifier and Type | Method and Description |
---|---|
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) |
protected IResource resource
public void addUser(SessionConfig sessionConfig, ChatUserConfig userConfig, ITransaction transaction) throws PortalException
IChatManager
addUser
in interface IChatManager
PortalException
public ChatUserConfig getUser(SessionConfig sessionConfig, String id, ITransaction transaction) throws PortalException
IChatManager
getUser
in interface IChatManager
PortalException
public ChatUserConfig getUser(SessionConfig sessionConfig, String userId, String conversationId, String userSessionId, ITransaction transaction) throws PortalException
IChatManager
getUser
in interface IChatManager
PortalException
public Collection<ChatUserConfig> getUsers(SessionConfig sessionConfig, String conversationId, ITransaction transaction) throws PortalException
IChatManager
getUsers
in interface IChatManager
PortalException
public Collection<ChatUserConfig> getActiveUsers(SessionConfig sessionConfig, String conversationId, ITransaction transaction) throws PortalException
IChatManager
getActiveUsers
in interface IChatManager
PortalException
public boolean reachedUserLimit(SessionConfig sessionConfig, String conversationId, ITransaction transaction) throws PortalException
IChatManager
reachedUserLimit
in interface IChatManager
PortalException
public Collection<ChatUserConfig> getActiveUsersWithExpiredLastAccess(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
PortalException
public void deleteUser(SessionConfig sessionConfig, String userId, ITransaction transaction) throws PortalException
IChatManager
deleteUser
in interface IChatManager
PortalException
public void addConversation(SessionConfig sessionConfig, ChatConversationConfig conversationConfig, ITransaction transaction) throws PortalException
IChatManager
addConversation
in interface IChatManager
PortalException
public ChatConversationConfig getConversation(SessionConfig sessionConfig, String conversationId, ITransaction transaction) throws PortalException
IChatManager
getConversation
in interface IChatManager
PortalException
public void deleteConversation(SessionConfig sessionConfig, String conversationId, ITransaction transaction) throws PortalException
IChatManager
deleteConversation
in interface IChatManager
PortalException
public void openStartedConversations(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
IChatManager
openStartedConversations
in interface IChatManager
sessionConfig
- the user session information.transaction
- the transaction for persistence access.PortalException
public void closeExpiredConversations(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
IChatManager
closeExpiredConversations
in interface IChatManager
PortalException
public void updateActiveUserState(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
IChatManager
updateActiveUserState
in interface IChatManager
PortalException
public void userLeftConversation(SessionConfig sessionConfig, ChatUserConfig chatUserConfig, ITransaction transaction) throws PortalException
IChatManager
userLeftConversation
in interface IChatManager
PortalException
public void addMessage(SessionConfig sessionConfig, ChatMessageConfig messageConfig, ITransaction transaction) throws PortalException
IChatManager
addMessage
in interface IChatManager
PortalException
public void validateActiveConversation(String conversationId, ITransaction transaction) throws PortalException
PortalException
public ChatMessageConfig getMessage(SessionConfig sessionConfig, String messageId, ITransaction transaction) throws PortalException
IChatManager
getMessage
in interface IChatManager
PortalException
public Collection<ChatMessageConfig> getMessages(SessionConfig sessionConfig, String conversationId, ITransaction transaction) throws PortalException
IChatManager
getMessages
in interface IChatManager
PortalException
@Deprecated public List<ChatMessageConfig> getLatestMessages(SessionConfig sessionConfig, String conversationId, String chatUserId, int maxMessages, boolean getMessagesToModerate, Date greaterThanDate, ITransaction transaction) throws PortalException
IChatManager
getLatestMessages
in interface IChatManager
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.PortalException
public List<ChatMessageConfig> getLatestMessages(SessionConfig sessionConfig, String conversationId, String chatUserId, int firstMessageIndex, int maxMessages, boolean getMessagesToModerate, Date greaterThanDate, ITransaction transaction) throws PortalException
IChatManager
firstMessage
zero-based index. The messages are returned ordered by descending sent date-time.getLatestMessages
in interface IChatManager
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.PortalException
public String getMessagesXml(SessionConfig sessionConfig, Collection<ChatMessageConfig> chatMessageConfigs, boolean getMessagesToModerate, List<IResource> resources, ITransaction transaction) throws PortalException
IChatManager
getMessagesXml
in interface IChatManager
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.PortalException
public int getLatestMessagesCount(SessionConfig sessionConfig, String conversationId, String chatUserId, boolean getMessagesToModerate, Date greaterThanDate, ITransaction transaction) throws PortalException
IChatManager
#getLatestMessages(String, String, int, int, boolean, Date, ITransaction)
method.getLatestMessagesCount
in interface IChatManager
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.PortalException
public void deleteMessage(SessionConfig sessionConfig, String messageId, ITransaction transaction) throws PortalException
IChatManager
deleteMessage
in interface IChatManager
PortalException
public void updateLastAccess(SessionConfig sessionConfig, String chatUserId, ITransaction transaction) throws PortalException
IChatManager
updateLastAccess
in interface IChatManager
PortalException
LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.