Class BaseExternalMessageBuilder
- java.lang.Object
-
- com.flowable.engage.external.system.common.BaseExternalMessageBuilder
-
- All Implemented Interfaces:
ExternalMessageBuilder
- Direct Known Subclasses:
LineExternalMessageBuilder
,WeChatExternalMessageBuilder
,WhatsAppExternalMessageBuilder
public abstract class BaseExternalMessageBuilder extends Object implements ExternalMessageBuilder
Base class that can be used by different external system provider to provide an implementation for the sending of the outbound message.- Author:
- Filip Hrisafov
-
-
Field Summary
Fields Modifier and Type Field Description protected String
businessAccountId
protected String
externalUserId
protected String
message
protected String
messageId
-
Constructor Summary
Constructors Constructor Description BaseExternalMessageBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ExternalMessageBuilder
businessAccountId(String businessAccountId)
The id of the business account for the external userprotected void
checkBeforeSend(String type)
Perform certain checks before sending the message.protected OutboundMessageDto
createOutboundMessage(String type)
ExternalMessageBuilder
externalUserId(String externalUserId)
The id of the external user to which the message should be send toExternalMessageBuilder
message(String message)
The contents of the message that needs to be sendExternalMessageBuilder
messageId(String messageId)
The id of the message being send (can be used for logging purposes)protected OutboundMessageDto
newOutboundMessageDto()
void
sendMediaMessage(String mediaId)
Perform sending of media messagevoid
sendMessage()
Perform sending a normal text messageprotected abstract void
sendOutboundMessage(OutboundMessageDto outboundMessage)
protected String
validateAndCreateMessageContent(String type)
This method is invoked when the content for the outbound message is create.
-
-
-
Method Detail
-
externalUserId
public ExternalMessageBuilder externalUserId(String externalUserId)
Description copied from interface:ExternalMessageBuilder
The id of the external user to which the message should be send to- Specified by:
externalUserId
in interfaceExternalMessageBuilder
- Parameters:
externalUserId
- the external user id
-
businessAccountId
public ExternalMessageBuilder businessAccountId(String businessAccountId)
Description copied from interface:ExternalMessageBuilder
The id of the business account for the external user- Specified by:
businessAccountId
in interfaceExternalMessageBuilder
- Parameters:
businessAccountId
- the bussiness account id
-
messageId
public ExternalMessageBuilder messageId(String messageId)
Description copied from interface:ExternalMessageBuilder
The id of the message being send (can be used for logging purposes)- Specified by:
messageId
in interfaceExternalMessageBuilder
- Parameters:
messageId
- the message id
-
message
public ExternalMessageBuilder message(String message)
Description copied from interface:ExternalMessageBuilder
The contents of the message that needs to be send- Specified by:
message
in interfaceExternalMessageBuilder
- Parameters:
message
- the message content
-
sendMessage
public void sendMessage()
Description copied from interface:ExternalMessageBuilder
Perform sending a normal text message- Specified by:
sendMessage
in interfaceExternalMessageBuilder
-
sendMediaMessage
public void sendMediaMessage(String mediaId)
Description copied from interface:ExternalMessageBuilder
Perform sending of media message- Specified by:
sendMediaMessage
in interfaceExternalMessageBuilder
- Parameters:
mediaId
- the id of the media that is being sent
-
checkBeforeSend
protected void checkBeforeSend(String type)
Perform certain checks before sending the message. By default this checks that theexternalUserId
andmessageId
have been set.- Parameters:
type
- the type of message that is being send
-
sendOutboundMessage
protected abstract void sendOutboundMessage(OutboundMessageDto outboundMessage)
-
createOutboundMessage
protected OutboundMessageDto createOutboundMessage(String type)
-
newOutboundMessageDto
protected OutboundMessageDto newOutboundMessageDto()
-
validateAndCreateMessageContent
protected String validateAndCreateMessageContent(String type)
This method is invoked when the content for the outbound message is create. It can be used to perform validations and to modify the content if it is required. By default this methods appends the display name to the message.- Parameters:
type
- the type of the message for which the content is being created- Returns:
- the content that should be used to send the message
-
-