Java Code Examples for net.sf.jasperreports.engine.JasperReport#getDatasets()
The following examples show how to use
net.sf.jasperreports.engine.JasperReport#getDatasets() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRReportUtils.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
public static JRDataset findSubdataset(JRDatasetRun datasetRun, JasperReport report) { JRDataset[] datasets = report.getDatasets(); JRDataset reportDataset = null; if (datasets != null) { for (int i = 0; i < datasets.length; i++) { if (datasetRun.getDatasetName().equals( datasets[i].getName())) { reportDataset = datasets[i]; break; } } } if (reportDataset == null) { throw new JRRuntimeException( EXCEPTION_MESSAGE_KEY_REPORT_SUBDATASET_NOT_FOUND, new Object[]{datasetRun.getDatasetName(), report.getName()}); } return reportDataset; }
Example 2
Source File: FillTable.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected JRReportCompileData createTableReportCompileData( JasperReport parentReport, JRDataset reportSubdataset) throws JRException { Serializable reportCompileDataObj = parentReport.getCompileData(); if (!(reportCompileDataObj instanceof JRReportCompileData)) { throw new JRRuntimeException( EXCEPTION_MESSAGE_KEY_UNSUPPORTED_REPORT_DATA_TYPE, new Object[]{reportCompileDataObj.getClass().getName()} ); } JRReportCompileData reportCompileData = (JRReportCompileData) reportCompileDataObj; Serializable datasetCompileData = reportCompileData.getDatasetCompileData( reportSubdataset); TableReportCompileData tableReportCompileData = new TableReportCompileData( parentReport); tableReportCompileData.setMainDatasetCompileData(datasetCompileData); JRDataset[] datasets = parentReport.getDatasets(); if (datasets != null) { for (JRDataset dataset : datasets) { Serializable compileData = reportCompileData.getDatasetCompileData(dataset); tableReportCompileData.setDatasetCompileData(dataset, compileData); } } tableReportCompileData.copyCrosstabCompileData(reportCompileData); return tableReportCompileData; }