Interface TemplateProcessor
- All Known Implementing Classes:
AsposePdfTemplateProcessor,AsposeWordTemplateProcessor,DocumentTemplateProcessor,FreeMarkerTemplateProcessor
public interface TemplateProcessor
A template processor is used to process a
TemplateVariationDefinition and is typically registered / looked up
based on the type of a template returned by TemplateDefinition.getType().- Author:
- Micha Kiener
-
Method Summary
Modifier and Type Method Description booleancanRender(TemplateModel template, 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.default TemplateProcessingResultprocessTemplate(TemplateHolder template, java.util.Map<java.lang.String,java.lang.Object> payload)TemplateProcessingResultprocessTemplate(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.
-
Method Details
-
canRender
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.- Parameters:
template- 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:
trueif it can be rendered by this processor,falseotherwise
-
processTemplate
default TemplateProcessingResult processTemplate(TemplateHolder template, java.util.Map<java.lang.String,java.lang.Object> payload) -
processTemplate
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. The payload is used for the placeholders within the template content and must be valid according theTemplateVariationModel.getParameters()definition.- 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
-