Class TemplateMessageUtil
- java.lang.Object
-
- com.flowable.engage.engine.impl.util.TemplateMessageUtil
-
public class TemplateMessageUtil extends Object
This utility helps creating template based standard messages. If you want to create your own standard message:- create a message code within
StandardMessageCodes - add message template as a JSON resource in `com/flowable/template/default/` with name `standard-{yourMessageCode}_en.tplvariation`
- optionally add message template as a JSON resource in `com/flowable/template/default/` with name `standard-{yourMessageCode}_{languageCode}.tplvariation` for any further languages you want to support
createMessage(String, Map)orcreateMessage(String, String, Map)to render a message based on your template.- Author:
- Micha Kiener
- create a message code within
-
-
Field Summary
Fields Modifier and Type Field Description static StringFALLBACK_LANGUAGEThe default language if no language is setstatic StringSTANDARD_MESSAGES_TEMPLATE_KEYThe template definition key used for standard messages.static StringVARIANT_KEY_LANGUAGEstatic StringVARIANT_KEY_MESSAGE_CODE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcreateMessage(String messageTemplateKey, String messageCode, String language, Map<String,Object> payload, String tenantId)Creates a message based on the provided template key, message code and payload.static StringcreateMessage(String messageCode, String language, Map<String,Object> payload)Creates a standard message based on the provided message code and payload.static StringcreateMessage(String messageCode, Map<String,Object> payload)Creates a standard message based on the provided message code and payload.
-
-
-
Field Detail
-
STANDARD_MESSAGES_TEMPLATE_KEY
public static final String STANDARD_MESSAGES_TEMPLATE_KEY
The template definition key used for standard messages.- See Also:
- Constant Field Values
-
VARIANT_KEY_MESSAGE_CODE
public static final String VARIANT_KEY_MESSAGE_CODE
- See Also:
- Constant Field Values
-
VARIANT_KEY_LANGUAGE
public static final String VARIANT_KEY_LANGUAGE
- See Also:
- Constant Field Values
-
FALLBACK_LANGUAGE
public static final String FALLBACK_LANGUAGE
The default language if no language is set- See Also:
- Constant Field Values
-
-
Method Detail
-
createMessage
public static String createMessage(String messageCode, Map<String,Object> payload)
Creates a standard message based on the provided message code and payload. The payload must at least contain the necessary parameters as being defined within theTemplateVariationModel. This one uses english as the default language.- Parameters:
messageCode- the message code to choose the template variation forpayload- the optional payload containing the necessary parameters (if any needed by the template)- Returns:
- the rendered standard message
-
createMessage
public static String createMessage(String messageCode, String language, Map<String,Object> payload)
Creates a standard message based on the provided message code and payload. The payload must at least contain the necessary parameters as being defined within theTemplateVariationModel.- Parameters:
messageCode- the message code to choose the template variation forlanguage- the language (e.g. "en") for which the message should be renderedpayload- the optional payload containing the necessary parameters (if any needed by the template)- Returns:
- the rendered standard message
-
createMessage
public static String createMessage(String messageTemplateKey, String messageCode, String language, Map<String,Object> payload, String tenantId)
Creates a message based on the provided template key, message code and payload. The payload must at least contain the necessary parameters as being defined within theTemplateVariationModel.- Parameters:
messageTemplateKey- the template key of the message template to be usedmessageCode- the message code to choose the template variation forlanguage- the language (e.g. "en") for which the message should be renderedpayload- the optional payload containing the necessary parameters (if any needed by the template)tenantId- for the message- Returns:
- the rendered standard message
-
-