public final class ResultSetTableModelFactory extends Object
TableModel
which is backed up by a ResultSet
. If the ResultSet
is
scrollable, a ScrollableResultSetTableModel
is created, otherwise all data is copied from the
ResultSet
into a DefaultTableModel
.
The creation of a DefaultTableModel
can be forced if the system property
"org.pentaho.reporting.engine.classic.core.modules.misc.tablemodel.TableFactoryMode"
is set to
"simple"
.Modifier and Type | Field and Description |
---|---|
static String |
COLUMN_NAME_MAPPING_KEY
The configuration key defining how to map column names to column indices.
|
static String |
RESULTSET_FACTORY_MODE
The 'ResultSet factory mode'.
|
Modifier and Type | Method and Description |
---|---|
static AttributeMap<Object> |
collectData(ResultSetMetaData rsmd,
int column,
String name) |
CloseableTableModel |
createTableModel(ResultSet rs,
boolean columnNameMapping,
boolean closeStatement)
Creates a table model by using the given
ResultSet as the backend. |
CloseableTableModel |
generateDefaultTableModel(ResultSet rs,
boolean columnNameMapping)
Generates a
TableModel that gets its contents filled from a ResultSet . |
static ResultSetTableModelFactory |
getInstance()
Returns the singleton instance of the factory.
|
static ImmutableDataAttributes[] |
map(AttributeMap[] data) |
protected Object[][] |
produceData(ResultSet rs,
int colcount) |
static void |
updateMetaData(ResultSetMetaData rsmd,
DefaultTableMetaData metaData,
int column)
Deprecated.
|
public static final String COLUMN_NAME_MAPPING_KEY
public static final String RESULTSET_FACTORY_MODE
public CloseableTableModel createTableModel(ResultSet rs, boolean columnNameMapping, boolean closeStatement) throws SQLException
ResultSet
as the backend. If the ResultSet
is
scrollable (the type is not TYPE_FORWARD_ONLY
), an instance of ScrollableResultSetTableModel
is returned.
This model uses the extended capabilities of scrollable result sets to directly read data from the database without
caching or the need of copying the complete ResultSet
into the programs memory.
If the ResultSet
lacks the scrollable features, the data will be copied into a
DefaultTableModel
and the ResultSet
gets closed.rs
- the result set.columnNameMapping
- defines, whether to use column names or column labels to compute the column index. If
true, then we map the Name. If false, then we map the LabelcloseStatement
- a flag indicating whether closing the resultset should also close the statement.SQLException
- if there is a problem with the result set.public CloseableTableModel generateDefaultTableModel(ResultSet rs, boolean columnNameMapping) throws SQLException
TableModel
that gets its contents filled from a ResultSet
. The column names
of the ResultSet
will form the column names of the table model.
Hint: To customize the names of the columns, use the SQL column aliasing (done with SELECT nativecolumnname
AS "JavaColumnName" FROM ....
rs
- the result set.columnNameMapping
- defines, whether to use column names or column labels to compute the column index. If
true, then we map the Name. If false, then we map the LabelSQLException
- if there is a problem with the result set.public static ImmutableDataAttributes[] map(AttributeMap[] data)
protected Object[][] produceData(ResultSet rs, int colcount) throws SQLException
SQLException
public static AttributeMap<Object> collectData(ResultSetMetaData rsmd, int column, String name) throws SQLException
SQLException
@Deprecated public static void updateMetaData(ResultSetMetaData rsmd, DefaultTableMetaData metaData, int column)
rsmd
- metaData
- column
- public static ResultSetTableModelFactory getInstance()
Copyright © 2017 Hitachi Vantara. All rights reserved.