Class MessageBuilderImpl
- java.lang.Object
-
- com.flowable.engage.engine.impl.message.MessageBuilderImpl
-
- All Implemented Interfaces:
MessageBuilder
public class MessageBuilderImpl extends Object implements MessageBuilder
-
-
Field Summary
Fields Modifier and Type Field Description protected StringactionDefinitionIdprotected StringactionDefinitionKeyprotected StringactionInstanceIdprotected Categorycategoryprotected CommandExecutorcommandExecutorprotected ContentItemcontentItemprotected InputStreamcontentStreamprotected StringconversationIdprotected StringcreatorIdprotected StringexternalIdprotected StringmainContentprotected StringmainContentTypeprotected StringrecipientGroupIdprotected StringrecipientIdprotected StringreplyToMessageIdprotected StringscopeIdprotected StringscopeTypeprotected StringsenderIdprotected booleanstickyMessageprotected StringsubTypeprotected List<String>tagsprotected StringtemplateLanguageprotected StringtemplateMessageCodeprotected StringtemplateMessageKeyprotected Map<String,Object>templatePayloadprotected Stringtypeprotected StringupdaterId
-
Constructor Summary
Constructors Constructor Description MessageBuilderImpl(CommandExecutor commandExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageBuilderactionDefinitionId(String actionDefinitionId)Optionally reference an action definition given by its id.MessageBuilderactionDefinitionKey(String actionDefinitionKey)Optionally reference an action definition given by its key.MessageBuilderactionInstanceId(String actionInstanceId)MessageBuilderaddTag(String tag)MessageBuilderaddTags(List<String> tags)MessageBuildercreatorId(String creatorId)MessageBuilderexternalId(String externalId)StringgetActionDefinitionId()StringgetActionDefinitionKey()StringgetActionInstanceId()CategorygetCategory()ContentItemgetContentItem()InputStreamgetContentStream()StringgetConversationId()StringgetCreatorId()StringgetExternalId()StringgetMainContent()StringgetMainContentType()StringgetRecipientGroupId()StringgetRecipientId()StringgetReplyToMessageId()StringgetScopeId()StringgetScopeType()StringgetSenderId()StringgetSubType()List<String>getTags()StringgetTemplateLanguage()StringgetTemplateMessageCode()StringgetTemplateMessageKey()Map<String,Object>getTemplatePayload()StringgetType()StringgetUpdaterId()booleanhasContentTemplate()booleanisStickyMessage()MessageBuildermainContent(String mainContent)MessageBuildermainContentTemplate(String templateKey, String messageCode, String language, Map<String,Object> payload)Adds content being rendered from the specified template (uses "standardMessage" as the template key and the provided message code and optional language as the variation).MessageBuildermainContentTemplate(String messageCode, String language, Map<String,Object> payload)Adds content being rendered from the specified template (uses "standardMessage" as the template key and the provided message code and optional language as the variation).MessageBuildermainContentType(String mainContentType)MessageBuildermedia(ContentItem contentItem)Send a media message with a provisional content itemMessageBuildermedia(ContentItem contentItem, InputStream contentStream)MessageBuilderprivateGroupMessage(String recipientGroupId)The message should be a private message for the group with therecipientGroupIdMessageBuilderprivateMessage(String recipientId)The message should be a private message for the user with therecipientId.MessageBuilderreplyToMessageId(String messageId)MessageBuilderscope(String scopeId, String scopeType)Set an explicit scope for a referenced action definition to be passed on to the action instance, if created when posting this message.Messagesend(String conversationId)Creates and sends the message to the specified conversation.MessageBuildersenderId(String senderId)voidsetCategory(Category category)MessageBuilderstickyMessage()MessageBuildersubType(String subType)MessageBuildertags(List<String> tags)MessageBuildertype(String type)MessageBuilderupdaterId(String updaterId)
-
-
-
Field Detail
-
commandExecutor
protected CommandExecutor commandExecutor
-
category
protected Category category
-
conversationId
protected String conversationId
-
creatorId
protected String creatorId
-
senderId
protected String senderId
-
updaterId
protected String updaterId
-
recipientId
protected String recipientId
-
recipientGroupId
protected String recipientGroupId
-
externalId
protected String externalId
-
actionInstanceId
protected String actionInstanceId
-
actionDefinitionId
protected String actionDefinitionId
-
actionDefinitionKey
protected String actionDefinitionKey
-
mainContent
protected String mainContent
-
templateMessageKey
protected String templateMessageKey
-
templateMessageCode
protected String templateMessageCode
-
templateLanguage
protected String templateLanguage
-
mainContentType
protected String mainContentType
-
contentItem
protected ContentItem contentItem
-
contentStream
protected InputStream contentStream
-
type
protected String type
-
subType
protected String subType
-
stickyMessage
protected boolean stickyMessage
-
scopeId
protected String scopeId
-
scopeType
protected String scopeType
-
replyToMessageId
protected String replyToMessageId
-
-
Constructor Detail
-
MessageBuilderImpl
public MessageBuilderImpl(CommandExecutor commandExecutor)
-
-
Method Detail
-
creatorId
public MessageBuilder creatorId(String creatorId)
- Specified by:
creatorIdin interfaceMessageBuilder
-
senderId
public MessageBuilder senderId(String senderId)
- Specified by:
senderIdin interfaceMessageBuilder
-
updaterId
public MessageBuilder updaterId(String updaterId)
- Specified by:
updaterIdin interfaceMessageBuilder
-
externalId
public MessageBuilder externalId(String externalId)
- Specified by:
externalIdin interfaceMessageBuilder
-
actionInstanceId
public MessageBuilder actionInstanceId(String actionInstanceId)
- Specified by:
actionInstanceIdin interfaceMessageBuilder
-
actionDefinitionId
public MessageBuilder actionDefinitionId(String actionDefinitionId)
Description copied from interface:MessageBuilderOptionally reference an action definition given by its id. The message will then reference that action definition by creating an action instance based on it within the send method. You might want to set an explicit scope for the action instance too usingMessageBuilder.scope(String, String), if not set, the conversation is automatically used as the scope for the action instance.- Specified by:
actionDefinitionIdin interfaceMessageBuilder- Parameters:
actionDefinitionId- the id of the action definition to create an action instance for, which is then referenced by this message- Returns:
- the message builder for method chaining
-
actionDefinitionKey
public MessageBuilder actionDefinitionKey(String actionDefinitionKey)
Description copied from interface:MessageBuilderOptionally reference an action definition given by its key. The message will then reference that action definition by creating an action instance based on it within the send method. You might want to set an explicit scope for the action instance too usingMessageBuilder.scope(String, String), if not set, the conversation is automatically used as the scope for the action instance.- Specified by:
actionDefinitionKeyin interfaceMessageBuilder- Parameters:
actionDefinitionKey- the key of the action definition to create an action instance for, which is then referenced by this message- Returns:
- the message builder for method chaining
-
mainContent
public MessageBuilder mainContent(String mainContent)
- Specified by:
mainContentin interfaceMessageBuilder
-
mainContentTemplate
public MessageBuilder mainContentTemplate(String messageCode, String language, Map<String,Object> payload)
Description copied from interface:MessageBuilderAdds content being rendered from the specified template (uses "standardMessage" as the template key and the provided message code and optional language as the variation). If the template has placeholders, then the payload needs to be provided as well in order to let the template engine render it.- Specified by:
mainContentTemplatein interfaceMessageBuilder- Parameters:
messageCode- the message code to be used for the variation of the templatelanguage- the language ornullto use the default onepayload- the optional payload containing the values for the placeholder of the template, if needed- Returns:
- the message builder for method chaining
-
mainContentTemplate
public MessageBuilder mainContentTemplate(String templateKey, String messageCode, String language, Map<String,Object> payload)
Description copied from interface:MessageBuilderAdds content being rendered from the specified template (uses "standardMessage" as the template key and the provided message code and optional language as the variation). If the template has placeholders, then the payload needs to be provided as well in order to let the template engine render it.- Specified by:
mainContentTemplatein interfaceMessageBuilder- Parameters:
templateKey- the key of the template to be used (will be "standardMessage", if none provided explicitly)messageCode- the message code to be used for the variation of the templatelanguage- the language ornullto use the default onepayload- the optional payload containing the values for the placeholder of the template, if needed- Returns:
- the message builder for method chaining
-
mainContentType
public MessageBuilder mainContentType(String mainContentType)
- Specified by:
mainContentTypein interfaceMessageBuilder
-
media
public MessageBuilder media(ContentItem contentItem, InputStream contentStream)
- Specified by:
mediain interfaceMessageBuilder
-
media
public MessageBuilder media(ContentItem contentItem)
Description copied from interface:MessageBuilderSend a media message with a provisional content item- Specified by:
mediain interfaceMessageBuilder- Parameters:
contentItem- the provisional content
-
type
public MessageBuilder type(String type)
- Specified by:
typein interfaceMessageBuilder
-
subType
public MessageBuilder subType(String subType)
- Specified by:
subTypein interfaceMessageBuilder
-
privateMessage
public MessageBuilder privateMessage(String recipientId)
Description copied from interface:MessageBuilderThe message should be a private message for the user with therecipientId.- Specified by:
privateMessagein interfaceMessageBuilder- Parameters:
recipientId- the id of the recipient user
-
privateGroupMessage
public MessageBuilder privateGroupMessage(String recipientGroupId)
Description copied from interface:MessageBuilderThe message should be a private message for the group with therecipientGroupId- Specified by:
privateGroupMessagein interfaceMessageBuilder- Parameters:
recipientGroupId- the id of the recipient group
-
stickyMessage
public MessageBuilder stickyMessage()
- Specified by:
stickyMessagein interfaceMessageBuilder
-
tags
public MessageBuilder tags(List<String> tags)
- Specified by:
tagsin interfaceMessageBuilder
-
addTag
public MessageBuilder addTag(String tag)
- Specified by:
addTagin interfaceMessageBuilder
-
addTags
public MessageBuilder addTags(List<String> tags)
- Specified by:
addTagsin interfaceMessageBuilder
-
replyToMessageId
public MessageBuilder replyToMessageId(String messageId)
- Specified by:
replyToMessageIdin interfaceMessageBuilder
-
scope
public MessageBuilder scope(String scopeId, String scopeType)
Description copied from interface:MessageBuilderSet an explicit scope for a referenced action definition to be passed on to the action instance, if created when posting this message. If not explicitly set, the conversation is used as the scope this message is sent to.- Specified by:
scopein interfaceMessageBuilder- Parameters:
scopeId- the id of the scope a referenced action definition should be bound toscopeType- the type of the scope for the referenced action definition- Returns:
- the message builder for method chaining
-
getCategory
public Category getCategory()
-
setCategory
public void setCategory(Category category)
-
getConversationId
public String getConversationId()
-
getCreatorId
public String getCreatorId()
-
getSenderId
public String getSenderId()
-
getUpdaterId
public String getUpdaterId()
-
getRecipientId
public String getRecipientId()
-
getRecipientGroupId
public String getRecipientGroupId()
-
getExternalId
public String getExternalId()
-
getActionInstanceId
public String getActionInstanceId()
-
getActionDefinitionId
public String getActionDefinitionId()
-
getActionDefinitionKey
public String getActionDefinitionKey()
-
getMainContent
public String getMainContent()
-
hasContentTemplate
public boolean hasContentTemplate()
-
getTemplateMessageKey
public String getTemplateMessageKey()
-
getTemplateMessageCode
public String getTemplateMessageCode()
-
getTemplateLanguage
public String getTemplateLanguage()
-
getMainContentType
public String getMainContentType()
-
getContentItem
public ContentItem getContentItem()
-
getContentStream
public InputStream getContentStream()
-
getType
public String getType()
-
getSubType
public String getSubType()
-
isStickyMessage
public boolean isStickyMessage()
-
getScopeId
public String getScopeId()
-
getScopeType
public String getScopeType()
-
getReplyToMessageId
public String getReplyToMessageId()
-
send
public Message send(String conversationId)
Description copied from interface:MessageBuilderCreates and sends the message to the specified conversation.- Specified by:
sendin interfaceMessageBuilder- Parameters:
conversationId- the id of the conversation to send the message to- Returns:
- the created and sent message object
-
-