Class Sample1
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.samples.AbstractReportGenerator
-
- org.pentaho.reporting.engine.classic.samples.Sample1
-
public class Sample1 extends AbstractReportGenerator
Generates a report in the following scenario:- The report definition file is a .prpt file which will be loaded and parsed
- The data factory is a simple JDBC data factory using HSQLDB
- There are no runtime report parameters used
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.pentaho.reporting.engine.classic.samples.AbstractReportGenerator
AbstractReportGenerator.OutputType
-
-
Constructor Summary
Constructors Constructor Description Sample1()
Default constructor for this sample report generator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.pentaho.reporting.engine.classic.core.DataFactory
getDataFactory()
Returns the data factory which will be used to generate the data used during report generation.org.pentaho.reporting.engine.classic.core.MasterReport
getReportDefinition()
Returns the report definition which will be used to generate the report.Map<String,Object>
getReportParameters()
Returns the set of runtime report parameters.static void
main(String[] args)
Simple command line application that will generate a PDF version of the report.-
Methods inherited from class org.pentaho.reporting.engine.classic.samples.AbstractReportGenerator
generateReport, generateReport
-
-
-
-
Method Detail
-
getReportDefinition
public org.pentaho.reporting.engine.classic.core.MasterReport getReportDefinition()
Returns the report definition which will be used to generate the report. In this case, the report will be loaded and parsed from a file contained in this package.- Specified by:
getReportDefinition
in classAbstractReportGenerator
- Returns:
- the loaded and parsed report definition to be used in report generation.
-
getDataFactory
public org.pentaho.reporting.engine.classic.core.DataFactory getDataFactory()
Returns the data factory which will be used to generate the data used during report generation. In this example, we will return null since the data factory has been defined in the report definition.- Specified by:
getDataFactory
in classAbstractReportGenerator
- Returns:
- the data factory used with the report generator
-
getReportParameters
public Map<String,Object> getReportParameters()
Returns the set of runtime report parameters. This sample report uses the following three parameters:- Report Title - The title text on the top of the report
- Customer Names - an array of customer names to show in the report
- Col Headers BG Color - the background color for the column headers
- Specified by:
getReportParameters
in classAbstractReportGenerator
- Returns:
null
indicating the report generator does not use any report parameters
-
main
public static void main(String[] args) throws IOException, org.pentaho.reporting.engine.classic.core.ReportProcessingException
Simple command line application that will generate a PDF version of the report. In this report, the report definition has already been created with the Hitachi Vantara Report Designer application and it located in the same package as this class. The data query is located in that report definition as well, and there are a few report-modifying parameters that will be passed to the engine at runtime. The output of this report will be a PDF file located in the current directory and will be namedSimpleReportGeneratorExample.pdf
.- Parameters:
args
- none- Throws:
IOException
- indicates an error writing to the filesystemorg.pentaho.reporting.engine.classic.core.ReportProcessingException
- indicates an error generating the report
-
-