fr.opensagres.xdocreport.template.freemarker
Class FreemarkerTemplateEngine

java.lang.Object
  extended by fr.opensagres.xdocreport.template.AbstractTemplateEngine
      extended by fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine
All Implemented Interfaces:
FreemarkerConstants, ITemplateEngine

public class FreemarkerTemplateEngine
extends AbstractTemplateEngine
implements FreemarkerConstants

Freemarker template engine implementation.


Field Summary
 
Fields inherited from interface fr.opensagres.xdocreport.template.freemarker.FreemarkerConstants
DESCRIPTION_DISCOVERY, ID_DISCOVERY
 
Constructor Summary
FreemarkerTemplateEngine()
           
 
Method Summary
 IContext createContext()
          Create a new context to register Java model.
 IContext createContext(Map<String,Object> contextMap)
          Create a new context to register Java model from the given Map.
 void extractFields(Reader reader, String entryName, FieldsExtractor extractor)
           
 IDocumentFormatter getDocumentFormatter()
           
 freemarker.template.Configuration getFreemarkerConfiguration()
           
 String getId()
          Return the identifier of the template engine.
 String getKind()
          Returns the template engien kind (Freemarker, Velocity..)
 boolean isFieldNameStartsWithUpperCase()
           
 boolean isForceModifyReader()
           
 void process(String templateName, IContext context, Writer writer)
          Merge Java model coming from the given context with the given template name and register the merge result in the given writer.
protected  void processNoCache(String entryName, IContext context, Reader reader, Writer writer)
           
protected  void processWithCache(String templateName, IContext context, Writer writer)
           
 void setConfiguration(ITemplateEngineConfiguration configuration)
           
 void setForceModifyReader(boolean forceModifyReader)
           
 void setFreemarkerConfiguration(freemarker.template.Configuration freemarkerConfiguration)
           
 
Methods inherited from class fr.opensagres.xdocreport.template.AbstractTemplateEngine
extractFields, getConfiguration, getTemplateCacheInfoProvider, isUseTemplateCache, process, process, process, setTemplateCacheInfoProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreemarkerTemplateEngine

public FreemarkerTemplateEngine()
Method Detail

getKind

public String getKind()
Description copied from interface: ITemplateEngine
Returns the template engien kind (Freemarker, Velocity..)

Specified by:
getKind in interface ITemplateEngine
Returns:

getId

public String getId()
Description copied from interface: ITemplateEngine
Return the identifier of the template engine.

Specified by:
getId in interface ITemplateEngine
Returns:

createContext

public IContext createContext()
Description copied from interface: ITemplateEngine
Create a new context to register Java model.

Specified by:
createContext in interface ITemplateEngine
Returns:

createContext

public IContext createContext(Map<String,Object> contextMap)
Description copied from interface: ITemplateEngine
Create a new context to register Java model from the given Map.

Specified by:
createContext in interface ITemplateEngine
Returns:

processWithCache

protected void processWithCache(String templateName,
                                IContext context,
                                Writer writer)
                         throws XDocReportException,
                                IOException
Specified by:
processWithCache in class AbstractTemplateEngine
Throws:
XDocReportException
IOException

processNoCache

protected void processNoCache(String entryName,
                              IContext context,
                              Reader reader,
                              Writer writer)
                       throws XDocReportException,
                              IOException
Specified by:
processNoCache in class AbstractTemplateEngine
Throws:
XDocReportException
IOException

getFreemarkerConfiguration

public freemarker.template.Configuration getFreemarkerConfiguration()

setFreemarkerConfiguration

public void setFreemarkerConfiguration(freemarker.template.Configuration freemarkerConfiguration)

extractFields

public void extractFields(Reader reader,
                          String entryName,
                          FieldsExtractor extractor)
                   throws XDocReportException
Specified by:
extractFields in interface ITemplateEngine
Throws:
XDocReportException

getDocumentFormatter

public IDocumentFormatter getDocumentFormatter()
Specified by:
getDocumentFormatter in interface ITemplateEngine

setConfiguration

public void setConfiguration(ITemplateEngineConfiguration configuration)
Specified by:
setConfiguration in interface ITemplateEngine
Overrides:
setConfiguration in class AbstractTemplateEngine

setForceModifyReader

public void setForceModifyReader(boolean forceModifyReader)

isForceModifyReader

public boolean isForceModifyReader()

process

public void process(String templateName,
                    IContext context,
                    Writer writer)
             throws IOException,
                    XDocReportException
Description copied from interface: ITemplateEngine
Merge Java model coming from the given context with the given template name and register the merge result in the given writer.

Specified by:
process in interface ITemplateEngine
Parameters:
templateName - template name
context - Java model context
writer - merge result writer
Throws:
IOException
XDocReportException

isFieldNameStartsWithUpperCase

public boolean isFieldNameStartsWithUpperCase()
Specified by:
isFieldNameStartsWithUpperCase in interface ITemplateEngine


Copyright © 2013. All rights reserved.