Package com.inet.report.database
Interface DataFactory
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
BaseDataFactory
,Database
,JdbcData
This interface is a layer between a your DBMS or any other data source and i-net Clear Reports. It compensates the differences
between the different DBMS.
- Since:
- 13.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
fetchData
(@Nonnull Engine engine, @Nonnull FetchTables fetchTables, @Nonnull DataCollector collector) Fetches the part of the report data for which this data factory is responsible.@Nonnull List<ColumnInfo>
getColumns
(@Nonnull TableSource ts) Returns the column information for a TableSource.com.inet.report.DatabaseConfiguration
Returns the DatabaseConfiguration of this DataFactory.boolean
Override this method only if you use subreport(s) and you set the data for the report with the getReportData orfetchData(Engine, FetchTables, DataCollector)
method.default com.inet.report.database.sql.SqlSyntax
Returns the SQL and command syntax definition instance for this data factory.@Nonnull TableData
getTableSourceData
(@Nonnull TableSource ts) Is called from getReportData to request the data of a single TableSource if the TableSource is not a joined table or view.@Nonnull Map<String,
TableSourceInfo> getTableSourceInfos
(@Nonnull Datasource ds, String catalog) Returns a map of objects in the database which can return table data.default @Nonnull String
Get the version of the factory for the UI.void
setConfiguration
(@Nonnull com.inet.report.DatabaseConfiguration configuration) Sets the DatabaseConfiguration for this DataFactory. this is calling from the runtime after creating.default boolean
If this data factory supports a TableSource of type command.
-
Method Details
-
getReportDataPerInstance
boolean getReportDataPerInstance()Override this method only if you use subreport(s) and you set the data for the report with the getReportData orfetchData(Engine, FetchTables, DataCollector)
method. For more information please refer to the sample Main_and_Subreport_Data_WithExternalResultSet.java.
With this method you can specify whether the engine should call getReportData per subreport instance or only once for each of the subreports in the executed report. The same subreport can execute multiple time in a report with different parameters depending on its location. A subreport instance means one execution of one subreport. The method should return true if you want to set the different report data depending on the state of the report or if you want to set data depending on one or more parameter values. If you want to set data only once per sub-report, this function must return false. For example if you have a sub-report taking one prompt p0, and getReportDataPerInstance() returns true, then your sub-report will be called $n$ times whenever the value for p0 has been changed. So if your report has sub-reports and your sub-report prompts are linked with fields of the main report and you want to set the data whenever the sub-report prompts change, let getReportDataPerInstance() return true.- Returns:
- true if the engine should invoke getReportData for every subreport instance or false otherwise.
- Since:
- 13.0
-
getTableSourceData
@Nonnull @Nonnull TableData getTableSourceData(@Nonnull @Nonnull TableSource ts) throws ReportException Is called from getReportData to request the data of a single TableSource if the TableSource is not a joined table or view. So it's called for procedures, commands and single tables or views.If you have define a column of type DatabaseMetaData.procedureColumnIn then you can get the current value with:
Object value = ts.getInputParameters().get(x).getValue();
- Parameters:
ts
- The current table source- Returns:
- The resulting data, never null.
- Throws:
ReportException
- if error occurs in the API access- Since:
- 13.0
-
getTableSourceInfos
@Nonnull @Nonnull Map<String,TableSourceInfo> getTableSourceInfos(@Nonnull @Nonnull Datasource ds, String catalog) throws ReportException Returns a map of objects in the database which can return table data. It can contain tables, views, stored procedures or your own objects. Keys of the returned map are table names and values are objects of typeTableSourceInfo
.If you want return parameter columns with type
DatabaseMetaData.procedureColumnIn
thengetReportDataPerInstance()
must return true and theTableSourceInfo
must of typeTableSourceInfo.TYPE_SPROC
.- Parameters:
ds
- datasource which describes the datacatalog
- an optional catalog- Returns:
- a map of available objects, never null
- Throws:
ReportException
- if any error occurs- Since:
- 13.0
-
getColumns
@Nonnull @Nonnull List<ColumnInfo> getColumns(@Nonnull @Nonnull TableSource ts) throws ReportException Returns the column information for a TableSource.If you want return parameter columns with type
DatabaseMetaData.procedureColumnIn
thengetReportDataPerInstance()
must return true and theTableSourceInfo
must of typeTableSourceInfo.TYPE_SPROC
.- Parameters:
ts
- the table source to get the data for- Returns:
- A list with column information, can be empty but not null
- Throws:
ReportException
- if any error occurs- Since:
- 15.0
-
setConfiguration
void setConfiguration(@Nonnull @Nonnull com.inet.report.DatabaseConfiguration configuration) Sets the DatabaseConfiguration for this DataFactory. this is calling from the runtime after creating.- Parameters:
configuration
- the current configuration- Since:
- 13.0
-
getConfiguration
com.inet.report.DatabaseConfiguration getConfiguration()Returns the DatabaseConfiguration of this DataFactory.- Returns:
- the DatabaseConfiguration
- Since:
- 13.0
-
fetchData
void fetchData(@Nonnull @Nonnull Engine engine, @Nonnull @Nonnull FetchTables fetchTables, @Nonnull @Nonnull DataCollector collector) throws ReportException Fetches the part of the report data for which this data factory is responsible. A description about what tables are required to fetch is given in the specifiedFetchTables
instance. The resulting fetched data is put to the specifiedDataCollector
during execution of this method.An example implementation for this method:
for( TableSource tableSource : fetchDef.getTableSources() ) { TableData tableData; // retrieve data for table source "tableSource" tableData = [...] // deliver the data to the collector: collector.addUnjoinedData( tableSource, tableData ); }
- Parameters:
engine
- the engine of the report to renderfetchTables
- a model of joining table describing the data this data factory needs to delivercollector
- the collector which receives any resulting data- Throws:
ReportException
- on failures during data fetching- Since:
- 15.0
-
getVersion
Get the version of the factory for the UI. Only used for non JDBC data factories.- Returns:
- the version or empty string
- Since:
- 21.4
-
supportsCommands
default boolean supportsCommands()If this data factory supports a TableSource of type command. If true the designer show the menu item for adding commands. The default value is false. For JDBC data factories this flag is true.- Returns:
- the flag value
- Since:
- 21.4
-
getSqlSyntax
default com.inet.report.database.sql.SqlSyntax getSqlSyntax()Returns the SQL and command syntax definition instance for this data factory. It is also used for non SQL factories if it support commands to patch the prompts.- Returns:
- the syntax definition
- Since:
- 21.4
-