Data Processing and Functions
Introduction to the
...
Functions and Expressions
Named functions and scopes
Preserving function values
Precomputed results
Style, Attribute and Anonymous-Expressions
Inline-Computations: Formulas
ReportData and ReportDataFactories
...
Data-Layer
JFreeReport strictly separates the data processing from the layout processing.
The Data-Layer provides a unified interface to the various data-sources and encapsulates all implementation specific details. In JFreeReport, there are three general classes of data-sources: (1) Tables provide JFreeReport with mass-data. Table-data is usually read from a database or similar data storage. (2) Parameters allow to feed single data values from the outside. (3) Functions and Expressions as third data-source compute values using other data-sources as input.
Report-Data and DataFactories
The report processing always starts with a (possibly empty) set of parameters and a query name. The parameters correspond to the report properties of the old reporting engine. Each parameter automaticly appears as static column in the data row. Sub-Reports have no explicit parameter set, they receive their parameters from the current data row context. Every report and subreport has a query name. The name, along with the current values from the data row, is used by the ReportDataFactory to query the underlying datasource and to return a valid ReportData object.
A report data object represents a data table with an assigned cursor. JFreeReport guarantees, that report-data objects are interated using the 'advance' operation. The cursor movement is used to previously read data-rows. The cursor will never be positioned after the last row read with 'advance'.
The format and contents of the 'query'-string is not defined and depends on the actual DataFactory implementation. It can be anything, from valid SQL to an handle to an arbitary complex operation.
SQL-Data-Factories
The SQL-DataFactories allow JFreeReport to query JDBC-DataSources. By default, the query-string is an alias for the real SQL-Query-string.
SQLDataFactories can be defined in XML and can be referenced directly from the report definition.
The queries can be parametrized. The engine will translate named parameters into positional parameters. The actual query is always done using PreparedStatements, JDBC-Drivers which do not support prepared statements cannot be used with this implementation.