Class JFreeReportComponent

  • All Implemented Interfaces:
    Serializable, org.pentaho.platform.api.engine.IAuditable, org.pentaho.platform.api.engine.IComponent, org.pentaho.platform.api.engine.ILogger, org.pentaho.platform.api.engine.IParameterResolver
    Direct Known Subclasses:
    ReportWizardSpecComponent

    public class JFreeReportComponent
    extends AbstractJFreeReportComponent
    The JFreeReportComponent provides a simple-to-use frontend for the reporting process.

    This component will execute JFreeReport reports in one of two different modes:

    sqlMode = true

    This means that the JFreeReport component is expected to execute an SQL query, wrap the resulting SQL Resultset in a TableModel, and use that to execute a report whose definition is in the file system. In this mode, the action-sequence definition must contain the following elements: In the resource-definition section, there must be a resource called "report-definition" which defines the location of the jfreereport xml document.

    In the component-definition sction, there must be the following entries:

    • A "query" parameter which contains an SQL query.
    • Either for connecting to the SQL datasource:
      • A "jndi" parameter (with the jndi name of the datasource)
      • or The database parameters "driver", "user-id", "password" and "connection" so that a database connection can be established for running the afore-mentioned "query".

    sqlMode = false

    This means that the JFreeReport component is expected to execute a report that exists in a .jar file (like the reporting demo reports) along with the TableModel class that provides the data for the report. In this mode, the action-sequence definition must contain the following elements: In the resource-definition section, there must be a resource called "report-jar" that points to the .jar file that contains the report .xml file, and the TableModel implementation.

    In the component-definition section, there must be two entries:

    • "report-location" - This is the location of the report .xml document (e.g. org/jfree/report/demo/report1.xml)
    • "class-location" - This is the package-qualified class that implements TableModel (e.g. org.jfree.report.demo.SampleData1).
    Author:
    mbatchel
    See Also:
    Serialized Form
    • Field Detail

      • logger

        protected static final org.apache.commons.logging.Log logger
    • Constructor Detail

      • JFreeReportComponent

        public JFreeReportComponent()
    • Method Detail

      • init

        public boolean init()
        Specified by:
        init in interface org.pentaho.platform.api.engine.IComponent
        Specified by:
        init in class org.pentaho.platform.engine.services.solution.ComponentBase
      • done

        public void done()
        Specified by:
        done in interface org.pentaho.platform.api.engine.IComponent
        Specified by:
        done in class org.pentaho.platform.engine.services.solution.ComponentBase
      • validateSystemSettings

        public boolean validateSystemSettings()
        Specified by:
        validateSystemSettings in class org.pentaho.platform.engine.services.solution.ComponentBase
      • getLogger

        public org.apache.commons.logging.Log getLogger()
        Specified by:
        getLogger in class org.pentaho.platform.engine.core.system.PentahoBase
      • initAndValidate

        protected boolean initAndValidate​(org.pentaho.platform.api.engine.IComponent component)
      • validateAction

        public boolean validateAction()
        We cannot validate the parameters of all components, as the required parameters might not have been created.
        Specified by:
        validateAction in class org.pentaho.platform.engine.services.solution.ComponentBase
        Returns:
      • executeAction

        public boolean executeAction()
        This method gets called from the outside. Based upon our mode call the correct function.
        Specified by:
        executeAction in class org.pentaho.platform.engine.services.solution.ComponentBase
      • executeReportAction

        protected boolean executeReportAction()
      • getReport

        public org.pentaho.reporting.engine.classic.core.MasterReport getReport()
                                                                         throws Exception
        Throws:
        Exception
      • createReport

        protected org.pentaho.reporting.engine.classic.core.MasterReport createReport​(String reportDefinition)
                                                                               throws org.pentaho.reporting.libraries.resourceloader.ResourceException,
                                                                                      IOException
        Throws:
        org.pentaho.reporting.libraries.resourceloader.ResourceException
        IOException
      • getContentItem

        protected org.pentaho.platform.api.repository.IContentItem getContentItem​(String mimeType,
                                                                                  String extension)
      • writeHtml

        public boolean writeHtml​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                 OutputStream outputStream,
                                 int yieldRate,
                                 String htmlContentHandlerUrlPattern)
      • writeXls

        protected boolean writeXls​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                   OutputStream outputStream,
                                   int yieldRate)
      • writePdf

        protected boolean writePdf​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                   OutputStream outputStream,
                                   int yieldRate)
      • print

        public boolean print​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                             String jobName,
                             String printerName)
      • writeCsv

        protected boolean writeCsv​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                   OutputStream outputStream,
                                   int yieldRate)
      • writeRtf

        protected boolean writeRtf​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                   OutputStream outputStream,
                                   int yieldRate)
      • writeXml

        protected boolean writeXml​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                   OutputStream outputStream)
      • writeSwingPreview

        protected boolean writeSwingPreview​(org.pentaho.reporting.engine.classic.core.MasterReport report)