Class ConversationServiceImpl
java.lang.Object
org.flowable.common.engine.impl.service.CommonServiceImpl<C>
org.flowable.common.engine.impl.service.CommonEngineServiceImpl<EngageEngineConfiguration>
com.flowable.engage.engine.impl.conversation.ConversationServiceImpl
- All Implemented Interfaces:
ConversationService
public class ConversationServiceImpl
extends CommonEngineServiceImpl<EngageEngineConfiguration>
implements ConversationService
The default conversation service implementation using commands to provide the necessary functionality.
- Author:
- Micha Kiener, Filip Hrisafov, Anatolii Balakiriev
-
Field Summary
FieldsFields inherited from class org.flowable.common.engine.impl.service.CommonEngineServiceImpl
commandExecutorFields inherited from class org.flowable.common.engine.impl.service.CommonServiceImpl
configuration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParticipants(String conversationId, Collection<String> participants) Adds the given participants to the conversation with the given idvoidAdds the provided tag to the specified conversation.voidaddTags(String conversationId, Collection<String> tags) Tag the conversation with providedtagsvoidArchives the conversation with the given id.voidassignToGroup(String conversationId, String assignedGroupId) Assigns the conversation to a group of users (set the assignedGroupId property).voidassignToUser(String conversationId, String assignedUserId) Assigns the conversation to a user (set the assigneeId property).voidchangeOwner(String conversationId, String ownerUserId) Changes an owner of the conversation.longcountConversationsWithLastMessageBetween(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.Returns a conversation builder used to start newConversationobjects.createConversationParticipantBuilder(String conversationId) Creates a new participant builder to add or remove participants to / from a conversation with various extended options mainly on message visibility.Creates a new conversation query as a builder where you can add predicates in order to query for conversations.Creates a new conversation status query, that can be used to get the different unread statuses for a conversation.Creates a new user query to request user ids involved in a specific conversation (e.g.voiddeleteConversation(String conversationId) Deletes a conversation and all related data (messages, unread counts, etc.).booleanFinds the conversation with the given id.findByIdWithIdentityLinks(String conversationId) Finds the conversation with the given id, with the identity links already prefetched.findByIdWithIdentityLinksAndVariables(String conversationId) Finds the conversation with the given id, with the identity links and variables already prefetched.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.getVariable(String conversationId, String variableName) The variable value.getVariables(String conversationId) All variables visible from the given conversation.voidlinkConversationWithUserAccount(String conversationId, String userAccountId) Set the id of the user account that is linked with this conversation.voidmuteConversation(String conversationId, String userId) Mute the conversation with the givenconversationIdfor the user with the givenuserId.voidremoveAssignedGroup(String conversationId) Removes an assigned group from a conversation (sets the assignedGroupId proeprty to null).voidremoveAssignedUser(String conversationId) Removes an assigned user from a conversation.voidremoveParticipants(String conversationId, Collection<String> participants) Removes the given participants to the conversation with the given idvoidRemoves the provided tag from the specified conversation, if it exists.voidremoveTags(String conversationId, Collection<String> tags) Remove the providedtagsfrom the conversationvoidremoveUserAccountFromConversation(String conversationId) Deprecated.voidremoveUserAccountFromConversation(String userAccountId, String conversationId) Remove the mapping between the user account and the given conversation.voidremoveUserAccountsFromConversation(String conversationId) Remove all the user account mappings with this conversation.voidremoveVariable(String conversationId, String variableName) Removes a variable for a conversation.voidremoveVariables(String conversationId, Collection<String> variableNames) Removes variables for a conversation.voidReopens the archived conversation with the given id.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.voidsetVariable(String conversationId, String variableName, Object value) Update or create a variable for a conversation.voidsetVariables(String conversationId, Map<String, Object> variables) Update or create given variables for a conversation.voidstarConversation(String conversationId, String userId) Star the conversation with the givenconversationIdfor the user with the givenuserIdstartConversation(ConversationBuilderImpl conversationBuilder) startConversationWithReuse(ConversationBuilderImpl conversationBuilder) voidunmuteConversation(String conversationId, String userId) Unmute the conversation with the giveconversationIdfor the user with the giveuserId.longunreadMessagesCount(String userId, String conversationId) The unread data count for the user with iduserIdin the conversation with idconversationIdvoidunstarConversation(String conversationId, String userId) Un-stars the conversation with the givenconversationIdfor the user with the givenuserIdupdateAvatarId(String conversationId, String avatarId) Updates the conversation avatar id for the given conversation.updateDescription(String conversationId, String description) Updates the conversation description for the given conversation.updateName(String conversationId, String name) Updates the conversation name (title) for the given conversation.voiduserTyping(String conversationId, String userId) Information that a user with iduserIdis typing in the conversation with idconversationIdMethods inherited from class org.flowable.common.engine.impl.service.CommonEngineServiceImpl
getCommandExecutor, setCommandExecutorMethods inherited from class org.flowable.common.engine.impl.service.CommonServiceImpl
getConfiguration
-
Field Details
-
IDENTITY_LINK_CONVERSATION_SCOPE
- See Also:
-
-
Constructor Details
-
ConversationServiceImpl
-
-
Method Details
-
createConversationQuery
Description copied from interface:ConversationServiceCreates a new conversation query as a builder where you can add predicates in order to query for conversations. If you search by the conversation id only you should better useConversationService.findById(String)because it takes the cache into account.- Specified by:
createConversationQueryin interfaceConversationService- Returns:
- the conversation query builder
-
createConversationBuilder
Description copied from interface:ConversationServiceReturns a conversation builder used to start newConversationobjects. Make sure to always explicitly set the sub type of the conversation as it is a mandatory information.- Specified by:
createConversationBuilderin interfaceConversationService- Returns:
- the conversation builder
-
createConversationParticipantBuilder
Description copied from interface:ConversationServiceCreates a new participant builder to add or remove participants to / from a conversation with various extended options mainly on message visibility.- Specified by:
createConversationParticipantBuilderin interfaceConversationService- Parameters:
conversationId- the id of the conversation to manage participants through the builder- Returns:
- a conversation participant builder
-
createConversationUserQuery
Description copied from interface:ConversationServiceCreates a new user query to request user ids involved in a specific conversation (e.g. participants or all involved users, etc).- Specified by:
createConversationUserQueryin interfaceConversationService- Returns:
- the conversation query builder
-
createConversationStatusQuery
Description copied from interface:ConversationServiceCreates a new conversation status query, that can be used to get the different unread statuses for a conversation.- Specified by:
createConversationStatusQueryin interfaceConversationService- Returns:
- the conversation status query builder
-
unreadMessagesCount
Description copied from interface:ConversationServiceThe unread data count for the user with iduserIdin the conversation with idconversationId- Specified by:
unreadMessagesCountin interfaceConversationService- Parameters:
userId- the id of the user for which the unread data count is neededconversationId- the id of the conversation for which the count is needed- Returns:
- the number of unread messages for the given user in the given conversation
-
startConversation
-
startConversationWithReuse
-
exists
- Specified by:
existsin interfaceConversationService- Returns:
- Checks if the given conversation exists.
-
setReference
public Conversation setReference(String conversationId, String referenceId, String referenceType, String referenceDefinitionId) Description copied from interface:ConversationServiceSet the optional reference for a conversation like a case or process where the conversation is liked to.- Specified by:
setReferencein interfaceConversationService- Parameters:
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 item- Returns:
- the modified conversation retrieved from the database
-
updateName
Description copied from interface:ConversationServiceUpdates the conversation name (title) for the given conversation.- Specified by:
updateNamein interfaceConversationService- Parameters:
conversationId- the id of the conversation to change its namename- title of the conversation, it can be also be null or empty- Returns:
- modified conversation retrieved from database
-
updateDescription
Description copied from interface:ConversationServiceUpdates the conversation description for the given conversation.- Specified by:
updateDescriptionin interfaceConversationService- Parameters:
conversationId- the id of the conversation to change its descriptiondescription- the description of the conversation, it can be also be null or empty- Returns:
- modified conversation retrieved from database
-
updateAvatarId
Description copied from interface:ConversationServiceUpdates the conversation avatar id for the given conversation.- Specified by:
updateAvatarIdin interfaceConversationService- Parameters:
conversationId- the id of the conversation to change its descriptionavatarId- the avatar id of the conversation, it can be also be null or empty- Returns:
- modified conversation retrieved from database
-
archive
Description copied from interface:ConversationServiceArchives the conversation with the given id. You can't post anything to an archived conversation, the only thing left to do is re-opening it.- Specified by:
archivein interfaceConversationService- Parameters:
conversationId- the id of the conversation to be archived
-
reopen
Description copied from interface:ConversationServiceReopens the archived conversation with the given id.- Specified by:
reopenin interfaceConversationService- Parameters:
conversationId- the id of the conversation to be reopened
-
addParticipants
Description copied from interface:ConversationServiceAdds the given participants to the conversation with the given id- Specified by:
addParticipantsin interfaceConversationService- Parameters:
conversationId- the id of the conversation to which the participants needs to be addedparticipants- the ids of the participants that need to be added
-
removeParticipants
Description copied from interface:ConversationServiceRemoves the given participants to the conversation with the given id- Specified by:
removeParticipantsin interfaceConversationService- Parameters:
conversationId- the id of the conversation from which the participants need to be removedparticipants- the ids of the participants that need to be removed
-
assignToGroup
Description copied from interface:ConversationServiceAssigns the conversation to a group of users (set the assignedGroupId property).- Specified by:
assignToGroupin interfaceConversationService- Parameters:
conversationId- the id of the conversation to be assigned to a groupassignedGroupId- the id of the group to assign the conversation to
-
removeAssignedGroup
Description copied from interface:ConversationServiceRemoves an assigned group from a conversation (sets the assignedGroupId proeprty to null).- Specified by:
removeAssignedGroupin interfaceConversationService- Parameters:
conversationId- the id of the conversation to remove the assgined group from
-
assignToUser
Description copied from interface:ConversationServiceAssigns the conversation to a user (set the assigneeId property).- Specified by:
assignToUserin interfaceConversationService- Parameters:
conversationId- the id of the conversation to be assigned to a userassignedUserId- the id of the user to assign the conversation to
-
removeAssignedUser
Description copied from interface:ConversationServiceRemoves an assigned user from a conversation.- Specified by:
removeAssignedUserin interfaceConversationService- Parameters:
conversationId- the id of the conversatoin to remove the assigned user (set the assigneeId ot null).
-
changeOwner
Description copied from interface:ConversationServiceChanges an owner of the conversation.- Specified by:
changeOwnerin interfaceConversationService- Parameters:
conversationId- the id of the conversation to change an owner inownerUserId- the id of the user to become a new owner of this conversation
-
userTyping
Description copied from interface:ConversationServiceInformation that a user with iduserIdis typing in the conversation with idconversationId- Specified by:
userTypingin interfaceConversationService- Parameters:
conversationId- the id of the conversation in which the user is typinguserId- the id of the user that is doing the typing
-
deleteConversation
Description copied from interface:ConversationServiceDeletes a conversation and all related data (messages, unread counts, etc.).- Specified by:
deleteConversationin interfaceConversationService- Parameters:
conversationId- the id of the conversation which needs to be deleted.
-
addTags
Description copied from interface:ConversationServiceTag the conversation with providedtags- Specified by:
addTagsin interfaceConversationService- Parameters:
conversationId- the id of the conversation to which the tags need to be addedtags- the tags that should be added to the conversation
-
addTag
Description copied from interface:ConversationServiceAdds the provided tag to the specified conversation.- Specified by:
addTagin interfaceConversationService- Parameters:
conversationId- the id of the conversation where the tag should be addedtag- the tag to be added, must not be null or empty
-
removeTags
Description copied from interface:ConversationServiceRemove the providedtagsfrom the conversation- Specified by:
removeTagsin interfaceConversationService- Parameters:
conversationId- the id of the conversation from which tags need to be removedtags- the tags that need to be removed from the conversation
-
removeTag
Description copied from interface:ConversationServiceRemoves the provided tag from the specified conversation, if it exists.- Specified by:
removeTagin interfaceConversationService- Parameters:
conversationId- the id of the conversatoin to remove the provided tag fromtag- the tag to be removed
-
countConversationsWithLastMessageBetween
public long countConversationsWithLastMessageBetween(Date from, Date until, boolean includePrivateMessages, boolean includeStickMessages) Description copied from interface:ConversationServiceTODO: this might be not the right service Number of conversations which received new messages within a given time frame. If you are only interested in general messages (neither private nor sticky messages) it's better to useConversationQueryand build a query withConversationQuery.lastMessageAfter(Date)orConversationQuery.lastMessageBefore(Date)This method is needed if private or sticky messages are also to be taken account, becauseConversation.getLastMessageTime()will not be updated for private or sticky messages.- Specified by:
countConversationsWithLastMessageBetweenin interfaceConversationService- Parameters:
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 considered- Returns:
- count of conversations with new messages within given time frame
-
findConversationsWithLastMessageBetween
public List<Conversation> findConversationsWithLastMessageBetween(Date from, Date until, boolean includePrivateMessages, boolean includeStickMessages) Description copied from interface:ConversationServiceTODO: this might be not the right service Finds conversations which received new messages within a given time frame. If you are only interested in general messages (neither private nor sticky messages) it's better to useConversationQueryand build a query withConversationQuery.lastMessageAfter(Date)orConversationQuery.lastMessageBefore(Date)This method is needed if private or sticky messages are also to be taken account, becauseConversation.getLastMessageTime()will not be updated for private or sticky messages.- Specified by:
findConversationsWithLastMessageBetweenin interfaceConversationService- Parameters:
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 considered- Returns:
- list of conversations with new messages withing given time frame
-
findByIdWithIdentityLinks
Description copied from interface:ConversationServiceFinds the conversation with the given id, with the identity links already prefetched.- Specified by:
findByIdWithIdentityLinksin interfaceConversationService
-
findByIdWithIdentityLinksAndVariables
Description copied from interface:ConversationServiceFinds the conversation with the given id, with the identity links and variables already prefetched.- Specified by:
findByIdWithIdentityLinksAndVariablesin interfaceConversationService
-
findById
Description copied from interface:ConversationServiceFinds the conversation with the given id. If you are interested in the conversation owner, participants etc. you must callConversationService.findByIdWithIdentityLinks(String).- Specified by:
findByIdin interfaceConversationService- Parameters:
conversationId- the conversation id- Returns:
- the conversation without any identity links
-
linkConversationWithUserAccount
Description copied from interface:ConversationServiceSet the id of the user account that is linked with this conversation. If a conversation is already linked with a user account then this operation will add another link.- Specified by:
linkConversationWithUserAccountin interfaceConversationService- Parameters:
conversationId- the id of the conversation that should be updateduserAccountId- the id of the user account that should be linked with the conversation
-
removeUserAccountFromConversation
Deprecated.Description copied from interface:ConversationServiceRemove the id of the user account from this conversation. If the conversation is not linked with a user already then this method does nothing. If the conversation is linked to more than one account then this method will throw an exception.- Specified by:
removeUserAccountFromConversationin interfaceConversationService- Parameters:
conversationId- the id of the conversation that should be updated
-
removeUserAccountFromConversation
Description copied from interface:ConversationServiceRemove the mapping between the user account and the given conversation. If the conversation is not linked with the user account then this method does nothing- Specified by:
removeUserAccountFromConversationin interfaceConversationService- Parameters:
userAccountId- the id of the user account that should be removedconversationId- the id of the conversation that should be updated
-
removeUserAccountsFromConversation
Description copied from interface:ConversationServiceRemove all the user account mappings with this conversation. If the conversation is not linked with a user already then this method does nothing.- Specified by:
removeUserAccountsFromConversationin interfaceConversationService- Parameters:
conversationId- the id of the conversation that should be updated
-
getVariables
Description copied from interface:ConversationServiceAll variables visible from the given conversation.- Specified by:
getVariablesin interfaceConversationService- Parameters:
conversationId- id of the conversation, cannot be null.- Returns:
- the variables or an empty map if no such variables are found.
-
getVariable
Description copied from interface:ConversationServiceThe variable value. Returns null when no variable value is found with the given name or when the value is set to null.- Specified by:
getVariablein interfaceConversationService- Parameters:
conversationId- id of conversation, cannot be null.variableName- name of variable, cannot be null.- Returns:
- the variable value or null if the variable is undefined or the value of the variable is null.
-
setVariable
Description copied from interface:ConversationServiceUpdate or create a variable for a conversation.- Specified by:
setVariablein interfaceConversationService- Parameters:
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.
-
setVariables
Description copied from interface:ConversationServiceUpdate or create given variables for a conversation.- Specified by:
setVariablesin interfaceConversationService- Parameters:
conversationId- id of the conversation, cannot be null.variables- map containing name (key) and value of variables, can be null.
-
removeVariable
Description copied from interface:ConversationServiceRemoves a variable for a conversation.- Specified by:
removeVariablein interfaceConversationService- Parameters:
conversationId- id of conversation to remove variable in.variableName- name of variable to remove.
-
removeVariables
Description copied from interface:ConversationServiceRemoves variables for a conversation.- Specified by:
removeVariablesin interfaceConversationService- Parameters:
conversationId- id of conversation to remove variable in.variableNames- collection containing name of variables to remove.
-
starConversation
Description copied from interface:ConversationServiceStar the conversation with the givenconversationIdfor the user with the givenuserId- Specified by:
starConversationin interfaceConversationService- Parameters:
conversationId- the id of the conversation that should be starred for the useruserId- the id of the user
-
unstarConversation
Description copied from interface:ConversationServiceUn-stars the conversation with the givenconversationIdfor the user with the givenuserId- Specified by:
unstarConversationin interfaceConversationService- Parameters:
conversationId- the id of the conversation that should be un-starreduserId- the id of the user
-
muteConversation
Description copied from interface:ConversationServiceMute the conversation with the givenconversationIdfor the user with the givenuserId.- Specified by:
muteConversationin interfaceConversationService- Parameters:
conversationId- the id of the conversation that should be muted for the useruserId- the id of the user
-
unmuteConversation
Description copied from interface:ConversationServiceUnmute the conversation with the giveconversationIdfor the user with the giveuserId.- Specified by:
unmuteConversationin interfaceConversationService- Parameters:
conversationId- the id of the conversation that should be unmuted for the useruserId- the id of the user
-