Class ConversationBuilderImpl
- java.lang.Object
-
- com.flowable.engage.engine.impl.conversation.ConversationBuilderImpl
-
- All Implemented Interfaces:
Taggable,ConversationBuilder
public class ConversationBuilderImpl extends Object implements ConversationBuilder
- Author:
- Filip Hrisafov, Joram Barrez
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classConversationBuilderImpl.StartConversationWithChecksCmd<T>
-
Field Summary
Fields Modifier and Type Field Description protected StringassignedGroupIdprotected StringassigneeIdprotected StringavatarIdprotected Set<String>candidateGroupsprotected StringconversationDefinitionIdprotected StringconversationDefinitionKeyprotected ConversationServiceImplconversationServiceprotected Stringdescriptionprotected EngageEngineConfigurationengageEngineConfigurationprotected StringexternalIdprotected StringfallbackNameprotected StringjoiningTypeprotected Stringnameprotected StringownerIdprotected StringparentIdprotected Set<String>participantsprotected StringpermissionTypeprotected StringreferenceDefinitionIdprotected StringreferenceIdprotected StringreferenceTypeprotected StringsubTypeprotected List<String>tagsprotected StringtenantIdprotected Stringtype
-
Constructor Summary
Constructors Constructor Description ConversationBuilderImpl(ConversationServiceImpl conversationService, EngageEngineConfiguration engageEngineConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConversationBuilderaddCandidateGroup(String candidateGroup)ConversationBuilderaddParticipant(String participant)ConversationBuilderaddTag(String tag)ConversationBuilderassignedGroupId(String assignedGroupId)ConversationBuilderassigneeId(String assigneeId)ConversationBuilderavatarId(String avatarId)Optionally set the avatar information for this conversation.ConversationBuildercandidateGroups(Set<String> candidateGroups)ConversationBuilderconversationDefinitionId(String conversationDefinitionId)Set the id of the conversation definition.ConversationBuilderconversationDefinitionKey(String conversationDefinitionKey)Set the key of the conversation definition.ConversationBuilderdescription(String description)Set the optional description describing the reason or goal of the conversation in more details than the name.StringdetermineTenantId(CommandContext commandContext)protected voidenrichWithConversationDefinition()protected voidenrichWithConversationDefinition(CommandContext commandContext)ConversationBuilderexternalId(String externalId)Set the external id of the conversation.ConversationBuilderfallbackName(String fallbackName)Set the optional fallback name to be used, if there is no explicit name being set (e.g.StringgetAssignedGroupId()StringgetAssigneeId()StringgetAvatarId()Set<String>getCandidateGroups()StringgetConversationDefinitionId()StringgetConversationDefinitionKey()Returns the key that will be used to do the conversation definition lookup when creating the conversation.StringgetDescription()StringgetExternalId()StringgetFallbackName()Optional name to display when there's no title.StringgetJoiningType()StringgetName()StringgetOwnerId()StringgetParentId()Set<String>getParticipants()StringgetPermissionType()StringgetReferenceDefinitionId()StringgetReferenceId()StringgetReferenceType()StringgetSubType()List<String>getTags()Returns the optional list of tags for this object.StringgetTenantId()StringgetType()ConversationBuilderjoiningType(String joiningType)Set the joining type used for this conversation.ConversationBuildername(String name)Set the optional name for this conversation.ConversationBuilderownerId(String ownerId)ConversationBuilderparentId(String parentId)Set the id of the parent conversation, if this is a child conversation (e.g.ConversationBuilderparticipants(Set<String> participants)ConversationBuilderpermissionType(String permissionType)Set the permission type to be used for this conversation.ConversationBuilderreferenceDefinitionId(String referenceDefinitionId)Set the reference definition id of the conversation pointing to for example a case or process definition id.ConversationBuilderreferenceId(String referenceId)Set the reference id of the conversation pointing to for example a case or process instance id.ConversationBuilderreferenceType(String referenceType)Set the reference type of the conversation pointing to for example a case or process instance type.Conversationstart()Returns the newly created conversation object.ConversationstartWithPermissionCheck(String userId)Deprecated.ConversationstartWithPermissionCheck(String userId, Collection<String> userGroupKeys, String userTenantId)Same asConversationBuilder.start()with an additional permission check that the user withuserIdis allowed to create the conversation.ConversationHolderstartWithReuse()Tries to find a similar conversation, if found it would return that one.ConversationHolderstartWithReuseAndPermissionCheck(String userId)Deprecated.ConversationHolderstartWithReuseAndPermissionCheck(String userId, Collection<String> userGroupKeys, String userTenantId)Same asConversationBuilder.startWithReuse()with an additional permission check that the user withuserIdis allowed to create the conversation.ConversationBuildersubType(String subType)Set the sub type of this conversation.ConversationBuildertags(Collection<String> tags)ConversationBuildertenantId(String tenantId)Optionally sets the tenantId for this conversation.ConversationBuildertype(String type)Set the type for this conversation which has an impact on how participants might be joined, on permissions or other behaviors of the conversation.
-
-
-
Field Detail
-
conversationService
protected final ConversationServiceImpl conversationService
-
engageEngineConfiguration
protected final EngageEngineConfiguration engageEngineConfiguration
-
externalId
protected String externalId
-
parentId
protected String parentId
-
type
protected String type
-
subType
protected String subType
-
permissionType
protected String permissionType
-
joiningType
protected String joiningType
-
name
protected String name
-
fallbackName
protected String fallbackName
-
conversationDefinitionId
protected String conversationDefinitionId
-
conversationDefinitionKey
protected String conversationDefinitionKey
-
description
protected String description
-
referenceId
protected String referenceId
-
referenceType
protected String referenceType
-
referenceDefinitionId
protected String referenceDefinitionId
-
avatarId
protected String avatarId
-
ownerId
protected String ownerId
-
assigneeId
protected String assigneeId
-
assignedGroupId
protected String assignedGroupId
-
tenantId
protected String tenantId
-
-
Constructor Detail
-
ConversationBuilderImpl
public ConversationBuilderImpl(ConversationServiceImpl conversationService, EngageEngineConfiguration engageEngineConfiguration)
-
-
Method Detail
-
getExternalId
public String getExternalId()
- Specified by:
getExternalIdin interfaceConversationBuilder- See Also:
Conversation.getExternalId()
-
externalId
public ConversationBuilder externalId(String externalId)
Description copied from interface:ConversationBuilderSet the external id of the conversation.- Specified by:
externalIdin interfaceConversationBuilder- Parameters:
externalId- the external id for the conversation
-
getParentId
public String getParentId()
- Specified by:
getParentIdin interfaceConversationBuilder- See Also:
Conversation.getParentId()
-
parentId
public ConversationBuilder parentId(String parentId)
Description copied from interface:ConversationBuilderSet the id of the parent conversation, if this is a child conversation (e.g. a topic, ticket or something similar).- Specified by:
parentIdin interfaceConversationBuilder- Parameters:
parentId- the id of the parent conversation- Returns:
- conversation builder for method chaining
-
getType
public String getType()
- Specified by:
getTypein interfaceConversationBuilder- See Also:
Conversation.getType()
-
subType
public ConversationBuilder subType(String subType)
Description copied from interface:ConversationBuilderSet the sub type of this conversation.- Specified by:
subTypein interfaceConversationBuilder- Parameters:
subType- the sub type of the conversation- Returns:
- conversation builder for method chaining
-
getSubType
public String getSubType()
- Specified by:
getSubTypein interfaceConversationBuilder- See Also:
Conversation.getSubType()
-
type
public ConversationBuilder type(String type)
Description copied from interface:ConversationBuilderSet the type for this conversation which has an impact on how participants might be joined, on permissions or other behaviors of the conversation. Setting the type of the builder will lead to evaluate theConversationBuilder.joiningType(String)andConversationBuilder.permissionType(String)of it as well. The type is a mandatory field and must be set explicitly using this method. As the joining and permission types are evaluated according the type within this method, make sure to explicitly set them (if necessary) AFTER setting the sub type, otherwise they will be overwritten with defaults.- Specified by:
typein interfaceConversationBuilder- Parameters:
type- the sub type to set for this conversation- Returns:
- conversation builder for method chaining
- See Also:
Conversation.getType(),ConversationTypes
-
getPermissionType
public String getPermissionType()
- Specified by:
getPermissionTypein interfaceConversationBuilder- See Also:
Conversation.getPermissionType()
-
permissionType
public ConversationBuilder permissionType(String permissionType)
Description copied from interface:ConversationBuilderSet the permission type to be used for this conversation. If not set, it will be evaluated according type and sub type automatically. As the permission type is initialized automatically when setting theConversationBuilder.type(String), make sure to set it explicitly using this method AFTER the type is set!- Specified by:
permissionTypein interfaceConversationBuilder- Parameters:
permissionType- the permission type to be set for the conversation- Returns:
- conversation builder for method chaining
- See Also:
Conversation.getPermissionType(),PermissionTypes
-
getJoiningType
public String getJoiningType()
- Specified by:
getJoiningTypein interfaceConversationBuilder- See Also:
Conversation.getJoiningType()
-
joiningType
public ConversationBuilder joiningType(String joiningType)
Description copied from interface:ConversationBuilderSet the joining type used for this conversation. If not set, it will be evaluated according type and sub type automatically. As the joining type is initialized automatically when setting theConversationBuilder.type(String), make sure to set it explicitly using this method AFTER the type is set!- Specified by:
joiningTypein interfaceConversationBuilder- Parameters:
joiningType- the joining type to be set for this conversation- Returns:
- conversation builder for method chaining
- See Also:
Conversation.getJoiningType(),JoiningTypes
-
getName
public String getName()
- Specified by:
getNamein interfaceConversationBuilder- See Also:
Conversation.getName()
-
name
public ConversationBuilder name(String name)
Description copied from interface:ConversationBuilderSet the optional name for this conversation. Some sub types need the name (e.g. a desk or channel, etc), in this case the name is mandatory.- Specified by:
namein interfaceConversationBuilder- Parameters:
name- the name for the created conversation- Returns:
- conversation builder for method chaining
-
getFallbackName
public String getFallbackName()
Description copied from interface:ConversationBuilderOptional name to display when there's no title. By default, this will be the participant names separated by comas.- Specified by:
getFallbackNamein interfaceConversationBuilder- Returns:
- Optional conversation title
-
fallbackName
public ConversationBuilder fallbackName(String fallbackName)
Description copied from interface:ConversationBuilderSet the optional fallback name to be used, if there is no explicit name being set (e.g. the name of the participants).- Specified by:
fallbackNamein interfaceConversationBuilder- Parameters:
fallbackName- the optional fallback name for the conversation- Returns:
- conversation builder for method chaining
- See Also:
Conversation.getFallbackName()
-
getConversationDefinitionId
public String getConversationDefinitionId()
- Specified by:
getConversationDefinitionIdin interfaceConversationBuilder- See Also:
Conversation.getConversationDefinitionId()
-
getConversationDefinitionKey
public String getConversationDefinitionKey()
Description copied from interface:ConversationBuilderReturns the key that will be used to do the conversation definition lookup when creating the conversation.- Specified by:
getConversationDefinitionKeyin interfaceConversationBuilder
-
conversationDefinitionId
public ConversationBuilder conversationDefinitionId(String conversationDefinitionId)
Description copied from interface:ConversationBuilderSet the id of the conversation definition.- Specified by:
conversationDefinitionIdin interfaceConversationBuilder- Parameters:
conversationDefinitionId- the id of the conversation definition- Returns:
- conversation builder for method chaining
-
conversationDefinitionKey
public ConversationBuilder conversationDefinitionKey(String conversationDefinitionKey)
Description copied from interface:ConversationBuilderSet the key of the conversation definition.- Specified by:
conversationDefinitionKeyin interfaceConversationBuilder- Parameters:
conversationDefinitionKey- The key that will be used to find the latest version of the conversation definition.- Returns:
- conversation builder for method chaining
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceConversationBuilder- See Also:
Conversation.getDescription()
-
description
public ConversationBuilder description(String description)
Description copied from interface:ConversationBuilderSet the optional description describing the reason or goal of the conversation in more details than the name.- Specified by:
descriptionin interfaceConversationBuilder- Parameters:
description- the description for the conversation- Returns:
- conversation builder for method chaining
-
referenceId
public ConversationBuilder referenceId(String referenceId)
Description copied from interface:ConversationBuilderSet the reference id of the conversation pointing to for example a case or process instance id.- Specified by:
referenceIdin interfaceConversationBuilder- Parameters:
referenceId- The reference id pointing to for example a case or process instance id.- Returns:
- conversation builder for method chaining
-
getReferenceId
public String getReferenceId()
- Specified by:
getReferenceIdin interfaceConversationBuilder
-
referenceType
public ConversationBuilder referenceType(String referenceType)
Description copied from interface:ConversationBuilderSet the reference type of the conversation pointing to for example a case or process instance type.- Specified by:
referenceTypein interfaceConversationBuilder- Parameters:
referenceType- The reference id pointing to for example a case or process instance type.- Returns:
- conversation builder for method chaining
-
getReferenceType
public String getReferenceType()
- Specified by:
getReferenceTypein interfaceConversationBuilder
-
referenceDefinitionId
public ConversationBuilder referenceDefinitionId(String referenceDefinitionId)
Description copied from interface:ConversationBuilderSet the reference definition id of the conversation pointing to for example a case or process definition id.- Specified by:
referenceDefinitionIdin interfaceConversationBuilder- Parameters:
referenceDefinitionId- The reference definition id pointing to for example a case or process definition id.- Returns:
- conversation builder for method chaining
-
getReferenceDefinitionId
public String getReferenceDefinitionId()
- Specified by:
getReferenceDefinitionIdin interfaceConversationBuilder
-
getAvatarId
public String getAvatarId()
- Specified by:
getAvatarIdin interfaceConversationBuilder- See Also:
Conversation.getAvatarId()
-
avatarId
public ConversationBuilder avatarId(String avatarId)
Description copied from interface:ConversationBuilderOptionally set the avatar information for this conversation.- Specified by:
avatarIdin interfaceConversationBuilder- Parameters:
avatarId- the optional information for the avatar of this conversation- Returns:
- conversation builder for method chaining
-
getOwnerId
public String getOwnerId()
- Specified by:
getOwnerIdin interfaceConversationBuilder
-
ownerId
public ConversationBuilder ownerId(String ownerId)
- Specified by:
ownerIdin interfaceConversationBuilder
-
getAssigneeId
public String getAssigneeId()
- Specified by:
getAssigneeIdin interfaceConversationBuilder
-
assigneeId
public ConversationBuilder assigneeId(String assigneeId)
- Specified by:
assigneeIdin interfaceConversationBuilder
-
getAssignedGroupId
public String getAssignedGroupId()
- Specified by:
getAssignedGroupIdin interfaceConversationBuilder
-
assignedGroupId
public ConversationBuilder assignedGroupId(String assignedGroupId)
- Specified by:
assignedGroupIdin interfaceConversationBuilder
-
getParticipants
public Set<String> getParticipants()
- Specified by:
getParticipantsin interfaceConversationBuilder
-
participants
public ConversationBuilder participants(Set<String> participants)
- Specified by:
participantsin interfaceConversationBuilder
-
addParticipant
public ConversationBuilder addParticipant(String participant)
- Specified by:
addParticipantin interfaceConversationBuilder
-
getCandidateGroups
public Set<String> getCandidateGroups()
- Specified by:
getCandidateGroupsin interfaceConversationBuilder
-
candidateGroups
public ConversationBuilder candidateGroups(Set<String> candidateGroups)
- Specified by:
candidateGroupsin interfaceConversationBuilder
-
addCandidateGroup
public ConversationBuilder addCandidateGroup(String candidateGroup)
- Specified by:
addCandidateGroupin interfaceConversationBuilder
-
getTags
public List<String> getTags()
Description copied from interface:TaggableReturns the optional list of tags for this object. Tags might be used for different reasons, most likely for filtering and to have an impact on how the object might be rendered.
-
tags
public ConversationBuilder tags(Collection<String> tags)
- Specified by:
tagsin interfaceConversationBuilder
-
addTag
public ConversationBuilder addTag(String tag)
- Specified by:
addTagin interfaceConversationBuilder
-
tenantId
public ConversationBuilder tenantId(String tenantId)
Description copied from interface:ConversationBuilderOptionally sets the tenantId for this conversation. If missing, it will take the tenantId of the current user.- Specified by:
tenantIdin interfaceConversationBuilder- Returns:
- conversation builder for method chaining
-
getTenantId
public String getTenantId()
- Specified by:
getTenantIdin interfaceConversationBuilder- Returns:
- The tenantId, if set before on this builder.
-
determineTenantId
public String determineTenantId(CommandContext commandContext)
-
start
public Conversation start()
Description copied from interface:ConversationBuilderReturns the newly created conversation object. This actually performs the persistence of the conversation.- Specified by:
startin interfaceConversationBuilder- Returns:
- the newly built conversation object
-
startWithPermissionCheck
@Deprecated public Conversation startWithPermissionCheck(String userId)
Deprecated.Description copied from interface:ConversationBuilderSame asConversationBuilder.start()with an additional permission check that the user withuserIdis allowed to create the conversation.- Specified by:
startWithPermissionCheckin interfaceConversationBuilder- Parameters:
userId- the id of the user that is creating the conversation- Returns:
- the newly created conversation
- See Also:
ConversationBuilder.start()
-
startWithPermissionCheck
public Conversation startWithPermissionCheck(String userId, Collection<String> userGroupKeys, String userTenantId)
Description copied from interface:ConversationBuilderSame asConversationBuilder.start()with an additional permission check that the user withuserIdis allowed to create the conversation.- Specified by:
startWithPermissionCheckin interfaceConversationBuilder- Parameters:
userId- the id of the user that is creating the conversationuserGroupKeys- the group keys of the user that is creating the conversationuserTenantId- the tenant id of the user that is creating the conversation- Returns:
- the newly created conversation
- See Also:
ConversationBuilder.start()
-
startWithReuse
public ConversationHolder startWithReuse()
Description copied from interface:ConversationBuilderTries to find a similar conversation, if found it would return that one. Otherwise it will create a new conversation and persist it.- Specified by:
startWithReusein interfaceConversationBuilder- Returns:
- the already existing similar conversation, or the newly built conversation
-
startWithReuseAndPermissionCheck
@Deprecated public ConversationHolder startWithReuseAndPermissionCheck(String userId)
Deprecated.Description copied from interface:ConversationBuilderSame asConversationBuilder.startWithReuse()with an additional permission check that the user withuserIdis allowed to create the conversation.- Specified by:
startWithReuseAndPermissionCheckin interfaceConversationBuilder- Parameters:
userId- the id of the user that is creating the conversation- Returns:
- the already existing similar conversation, or the newly build conversation
-
startWithReuseAndPermissionCheck
public ConversationHolder startWithReuseAndPermissionCheck(String userId, Collection<String> userGroupKeys, String userTenantId)
Description copied from interface:ConversationBuilderSame asConversationBuilder.startWithReuse()with an additional permission check that the user withuserIdis allowed to create the conversation.- Specified by:
startWithReuseAndPermissionCheckin interfaceConversationBuilder- Parameters:
userId- the id of the user that is creating the conversationuserGroupKeys- the group keys of the user that is creating the conversationuserTenantId- the tenant id of the user that is creating the conversation- Returns:
- the already existing similar conversation, or the newly build conversation
-
enrichWithConversationDefinition
protected void enrichWithConversationDefinition()
-
enrichWithConversationDefinition
protected void enrichWithConversationDefinition(CommandContext commandContext)
-
-