Class AbstractTemplateEngine

java.lang.Object
fr.opensagres.xdocreport.template.AbstractTemplateEngine
All Implemented Interfaces:
ITemplateEngine

public abstract class AbstractTemplateEngine extends Object implements ITemplateEngine
  • Constructor Details

    • AbstractTemplateEngine

      public AbstractTemplateEngine()
  • Method Details

    • getTemplateCacheInfoProvider

      public ITemplateCacheInfoProvider getTemplateCacheInfoProvider()
      Specified by:
      getTemplateCacheInfoProvider in interface ITemplateEngine
    • setTemplateCacheInfoProvider

      public void setTemplateCacheInfoProvider(ITemplateCacheInfoProvider templateCacheInfoProvider)
      Specified by:
      setTemplateCacheInfoProvider in interface ITemplateEngine
    • getConfiguration

      public ITemplateEngineConfiguration getConfiguration()
      Specified by:
      getConfiguration in interface ITemplateEngine
    • setConfiguration

      public void setConfiguration(ITemplateEngineConfiguration configuration)
      Specified by:
      setConfiguration in interface ITemplateEngine
    • process

      public void process(String reportId, String entryName, fr.opensagres.xdocreport.core.io.IEntryReaderProvider readerProvider, fr.opensagres.xdocreport.core.io.IEntryWriterProvider writerProvider, IContext context) throws fr.opensagres.xdocreport.core.XDocReportException, IOException
      Description copied from interface: ITemplateEngine
      Merge Java model coming from the given context with the XML file entryName of the given document archive and modify the entry of the document archive.
      Specified by:
      process in interface ITemplateEngine
      Parameters:
      reportId - IXDocReport#getId().
      entryName - entry name of the XML file from the document archive which must be merged. This XML file is the template.
      readerProvider - entry reader provider.
      context - Java model context
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException
    • process

      public void process(String reportId, String entryName, fr.opensagres.xdocreport.core.io.IEntryReaderProvider readerProvider, Writer writer, IContext context) throws fr.opensagres.xdocreport.core.XDocReportException, IOException
      Specified by:
      process in interface ITemplateEngine
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException
    • process

      public void process(String entryName, IContext context, Reader reader, Writer writer) throws fr.opensagres.xdocreport.core.XDocReportException, IOException
      Description copied from interface: ITemplateEngine
      Merge Java model coming from the given context with the given reader and register the merge result in the given writer.
      Specified by:
      process in interface ITemplateEngine
      Parameters:
      entryName - template name
      context - Java model context
      reader - template reader to merge
      writer - merge result writer
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException
    • extractFields

      public void extractFields(fr.opensagres.xdocreport.core.io.IEntryReaderProvider readerProvider, String entryName, FieldsExtractor extractor) throws fr.opensagres.xdocreport.core.XDocReportException
      Specified by:
      extractFields in interface ITemplateEngine
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
    • isUseTemplateCache

      protected boolean isUseTemplateCache(String reportId)
    • processWithCache

      protected abstract void processWithCache(String templateName, IContext context, Writer writer) throws fr.opensagres.xdocreport.core.XDocReportException, IOException
      Merge the given template with the given context and writes the result in the given writer. Cache is used here to avoid parsing the template name each time.
      Parameters:
      templateName - the template name.
      context - the context.
      writer - the result of merge.
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException
    • processNoCache

      protected abstract void processNoCache(String templateName, IContext context, Reader reader, Writer writer) throws fr.opensagres.xdocreport.core.XDocReportException, IOException
      Merge the given template with the given context and writes the result in the given writer.
      Parameters:
      templateName - the template name.
      context - the context.
      writer - the result of merge.
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException