public interface ChatManager extends EntitySummary
| Modifier and Type | Field and Description |
|---|---|
static String |
APPLICATION_ID
The type string for this application: should not change over time as it may be stored in various parts of persistent entities.
|
static String |
CHAT |
static String |
CHAT_TOOL_ID |
static String |
REF_TYPE_CHANNEL |
static String |
REF_TYPE_MESSAGE
The Reference type for a messgae.
|
static String |
REFERENCE_ROOT
This string starts the references to resources in this service.
|
| Modifier and Type | Method and Description |
|---|---|
Date |
calculateDateByOffset(int offset)
Returns a Date object that is the offset number of days before the current date
|
int |
countChannelMessages(ChatChannel channel)
Deprecated.
|
ChatChannel |
createNewChannel(String context,
String title,
boolean placementDefaultChannel,
boolean checkAuthz,
String placement)
Creates a new ChatChannel but doesn't put it in the database.
|
ChatMessage |
createNewMessage(ChatChannel channel,
String owner)
creates an unsaved Chat Message
|
void |
deleteChannel(ChatChannel channel)
deletes the channel from the database.
|
void |
deleteChannelMessages(ChatChannel channel)
delete all Chat Messages in a given channel
|
void |
deleteMessage(ChatMessage message)
delete a Chat Message
|
boolean |
getCanCreateChannel(String context)
Returns whether or not the user has permissions to create a new channel in the given context
|
boolean |
getCanDelete(ChatChannel channel)
Returns whether or not the user has permissions to delete this channel
|
boolean |
getCanDelete(ChatMessage message)
Returns whether or not the user has permissions to delete this message
|
boolean |
getCanDeleteAnyMessage(String context)
Returns whether or not the user has permissions to delete any messages in this context
|
boolean |
getCanEdit(ChatChannel channel)
Returns whether or not the user has permissions to edit this channel
|
boolean |
getCanPostMessage(ChatChannel channel)
Returns whether or not the user can post messages in this channel
|
boolean |
getCanReadMessage(ChatChannel channel)
Returns whether or not the user can read messages in this channel
|
List<ChatMessage> |
getChannelMessages(ChatChannel channel,
String context,
Date date,
int start,
int max,
boolean sortAsc)
gets all the messages from the Channel after the passed date,
limited to returning the the default maximum number of messages (100),
use
getChannelMessagesCount(ChatChannel, String, Date) to find the total number of messages |
int |
getChannelMessagesCount(ChatChannel channel,
String context,
Date date)
Gets the count of all the messages from the Channel after the passed date
|
ChatChannel |
getChatChannel(String chatChannelId)
gets one chat room
|
List<ChatChannel> |
getContextChannels(String context,
boolean lazy)
gets the rooms associated with the context
|
List<ChatChannel> |
getContextChannels(String contextId,
String defaultNewTitle,
String placement)
Gets the rooms associated with the context
If no rooms are found, one is created with the passed title
|
ChatChannel |
getDefaultChannel(String contextId,
String placement)
Returns the context's default channel, or null if none.
|
String |
getLabel()
Returns label used for entity producer
|
ChatMessage |
getMessage(String chatMessageId)
gets the message with the id
|
MessageDateString |
getMessageDateString(ChatMessage msg)
Get different date strings based on given ChatMessage::messageDate
|
int |
getMessagesMax() |
int |
getPollInterval()
Get pollInterval (in milliseconds) from properties
|
List<SimpleUser> |
getPresentUsers(String siteId,
String channelId)
Get all online users in given siteId and chat channel id
|
String |
getSessionKey()
Get session key (ussage_session_id:session_user_id) from current session
|
String |
getUserTimeZone()
Get user timezone from preferencesService.
|
Map<String,Object> |
handleChatData(String siteId,
String channelId,
String sessionKey)
- Update heartbeat for current user
- Get undelivered (latest) messages
- Get online users
- Get removed messages
|
boolean |
isMaintainer(String context)
Returns whether or not the user is a site maintainer in this context
|
void |
makeDefaultContextChannel(ChatChannel channel,
String placement)
Makes the passed channel the default in the channel's context
|
void |
migrateMessage(String sql,
Object[] values)
Insert migrated message data
|
void |
sendMessage(ChatMessage entry)
sends the message out to the other clients
|
void |
updateChannel(ChatChannel channel,
boolean checkAuthz)
updates the channel back into the database
|
void |
updateMessage(ChatMessage message)
saves a Chat Message
|
getSummarizableReference, getSummary, summarizableToolIdsstatic final String APPLICATION_ID
static final String REFERENCE_ROOT
static final String REF_TYPE_CHANNEL
static final String CHAT
static final String REF_TYPE_MESSAGE
static final String CHAT_TOOL_ID
ChatChannel createNewChannel(String context, String title, boolean placementDefaultChannel, boolean checkAuthz, String placement) throws PermissionException
context - Id of what the channel is linked totitle - String the title of the channelplacementDefaultChannel - boolean to set this as the default channel in the contextcheckAuthz - boolean indicating if we should check for authorization before creating the channelplacement - String id of the tool placementPermissionExceptionvoid updateChannel(ChatChannel channel, boolean checkAuthz) throws PermissionException
channel - ChatChannelcheckAuthz - boolean indicating if we should check for authorization before updatingPermissionExceptionvoid deleteChannel(ChatChannel channel) throws PermissionException
channel - PermissionExceptionChatChannel getChatChannel(String chatChannelId)
chatChannelId - IdList<ChatMessage> getChannelMessages(ChatChannel channel, String context, Date date, int start, int max, boolean sortAsc) throws PermissionException
getChannelMessagesCount(ChatChannel, String, Date) to find the total number of messageschannel - the ChatChannel to get messages forcontext - [OPTIONAL] Context of channel and messages to return (only used if the channel is null)date - [OPTIONAL] Date that the messages need to be newer than, includes all messages if nullstart - The item to start on (supports paging)max - The maximum number of items to return, uses the default maximum if above the default max or < 0, returns none if set to 0sortAsc - Boolean to sort the records in ascending orderPermissionExceptionint getChannelMessagesCount(ChatChannel channel, String context, Date date)
channel - the ChatChannel to get messages forcontext - [OPTIONAL] Context of channel and messages to return (only used if the channel is null)date - [OPTIONAL] Date that the messages need to be newer than, includes all messages if nullint countChannelMessages(ChatChannel channel)
getChannelMessagesCount(ChatChannel, String, Date)channel - ChatChannel to find the number of messagesChatMessage createNewMessage(ChatChannel channel, String owner) throws PermissionException
ChatChannel - the channel that the new message will be inString - the owner of the messagePermissionExceptionvoid updateMessage(ChatMessage message)
ChatMessage - the message to updatevoid deleteMessage(ChatMessage message) throws PermissionException
ChatMessage - the message to deletePermissionExceptionvoid deleteChannelMessages(ChatChannel channel) throws PermissionException
ChatChannel - the channel to delete all messages fromPermissionExceptionChatMessage getMessage(String chatMessageId)
chatMessageId - Idvoid sendMessage(ChatMessage entry)
entry - ChatMessageList<ChatChannel> getContextChannels(String context, boolean lazy)
context - Site the channel is inlazy - boolean to load the messages lazily or notList<ChatChannel> getContextChannels(String contextId, String defaultNewTitle, String placement)
contextId - IddefaultNewTitle - String the default name of a new ChatChannelplacement - ChatChannel getDefaultChannel(String contextId, String placement)
contextId - placement - boolean getCanDelete(ChatMessage message)
boolean getCanDelete(ChatChannel channel)
boolean getCanDeleteAnyMessage(String context)
boolean getCanEdit(ChatChannel channel)
boolean getCanCreateChannel(String context)
boolean getCanReadMessage(ChatChannel channel)
boolean getCanPostMessage(ChatChannel channel)
boolean isMaintainer(String context)
void makeDefaultContextChannel(ChatChannel channel, String placement)
channel - placement - Date calculateDateByOffset(int offset)
offset - Difference in days from current dateString getLabel()
void migrateMessage(String sql, Object[] values)
sql - sql statement to runvalues - Object[] of data to bind into the sql statementint getMessagesMax()
List<SimpleUser> getPresentUsers(String siteId, String channelId)
siteId - channelId - Map<String,Object> handleChatData(String siteId, String channelId, String sessionKey)
siteId - channelId - sessionKey - int getPollInterval()
String getSessionKey()
MessageDateString getMessageDateString(ChatMessage msg)
msg - String getUserTimeZone()
Copyright © 2003–2021 Sakai Project. All rights reserved.