Class FreemarkerTemplateProcessor
- java.lang.Object
-
- org.openbravo.client.kernel.BaseTemplateProcessor<freemarker.template.Template>
-
- org.openbravo.client.kernel.freemarker.FreemarkerTemplateProcessor
-
- All Implemented Interfaces:
TemplateProcessor
@ApplicationScoped public class FreemarkerTemplateProcessor extends BaseTemplateProcessor<freemarker.template.Template>
Implements theTemplateProcessor
for the freemarker templating engine.- Author:
- mtaal
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openbravo.client.kernel.TemplateProcessor
TemplateProcessor.Qualifier, TemplateProcessor.Registry, TemplateProcessor.Selector
-
-
Constructor Summary
Constructors Constructor Description FreemarkerTemplateProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected freemarker.template.Template
createTemplateImplementation(Template template, String source)
To be implemented by the subclass.String
getTemplateLanguage()
protected String
processTemplate(freemarker.template.Template templateImplementation, Map<String,Object> data)
Run a template implementation for specific data set.void
validate(Template template)
Validates if a certain template object is valid.-
Methods inherited from class org.openbravo.client.kernel.BaseTemplateProcessor
clearCache, createSetFreeMarkerTemplateInCache, createTemplateSource, getTemplateImplementation, process, readTemplateSourceFromClasspath
-
-
-
-
Field Detail
-
QUALIFIER
public static final String QUALIFIER
- See Also:
- Constant Field Values
-
-
Method Detail
-
processTemplate
protected String processTemplate(freemarker.template.Template templateImplementation, Map<String,Object> data)
Description copied from class:BaseTemplateProcessor
Run a template implementation for specific data set.- Specified by:
processTemplate
in classBaseTemplateProcessor<freemarker.template.Template>
- Parameters:
templateImplementation
- the template to processdata
- the data which should be passed to the template- Returns:
- the template output
-
createTemplateImplementation
protected freemarker.template.Template createTemplateImplementation(Template template, String source)
Description copied from class:BaseTemplateProcessor
To be implemented by the subclass. Based on the template from the DB and the complete template source, create a language specific template implementation instance.- Specified by:
createTemplateImplementation
in classBaseTemplateProcessor<freemarker.template.Template>
- Parameters:
template
- the template object from the DBsource
- the complete source (after resolving and including all dependencies)- Returns:
- the template implementation
-
validate
public void validate(Template template) throws ValidationException
Description copied from interface:TemplateProcessor
Validates if a certain template object is valid. If not valid then aValidationException
is thrown.- Parameters:
template
- the template to validate- Throws:
ValidationException
-
getTemplateLanguage
public String getTemplateLanguage()
- Returns:
- the template language supported by this template processor
-
-