Class XDocReport

java.lang.Object
fr.opensagres.xdocreport.document.XDocReport

public class XDocReport extends Object
Helper class to generate report and convert it if needed.
  • Constructor Details

    • XDocReport

      public XDocReport()
  • Method Details

    • generateReport

      public static IXDocReport generateReport(String reportId, IXDocReportController controller, Map<String,Object> contextMap, OutputStream out) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report by using controller to load report.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      controller - the controller used to load the template report if it is not already loaded.
      contextMap - the context map values used to replace values of the template report.
      out - the output stream where the report must be generated.
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateReport

      public static IXDocReport generateReport(String reportId, IXDocReportController controller, Map<String,Object> contextMap, OutputStream out, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report by using controller to load report by setting the registry.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      controller - the controller used to load the template report if it is not already loaded.
      contextMap - the context map values used to replace values of the template report.
      out - the output stream where the report must be generated.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateReportAndConvert

      public static IXDocReport generateReportAndConvert(String reportId, IXDocReportController controller, Map<String,Object> contextMap, fr.opensagres.xdocreport.converter.Options options, OutputStream out) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report and convert it by using controller to load report.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      controller - the controller used to load the template report if it is not already loaded.
      contextMap - the context map values used to replace values of the template report.
      options - the converter options.
      out - the output stream where the report must be generated.
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateReportAndConvert

      public static IXDocReport generateReportAndConvert(String reportId, IXDocReportController controller, Map<String,Object> contextMap, fr.opensagres.xdocreport.converter.Options options, OutputStream out, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report and convert it by using controller to load report by setting the registry.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      controller - the controller used to load the template report if it is not already loaded.
      contextMap - the context map values used to replace values of the template report.
      options - the converter options.
      out - the output stream where the report must be generated.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • getReport

      public static IXDocReport getReport(String reportId, IXDocReportController controller) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Get the template report from the cache registered with report id and load it if it is not found by using the given controller.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      controller - the controller used to load the template report if it is not already loaded.
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • getReport

      public static IXDocReport getReport(String reportId, IXDocReportController controller, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Get the template report from the cache registered with report id and load it if it is not found by using the given controller by setting the registry.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      controller - the controller used to load the template report if it is not already loaded.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • loadReport

      public static IXDocReport loadReport(String reportId, IXDocReportController controller, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Load the template report by using the given controller and cache it to the given registry
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      controller - the controller used to load the template report.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateReport

      public static IXDocReport generateReport(String reportId, IXDocReportLoader reportLoader, Map<String,Object> contextMap, OutputStream out) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report by using report loader to load report.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      reportLoader - the reportLoader used to load the template report if it is not already loaded.
      contextMap - the context map values used to replace values of the template report.
      out - the output stream where the report must be generated.
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateReport

      public static IXDocReport generateReport(String reportId, IXDocReportLoader reportLoader, Map<String,Object> contextMap, OutputStream out, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report by using report loader to load report by setting the registry.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      reportLoader - the report loader used to load the template report if it is not already loaded.
      contextMap - the context map values used to replace values of the template report.
      out - the output stream where the report must be generated.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateReportAndConvert

      public static IXDocReport generateReportAndConvert(String reportId, IXDocReportLoader reportLoader, Map<String,Object> contextMap, fr.opensagres.xdocreport.converter.Options options, OutputStream out) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report and convert it by using report loader to load report.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      reportLoader - the report loader used to load the template report if it is not already loaded.
      contextMap - the context map values used to replace values of the template report.
      options - the converter options.
      out - the output stream where the report must be generated.
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateReportAndConvert

      public static IXDocReport generateReportAndConvert(String reportId, IXDocReportLoader reportLoader, Map<String,Object> contextMap, fr.opensagres.xdocreport.converter.Options options, OutputStream out, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report and convert it by using report loader to load report by setting the registry.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      reportLoader - the report loader used to load the template report if it is not already loaded.
      contextMap - the context map values used to replace values of the template report.
      options - the converter options.
      out - the output stream where the report must be generated.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • getReport

      public static IXDocReport getReport(String reportId, IXDocReportLoader reportLoader) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Get the template report from the cache registered with report id and load it if it is not found by using the given report loader.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      reportLoader - the report loader used to load the template report if it is not already loaded.
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • getReport

      public static IXDocReport getReport(String reportId, IXDocReportLoader reportLoader, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Get the template report from the cache registered with report id and load it if it is not found by using the given report loader by setting the registry.
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      reportLoader - the report loader used to load the template report if it is not already loaded.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • loadReport

      public static IXDocReport loadReport(String reportId, IXDocReportLoader reportLoader, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Load the template report by using the given report loader and cache it to the given registry
      Parameters:
      reportId - the report id used to retrieves from the cache the template report if it is already loaded.
      reportLoader - the report loader used to load the template report.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateReport

      public static IXDocReport generateReport(InputStream sourceStream, String templateEngineKind, fr.opensagres.xdocreport.template.formatter.FieldsMetadata metadata, Map<String,Object> contextMap, OutputStream out) throws fr.opensagres.xdocreport.core.XDocReportException, IOException
      Generate report without cache.
      Parameters:
      sourceStream - the input stream of the template report (docx, odt, etc).
      templateEngineKind - the template engine kind (Velocity, Freemarker).
      metadata - the fields metadata or null if no need the fields metadata.
      contextMap - the context map values used to replace values of the template report.
      out - the output stream where the report must be generated.
      Returns:
      an instance of the loaded template report.
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException
    • generateReport

      public static IXDocReport generateReport(InputStream sourceStream, String templateEngineKind, fr.opensagres.xdocreport.template.formatter.FieldsMetadata metadata, Map<String,Object> contextMap, OutputStream out, XDocReportRegistry registry) throws fr.opensagres.xdocreport.core.XDocReportException, IOException
      Generate report without cache by setting the registry.
      Parameters:
      sourceStream - the input stream of the template report (docx, odt, etc).
      templateEngineKind - the template engine kind (Velocity, Freemarker).
      metadata - the fields metadata or null if no need the fields metadata.
      contextMap - the context map values used to replace values of the template report.
      out - the output stream where the report must be generated.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException
    • generateReportAndConvert

      public static IXDocReport generateReportAndConvert(InputStream sourceStream, String templateEngineKind, fr.opensagres.xdocreport.template.formatter.FieldsMetadata metadata, Map<String,Object> contextMap, fr.opensagres.xdocreport.converter.Options options, OutputStream out) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report and convert it to another format (PDF, XHTML) without cache.
      Parameters:
      sourceStream - the input stream of the template report (docx, odt, etc).
      templateEngineKind - the template engine kind (Velocity, Freemarker).
      metadata - the fields metadata or null if no need the fields metadata.
      contextMap - the context map values used to replace values of the template report.
      options - the converter options.
      out - the output stream where the report must be generated.
      Returns:
      an instance of the loaded template report.
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException
    • generateReportAndConvert

      public static IXDocReport generateReportAndConvert(InputStream sourceStream, String templateEngineKind, fr.opensagres.xdocreport.template.formatter.FieldsMetadata metadata, Map<String,Object> contextMap, fr.opensagres.xdocreport.converter.Options options, OutputStream out, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Generate report and convert it to another format (PDF, XHTML) without cache by setting the registry.
      Parameters:
      sourceStream - the input stream of the template report (docx, odt, etc).
      templateEngineKind - the template engine kind (Velocity, Freemarker).
      metadata - the fields metadata or null if no need the fields metadata.
      contextMap - the context map values used to replace values of the template report.
      options - the converter options.
      out - the output stream where the report must be generated.
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
      IOException
    • loadReport

      public static IXDocReport loadReport(InputStream sourceStream, String templateEngineKind, fr.opensagres.xdocreport.template.formatter.FieldsMetadata metadata, XDocReportRegistry registry) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Load the template report by using the given controller and cache it to the given registry
      Parameters:
      registry -
      Returns:
      an instance of the loaded template report.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException