Class TemplateVariationDefinitionBasedTemplateLoader
- java.lang.Object
-
- com.flowable.template.engine.impl.processor.TemplateVariationDefinitionBasedTemplateLoader
-
- All Implemented Interfaces:
freemarker.cache.TemplateLoader
public class TemplateVariationDefinitionBasedTemplateLoader extends Object implements freemarker.cache.TemplateLoader
A freemarker based template loader loading template content based on aTemplateVariationModelwhich is loaded through theTemplateRepositoryServiceby its id which is passed in as the template name. However, FreeMarker adds the locale to the template name and we have to strip it away as variations are handled by the template engine rather than FreeMarker.- Author:
- Micha Kiener
-
-
Field Summary
Fields Modifier and Type Field Description protected TemplateRepositoryServicerepositoryServiceprotected ResourceLoaderresourceLoader
-
Constructor Summary
Constructors Constructor Description TemplateVariationDefinitionBasedTemplateLoader(TemplateRepositoryService repositoryService, ResourceLoader resourceLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseTemplateSource(Object templateSource)ObjectfindTemplateSource(String templateVariationId)longgetLastModified(Object templateSource)ReadergetReader(Object templateSource, String encoding)protected TemplateRepositoryServicegetRepositoryService()
-
-
-
Field Detail
-
repositoryService
protected final TemplateRepositoryService repositoryService
-
resourceLoader
protected final ResourceLoader resourceLoader
-
-
Constructor Detail
-
TemplateVariationDefinitionBasedTemplateLoader
public TemplateVariationDefinitionBasedTemplateLoader(TemplateRepositoryService repositoryService, ResourceLoader resourceLoader)
-
-
Method Detail
-
findTemplateSource
public Object findTemplateSource(String templateVariationId) throws IOException
- Specified by:
findTemplateSourcein interfacefreemarker.cache.TemplateLoader- Throws:
IOException
-
getLastModified
public long getLastModified(Object templateSource)
- Specified by:
getLastModifiedin interfacefreemarker.cache.TemplateLoader
-
getReader
public Reader getReader(Object templateSource, String encoding) throws IOException
- Specified by:
getReaderin interfacefreemarker.cache.TemplateLoader- Throws:
IOException
-
closeTemplateSource
public void closeTemplateSource(Object templateSource) throws IOException
- Specified by:
closeTemplateSourcein interfacefreemarker.cache.TemplateLoader- Throws:
IOException
-
getRepositoryService
protected TemplateRepositoryService getRepositoryService()
-
-