Class FreeMarkerTemplateProcessor
java.lang.Object
com.flowable.template.engine.impl.processor.FreeMarkerTemplateProcessor
- All Implemented Interfaces:
TemplateProcessor
public class FreeMarkerTemplateProcessor extends java.lang.Object implements TemplateProcessor
A FreeMarker engine based template processor.
- Author:
- Micha Kiener
-
Field Summary
Fields Modifier and Type Field Description protected freemarker.template.Configuration
configuration
protected static org.slf4j.Logger
LOG
protected TemplateVariationDefinitionBasedTemplateLoader
templateLoader
protected boolean
templateProcessingStrictMode
-
Constructor Summary
Constructors Constructor Description FreeMarkerTemplateProcessor(TemplateEngineConfigurationApi templateEngineConfiguration, org.springframework.core.io.ResourceLoader resourceLoader, boolean templateProcessingStrictMode)
-
Method Summary
Modifier and Type Method Description boolean
canRender(TemplateModel templateModel, TemplateVariationModel templateVariation)
Before a template is rendered, the service will call this method to check, whether this processor is able to handle the given template.protected freemarker.template.Configuration
createConfiguration()
freemarker.template.Configuration
getConfiguration()
boolean
isTemplateProcessingStrictMode()
TemplateProcessingResult
processTemplate(TemplateHolder template, java.util.Map<java.lang.String,java.lang.Object> payload, java.util.Map<java.lang.String,java.lang.Object> templateProcessingSettings)
Processes a template given by its definition which might have been loaded through theTemplateRepositoryService
.void
setTemplateProcessingStrictMode(boolean templateProcessingStrictMode)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.flowable.template.api.processor.TemplateProcessor
processTemplate
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
configuration
protected final freemarker.template.Configuration configuration -
templateLoader
-
templateProcessingStrictMode
protected boolean templateProcessingStrictMode
-
-
Constructor Details
-
FreeMarkerTemplateProcessor
public FreeMarkerTemplateProcessor(TemplateEngineConfigurationApi templateEngineConfiguration, org.springframework.core.io.ResourceLoader resourceLoader, boolean templateProcessingStrictMode)
-
-
Method Details
-
createConfiguration
protected freemarker.template.Configuration createConfiguration() -
canRender
Description copied from interface:TemplateProcessor
Before a template is rendered, the service will call this method to check, whether this processor is able to handle the given template. Typically, this is based on the type / subType of the template.- Specified by:
canRender
in interfaceTemplateProcessor
- Parameters:
templateModel
- the template definition containing meta information like type and sub type of the templatetemplateVariation
- the template to check, if it can be rendered by this processor- Returns:
true
if it can be rendered by this processor,false
otherwise
-
processTemplate
public TemplateProcessingResult processTemplate(TemplateHolder template, java.util.Map<java.lang.String,java.lang.Object> payload, java.util.Map<java.lang.String,java.lang.Object> templateProcessingSettings)Description copied from interface:TemplateProcessor
Processes a template given by its definition which might have been loaded through theTemplateRepositoryService
. The payload is used for the placeholders within the template content and must be valid according theTemplateVariationModel.getParameters()
definition.- Specified by:
processTemplate
in interfaceTemplateProcessor
- Parameters:
template
- the template holder with template and template variation informationpayload
- the optional payload, if the template is using placeholders to render properly (must be valid according the parameter definition)- Returns:
- the template processing results
-
isTemplateProcessingStrictMode
public boolean isTemplateProcessingStrictMode() -
setTemplateProcessingStrictMode
public void setTemplateProcessingStrictMode(boolean templateProcessingStrictMode) -
getConfiguration
public freemarker.template.Configuration getConfiguration()
-