Class ReportRenderer

java.lang.Object
com.isomorphic.rpc.ReportRenderer

public class ReportRenderer extends Object
Renders a deployed ReportBuilder report to files (PNG, Excel, PDF) on the server.

The server opens the report's page in headless Chrome and the page renders itself, so the files match what a person viewing the report as the same user would see, with the same declarative security and field masking. Requires the WebDriver support jar, a Chrome install, and reportRender.baseUrl in server.properties; see the "Report Delivery and Scheduling" overview in the Client Reference for all settings.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Thrown when a render could not start because the server was already running as many renders as reportRender.maxConcurrent allows, for longer than reportRender.maxWaitSeconds.
    static final class 
    One rendered file: its format (one of FORMATS), mimeType, a suggested fileName, and its bytes.
    static final class 
    The outcome of one render: files, the files produced by format, and problems, a readable reason for each requested format that could not be produced.
    static class 
    Thrown when this server cannot render reports at all (no headless Chrome support).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final List<String>
    Formats a report can be rendered to: png (a snapshot of the report), xlsx (the data behind each component, one sheet each) and pdf (the report's print layout).
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Whether this server can render reports: headless page capture is installed.
    render(String reportPath, List<String> formats, Map options)
    Render a deployed report.
  • Field Details

    • FORMATS

      public static final List<String> FORMATS
      Formats a report can be rendered to: png (a snapshot of the report), xlsx (the data behind each component, one sheet each) and pdf (the report's print layout).
  • Method Details

    • isAvailable

      public static boolean isAvailable()
      Whether this server can render reports: headless page capture is installed.
    • render

      public static ReportRenderer.Result render(String reportPath, List<String> formats, Map options) throws Exception
      Render a deployed report.

      The page is loaded from reportRender.baseUrl plus reportPath, which must be a report page (reportRender.reportPathPattern). With the runAs option the page is viewed as that user: the browser is logged in with a one-time token valid only for this page, and visits reportRender.logoutPath afterwards; the report page must be protected by SmartClient's AuthenticationFilter for the login to take effect. Without runAs the page is viewed with no logged-in user.

      Parameters:
      reportPath - path of the report page on this server (a schedule's deployedUrl)
      formats - any of FORMATS
      options - optional: viewportWidth and viewportHeight (pixels) for the browser window; runAs, the user name the page is viewed as
      Returns:
      the files produced, and the reason for any format that was not
      Throws:
      ReportRenderer.UnavailableException - when this server has no headless Chrome support
      ReportRenderer.BusyException - when the server is already running as many renders as reportRender.maxConcurrent allows and none finished within reportRender.maxWaitSeconds
      Exception - when the path is not a report page, or the render fails outright