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 String
actionDefinitionId
protected String
actionDefinitionKey
protected String
actionInstanceId
protected Category
category
protected CommandExecutor
commandExecutor
protected ContentItem
contentItem
protected InputStream
contentStream
protected String
conversationId
protected String
creatorId
protected String
externalId
protected String
mainContent
protected String
mainContentType
protected String
recipientGroupId
protected String
recipientId
protected String
replyToMessageId
protected String
scopeId
protected String
scopeType
protected String
senderId
protected boolean
stickyMessage
protected String
subType
protected List<String>
tags
protected String
templateLanguage
protected String
templateMessageCode
protected String
templateMessageKey
protected Map<String,Object>
templatePayload
protected String
type
protected String
updaterId
-
Constructor Summary
Constructors Constructor Description MessageBuilderImpl(CommandExecutor commandExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageBuilder
actionDefinitionId(String actionDefinitionId)
Optionally reference an action definition given by its id.MessageBuilder
actionDefinitionKey(String actionDefinitionKey)
Optionally reference an action definition given by its key.MessageBuilder
actionInstanceId(String actionInstanceId)
MessageBuilder
addTag(String tag)
MessageBuilder
addTags(List<String> tags)
MessageBuilder
creatorId(String creatorId)
MessageBuilder
externalId(String externalId)
String
getActionDefinitionId()
String
getActionDefinitionKey()
String
getActionInstanceId()
Category
getCategory()
ContentItem
getContentItem()
InputStream
getContentStream()
String
getConversationId()
String
getCreatorId()
String
getExternalId()
String
getMainContent()
String
getMainContentType()
String
getRecipientGroupId()
String
getRecipientId()
String
getReplyToMessageId()
String
getScopeId()
String
getScopeType()
String
getSenderId()
String
getSubType()
List<String>
getTags()
String
getTemplateLanguage()
String
getTemplateMessageCode()
String
getTemplateMessageKey()
Map<String,Object>
getTemplatePayload()
String
getType()
String
getUpdaterId()
boolean
hasContentTemplate()
boolean
isStickyMessage()
MessageBuilder
mainContent(String mainContent)
MessageBuilder
mainContentTemplate(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).MessageBuilder
mainContentTemplate(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).MessageBuilder
mainContentType(String mainContentType)
MessageBuilder
media(ContentItem contentItem)
Send a media message with a provisional content itemMessageBuilder
media(ContentItem contentItem, InputStream contentStream)
MessageBuilder
privateGroupMessage(String recipientGroupId)
The message should be a private message for the group with therecipientGroupId
MessageBuilder
privateMessage(String recipientId)
The message should be a private message for the user with therecipientId
.MessageBuilder
replyToMessageId(String messageId)
MessageBuilder
scope(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.Message
send(String conversationId)
Creates and sends the message to the specified conversation.MessageBuilder
senderId(String senderId)
void
setCategory(Category category)
MessageBuilder
stickyMessage()
MessageBuilder
subType(String subType)
MessageBuilder
tags(List<String> tags)
MessageBuilder
type(String type)
MessageBuilder
updaterId(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:
creatorId
in interfaceMessageBuilder
-
senderId
public MessageBuilder senderId(String senderId)
- Specified by:
senderId
in interfaceMessageBuilder
-
updaterId
public MessageBuilder updaterId(String updaterId)
- Specified by:
updaterId
in interfaceMessageBuilder
-
externalId
public MessageBuilder externalId(String externalId)
- Specified by:
externalId
in interfaceMessageBuilder
-
actionInstanceId
public MessageBuilder actionInstanceId(String actionInstanceId)
- Specified by:
actionInstanceId
in interfaceMessageBuilder
-
actionDefinitionId
public MessageBuilder actionDefinitionId(String actionDefinitionId)
Description copied from interface:MessageBuilder
Optionally 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:
actionDefinitionId
in 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:MessageBuilder
Optionally 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:
actionDefinitionKey
in 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:
mainContent
in interfaceMessageBuilder
-
mainContentTemplate
public MessageBuilder mainContentTemplate(String messageCode, String language, Map<String,Object> payload)
Description copied from interface:MessageBuilder
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). 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:
mainContentTemplate
in interfaceMessageBuilder
- Parameters:
messageCode
- the message code to be used for the variation of the templatelanguage
- the language ornull
to 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:MessageBuilder
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). 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:
mainContentTemplate
in 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 ornull
to 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:
mainContentType
in interfaceMessageBuilder
-
media
public MessageBuilder media(ContentItem contentItem, InputStream contentStream)
- Specified by:
media
in interfaceMessageBuilder
-
media
public MessageBuilder media(ContentItem contentItem)
Description copied from interface:MessageBuilder
Send a media message with a provisional content item- Specified by:
media
in interfaceMessageBuilder
- Parameters:
contentItem
- the provisional content
-
type
public MessageBuilder type(String type)
- Specified by:
type
in interfaceMessageBuilder
-
subType
public MessageBuilder subType(String subType)
- Specified by:
subType
in interfaceMessageBuilder
-
privateMessage
public MessageBuilder privateMessage(String recipientId)
Description copied from interface:MessageBuilder
The message should be a private message for the user with therecipientId
.- Specified by:
privateMessage
in interfaceMessageBuilder
- Parameters:
recipientId
- the id of the recipient user
-
privateGroupMessage
public MessageBuilder privateGroupMessage(String recipientGroupId)
Description copied from interface:MessageBuilder
The message should be a private message for the group with therecipientGroupId
- Specified by:
privateGroupMessage
in interfaceMessageBuilder
- Parameters:
recipientGroupId
- the id of the recipient group
-
stickyMessage
public MessageBuilder stickyMessage()
- Specified by:
stickyMessage
in interfaceMessageBuilder
-
tags
public MessageBuilder tags(List<String> tags)
- Specified by:
tags
in interfaceMessageBuilder
-
addTag
public MessageBuilder addTag(String tag)
- Specified by:
addTag
in interfaceMessageBuilder
-
addTags
public MessageBuilder addTags(List<String> tags)
- Specified by:
addTags
in interfaceMessageBuilder
-
replyToMessageId
public MessageBuilder replyToMessageId(String messageId)
- Specified by:
replyToMessageId
in interfaceMessageBuilder
-
scope
public MessageBuilder scope(String scopeId, String scopeType)
Description copied from interface:MessageBuilder
Set 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:
scope
in 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:MessageBuilder
Creates and sends the message to the specified conversation.- Specified by:
send
in interfaceMessageBuilder
- Parameters:
conversationId
- the id of the conversation to send the message to- Returns:
- the created and sent message object
-
-