class QueryJasperDataSource extends java.lang.Object implements JasperDataSource
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<java.lang.String,BufferField> |
fieldMapping
Map of Jasper report field names to 4GL fields.
|
private boolean |
iterated
true if the query was already iterated by this data source and we already got
the first record in the result set. |
private QueryWrapper |
query
Query for getting report data.
|
Constructor and Description |
---|
QueryJasperDataSource(QueryWrapper query)
Create data source which gets the report data from the specified query.
|
Modifier and Type | Method and Description |
---|---|
handle |
asProgressObject()
Get underlying 4GL query object which provides data for the report.
|
private boolean |
buildFieldMapping(net.sf.jasperreports.engine.JasperReport report)
Build and store field mapping (Jasper report field names to 4GL fields) for the given
report.
|
java.lang.Object |
getFieldValue(net.sf.jasperreports.engine.JRField field)
Gets the field value for the current position.
|
private BufferField |
getMatchingBufferField(net.sf.jasperreports.engine.JRField reportField)
Get the 4GL buffer field matching the given Jasper report field.
|
net.sf.jasperreports.engine.JasperReport |
getReport(java.lang.String designFileName)
Get compiled Jasper report for the given report design file.
|
boolean |
next()
Tries to position the cursor on the next element in the data source.
|
void |
reportFinished(boolean error)
Executed after report was filled from the data source.
|
boolean |
reportStarted(net.sf.jasperreports.engine.JasperReport report)
Executed before report is filled from the data source.
|
private final QueryWrapper query
private java.util.HashMap<java.lang.String,BufferField> fieldMapping
private boolean iterated
true
if the query was already iterated by this data source and we already got
the first record in the result set.QueryJasperDataSource(QueryWrapper query)
query
- Query for getting report data.public boolean next() throws net.sf.jasperreports.engine.JRException
next
in interface net.sf.jasperreports.engine.JRDataSource
true
if there is a next record, false
otherwise.net.sf.jasperreports.engine.JRException
- if any error occurs while trying to move to the next element.public java.lang.Object getFieldValue(net.sf.jasperreports.engine.JRField field) throws net.sf.jasperreports.engine.JRException
getFieldValue
in interface net.sf.jasperreports.engine.JRDataSource
field
- Field to get.net.sf.jasperreports.engine.JRException
- if any error occurs while trying to get the field value.public net.sf.jasperreports.engine.JasperReport getReport(java.lang.String designFileName)
getReport
in interface JasperDataSource
designFileName
- File name of the Jasper report design file.public boolean reportStarted(net.sf.jasperreports.engine.JasperReport report)
reportStarted
in interface JasperDataSource
report
- Jasper report to be filled.true
on success, false
if the data source cannot provide
data.public void reportFinished(boolean error)
reportFinished
in interface JasperDataSource
error
- true
if there were problems while getting data from the data source.
false
on success,public handle asProgressObject()
asProgressObject
in interface JasperDataSource
private boolean buildFieldMapping(net.sf.jasperreports.engine.JasperReport report)
report
- Jasper report for which we need to build a field mapping.true
on success.private BufferField getMatchingBufferField(net.sf.jasperreports.engine.JRField reportField)
reportField
- Jasper report field.null
if there is no matching field.