public class ConversationServiceImpl extends org.flowable.common.engine.impl.service.CommonEngineServiceImpl<EngageEngineConfiguration> implements ConversationService
Modifier and Type | Field and Description |
---|---|
static String |
IDENTITY_LINK_CONVERSATION_SCOPE |
Constructor and Description |
---|
ConversationServiceImpl(EngageEngineConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
void |
addParticipants(String conversationId,
Collection<String> participants)
Adds the given participants to the conversation with the given id
|
void |
addTag(String conversationId,
String tag)
Adds the provided tag to the specified conversation.
|
void |
addTags(String conversationId,
Collection<String> tags)
Tag the conversation with provided
tags |
void |
archive(String conversationId)
Archives the conversation with the given id.
|
void |
assignToGroup(String conversationId,
String assignedGroupId)
Assigns the conversation to a group of users (set the assignedGroupId property).
|
void |
assignToUser(String conversationId,
String assignedUserId)
Assigns the conversation to a user (set the assigneeId property).
|
long |
countConversationsWithLastMessageBetween(Date from,
Date until,
boolean includePrivateMessages,
boolean includeStickMessages)
TODO: this might be not the right service
Number of conversations which received new messages within a given time frame.
|
ConversationBuilder |
createConversationBuilder()
Returns a conversation builder used to start new
Conversation objects. |
ConversationQuery |
createConversationQuery()
Creates a new conversation query as a builder where you can add predicates in order to query for conversations.
|
ConversationStatusQuery |
createConversationStatusQuery()
Creates a new conversation status query, that can be used to get the
different unread statuses for a conversation.
|
ConversationUserQuery |
createConversationUserQuery()
Creates a new user query to request user ids involved in a specific conversation (e.g.
|
void |
deleteConversation(String conversationId)
Deletes a conversation and all related data (messages, unread counts, etc.).
|
boolean |
exists(String conversationId) |
Conversation |
findById(String conversationId)
Finds the conversation with the given id.
|
Conversation |
findByIdWithIdentityLinks(String conversationId)
Finds the conversation with the given id, with the identity links already prefetched.
|
Conversation |
findByIdWithIdentityLinksAndVariables(String conversationId)
Finds the conversation with the given id, with the identity links and variables already prefetched.
|
List<Conversation> |
findConversationsWithLastMessageBetween(Date from,
Date until,
boolean includePrivateMessages,
boolean includeStickMessages)
TODO: this might be not the right service
Finds conversations which received new messages within a given time frame.
|
Object |
getVariable(String conversationId,
String variableName)
The variable value.
|
Map<String,Object> |
getVariables(String conversationId)
All variables visible from the given conversation.
|
void |
linkConversationWithUserAccount(String conversationId,
String userAccountId)
Set the id of the user account that is linked with this conversation.
|
void |
removeAssignedGroup(String conversationId)
Removes an assigned group from a conversation (sets the assignedGroupId proeprty to null).
|
void |
removeAssignedUser(String conversationId)
Removes an assigned user from a conversation.
|
void |
removeParticipants(String conversationId,
Collection<String> participants)
Removes the given participants to the conversation with the given id
|
void |
removeTag(String conversationId,
String tag)
Removes the provided tag from the specified conversation, if it exists.
|
void |
removeTags(String conversationId,
Collection<String> tags)
Remove the provided
tags from the conversation |
void |
removeUserAccountFromConversation(String conversationId)
Remove the id of the user account from this conversation.
|
void |
removeVariable(String conversationId,
String variableName)
Removes a variable for a conversation.
|
void |
removeVariables(String conversationId,
Collection<String> variableNames)
Removes variables for a conversation.
|
void |
reopen(String conversationId)
Reopens the archived conversation with the given id.
|
Conversation |
setReference(String conversationId,
String referenceId,
String referenceType,
String referenceDefinitionId)
Set the optional reference for a conversation like a case or process where the conversation is liked to.
|
void |
setVariable(String conversationId,
String variableName,
Object value)
Update or create a variable for a conversation.
|
void |
setVariables(String conversationId,
Map<String,Object> variables)
Update or create given variables for a conversation.
|
Conversation |
startConversation(ConversationBuilderImpl conversationBuilder) |
ConversationHolder |
startConversationWithReuse(ConversationBuilderImpl conversationBuilder) |
long |
unreadMessagesCount(String userId,
String conversationId)
The unread data count for the user with id
userId in the conversation with id conversationId |
Conversation |
updateAvatarId(String conversationId,
String avatarId)
Updates the conversation avatar id for the given conversation.
|
Conversation |
updateDescription(String conversationId,
String description)
Updates the conversation description for the given conversation.
|
Conversation |
updateName(String conversationId,
String name)
Updates the conversation name (title) for the given conversation.
|
void |
userTyping(String conversationId,
String userId)
Information that a user with id
userId is typing in the conversation with id conversationId |
getCommandExecutor, setCommandExecutor
public static final String IDENTITY_LINK_CONVERSATION_SCOPE
public ConversationServiceImpl(EngageEngineConfiguration configuration)
public ConversationQuery createConversationQuery()
ConversationService
ConversationService.findById(String)
because it takes the cache into account.createConversationQuery
in interface ConversationService
public ConversationBuilder createConversationBuilder()
ConversationService
Conversation
objects. Make sure to always explicitly set the sub type of the conversation as it
is a mandatory information.createConversationBuilder
in interface ConversationService
public ConversationUserQuery createConversationUserQuery()
ConversationService
createConversationUserQuery
in interface ConversationService
public ConversationStatusQuery createConversationStatusQuery()
ConversationService
createConversationStatusQuery
in interface ConversationService
public long unreadMessagesCount(String userId, String conversationId)
ConversationService
userId
in the conversation with id conversationId
unreadMessagesCount
in interface ConversationService
userId
- the id of the user for which the unread data count is neededconversationId
- the id of the conversation for which the count is neededpublic Conversation startConversation(ConversationBuilderImpl conversationBuilder)
public ConversationHolder startConversationWithReuse(ConversationBuilderImpl conversationBuilder)
public boolean exists(String conversationId)
exists
in interface ConversationService
public Conversation setReference(String conversationId, String referenceId, String referenceType, String referenceDefinitionId)
ConversationService
setReference
in interface ConversationService
conversationId
- the id of the conversation to set its referencereferenceId
- the id of the referenced work itemreferenceType
- the type of the referenced work itemreferenceDefinitionId
- the optional definition id of the referenced work itempublic Conversation updateName(String conversationId, String name)
ConversationService
updateName
in interface ConversationService
conversationId
- the id of the conversation to change its namename
- title of the conversation, it can be also be null or emptypublic Conversation updateDescription(String conversationId, String description)
ConversationService
updateDescription
in interface ConversationService
conversationId
- the id of the conversation to change its descriptiondescription
- the description of the conversation, it can be also be null or emptypublic Conversation updateAvatarId(String conversationId, String avatarId)
ConversationService
updateAvatarId
in interface ConversationService
conversationId
- the id of the conversation to change its descriptionavatarId
- the avatar id of the conversation, it can be also be null or emptypublic void archive(String conversationId)
ConversationService
archive
in interface ConversationService
conversationId
- the id of the conversation to be archivedpublic void reopen(String conversationId)
ConversationService
reopen
in interface ConversationService
conversationId
- the id of the conversation to be reopenedpublic void addParticipants(String conversationId, Collection<String> participants)
ConversationService
addParticipants
in interface ConversationService
conversationId
- the id of the conversation to which the participants needs to be addedparticipants
- the ids of the participants that need to be addedpublic void removeParticipants(String conversationId, Collection<String> participants)
ConversationService
removeParticipants
in interface ConversationService
conversationId
- the id of the conversation from which the participants need to be removedparticipants
- the ids of the participants that need to be removedpublic void assignToGroup(String conversationId, String assignedGroupId)
ConversationService
assignToGroup
in interface ConversationService
conversationId
- the id of the conversation to be assigned to a groupassignedGroupId
- the id of the group to assign the conversation topublic void removeAssignedGroup(String conversationId)
ConversationService
removeAssignedGroup
in interface ConversationService
conversationId
- the id of the conversation to remove the assgined group frompublic void assignToUser(String conversationId, String assignedUserId)
ConversationService
assignToUser
in interface ConversationService
conversationId
- the id of the conversation to be assigned to a userassignedUserId
- the id of the user to assign the conversation topublic void removeAssignedUser(String conversationId)
ConversationService
removeAssignedUser
in interface ConversationService
conversationId
- the id of the conversatoin to remove the assigned user (set the assigneeId ot null).public void userTyping(String conversationId, String userId)
ConversationService
userId
is typing in the conversation with id conversationId
userTyping
in interface ConversationService
conversationId
- the id of the conversation in which the user is typinguserId
- the id of the user that is doing the typingpublic void deleteConversation(String conversationId)
ConversationService
deleteConversation
in interface ConversationService
conversationId
- the id of the conversation which needs to be deleted.public void addTags(String conversationId, Collection<String> tags)
ConversationService
tags
addTags
in interface ConversationService
conversationId
- the id of the conversation to which the tags need to be addedtags
- the tags that should be added to the conversationpublic void addTag(String conversationId, String tag)
ConversationService
addTag
in interface ConversationService
conversationId
- the id of the conversation where the tag should be addedtag
- the tag to be added, must not be null or emptypublic void removeTags(String conversationId, Collection<String> tags)
ConversationService
tags
from the conversationremoveTags
in interface ConversationService
conversationId
- the id of the conversation from which tags need to be removedtags
- the tags that need to be removed from the conversationpublic void removeTag(String conversationId, String tag)
ConversationService
removeTag
in interface ConversationService
conversationId
- the id of the conversatoin to remove the provided tag fromtag
- the tag to be removedpublic long countConversationsWithLastMessageBetween(Date from, Date until, boolean includePrivateMessages, boolean includeStickMessages)
ConversationService
ConversationQuery
and build a query with ConversationQuery.lastMessageAfter(Date)
or ConversationQuery.lastMessageBefore(Date)
This method is needed if private or sticky messages are also to be taken account, because Conversation.getLastMessageTime()
will not be updated for private or sticky messages.countConversationsWithLastMessageBetween
in interface ConversationService
from
- start of the time frame (optional)until
- end of the time frame (optional)includePrivateMessages
- true if private messages should also be consideredincludeStickMessages
- true if sticky messages should also be consideredpublic List<Conversation> findConversationsWithLastMessageBetween(Date from, Date until, boolean includePrivateMessages, boolean includeStickMessages)
ConversationService
ConversationQuery
and build a query with ConversationQuery.lastMessageAfter(Date)
or ConversationQuery.lastMessageBefore(Date)
This method is needed if private or sticky messages are also to be taken account, because Conversation.getLastMessageTime()
will not be updated for private or sticky messages.findConversationsWithLastMessageBetween
in interface ConversationService
from
- start of the time frame (optional)until
- end of the time frame (optional)includePrivateMessages
- true if private messages should also be consideredincludeStickMessages
- true if sticky messages should also be consideredpublic Conversation findByIdWithIdentityLinks(String conversationId)
ConversationService
findByIdWithIdentityLinks
in interface ConversationService
public Conversation findByIdWithIdentityLinksAndVariables(String conversationId)
ConversationService
findByIdWithIdentityLinksAndVariables
in interface ConversationService
public Conversation findById(String conversationId)
ConversationService
ConversationService.findByIdWithIdentityLinks(String)
.findById
in interface ConversationService
conversationId
- the conversation idpublic void linkConversationWithUserAccount(String conversationId, String userAccountId)
ConversationService
ConversationService.removeUserAccountFromConversation(String)
first.linkConversationWithUserAccount
in interface ConversationService
conversationId
- the id of the conversation that should be updateduserAccountId
- the id of the user account that should be linked with the conversationpublic void removeUserAccountFromConversation(String conversationId)
ConversationService
removeUserAccountFromConversation
in interface ConversationService
conversationId
- the id of the conversation that should be updatedpublic Map<String,Object> getVariables(String conversationId)
ConversationService
getVariables
in interface ConversationService
conversationId
- id of the conversation, cannot be null.public Object getVariable(String conversationId, String variableName)
ConversationService
getVariable
in interface ConversationService
conversationId
- id of conversation, cannot be null.variableName
- name of variable, cannot be null.public void setVariable(String conversationId, String variableName, Object value)
ConversationService
setVariable
in interface ConversationService
conversationId
- id of conversation to set variable in, cannot be null.variableName
- name of variable to set, cannot be null.value
- value to set. When null is passed, the variable is not removed, only it's value will be set to null.public void setVariables(String conversationId, Map<String,Object> variables)
ConversationService
setVariables
in interface ConversationService
conversationId
- id of the conversation, cannot be null.variables
- map containing name (key) and value of variables, can be null.public void removeVariable(String conversationId, String variableName)
ConversationService
removeVariable
in interface ConversationService
conversationId
- id of conversation to remove variable in.variableName
- name of variable to remove.public void removeVariables(String conversationId, Collection<String> variableNames)
ConversationService
removeVariables
in interface ConversationService
conversationId
- id of conversation to remove variable in.variableNames
- collection containing name of variables to remove.Copyright © 2019. All rights reserved.