fr.opensagres.xdocreport.template.velocity.internal
Class VelocityTemplateEngine

java.lang.Object
  extended by fr.opensagres.xdocreport.template.AbstractTemplateEngine
      extended by fr.opensagres.xdocreport.template.velocity.internal.VelocityTemplateEngine
All Implemented Interfaces:
ITemplateEngine, VelocityConstants

public class VelocityTemplateEngine
extends AbstractTemplateEngine
implements VelocityConstants

Velocity template engine implementation.


Field Summary
 
Fields inherited from interface fr.opensagres.xdocreport.template.velocity.VelocityConstants
DESCRIPTION_DISCOVERY, ID_DISCOVERY, VELOCITY_TEMPLATE_ENGINE_KEY
 
Constructor Summary
VelocityTemplateEngine(Properties velocityEngineProperties)
           
 
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()
           
 String getId()
          Return the identifier of the template engine.
 String getKind()
          Returns the template engien kind (Freemarker, Velocity..)
protected  org.apache.velocity.app.VelocityEngine getVelocityEngine()
           
 void initializeVelocityEngine(Properties velocityEngineProperties)
           
 boolean isFieldNameStartsWithUpperCase()
           
 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)
           
 
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

VelocityTemplateEngine

public VelocityTemplateEngine(Properties velocityEngineProperties)
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

getVelocityEngine

protected org.apache.velocity.app.VelocityEngine getVelocityEngine()
                                                            throws XDocReportException
Throws:
XDocReportException

initializeVelocityEngine

public void initializeVelocityEngine(Properties velocityEngineProperties)
                              throws XDocReportException
Throws:
XDocReportException

setConfiguration

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

getDocumentFormatter

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

extractFields

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

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.