JasperReports provides default implementations of result set, bean collections and bean arrays data sources. @author Teodor Danciu (teodord@users.sourceforge.net) @version $Id: JRDataSource.java 3033 2009-08-27 11:46:22Z teodord $
96979899100101102103
AbstractTablesSelector<?> selector = createTableSelector(table, lpu, range, i); Collection<Map<String, Object>> newData = selector.getDataList(year); mainData.addAll(newData); } JRDataSource mainDataSourse = new JRMapCollectionDataSource(mainData); return mainDataSourse; }
114115116117118119120121122123124
parameters.put("form_order_date", entity.getResolutionDateNumber()); parameters.put("target_department_list", entity.getTargetDeaprtaments()); parameters.put("target_times", entity.getTargetDates()); parameters.put("year_as_num", year); JRDataSource mainDataSourse = getMainDataSourse(year); parameters.put(JRParameter.REPORT_DATA_SOURCE, mainDataSourse); return buildReport(parameters); } catch (RuntimeException ex){
231232233234235236237238
public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, JRDataSource ds) throws JRException { return generateJasperPrint(dr, layoutManager, ds, new HashMap()); } public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, Collection collection) throws JRException { JRDataSource ds = new JRBeanCollectionDataSource(collection); return generateJasperPrint(dr, layoutManager, ds, new HashMap()); }
236237238239240241242243
JRDataSource ds = new JRBeanCollectionDataSource(collection); return generateJasperPrint(dr, layoutManager, ds, new HashMap()); } public static JasperPrint generateJasperPrint(DynamicReport dr, LayoutManager layoutManager, ResultSet resultSet) throws JRException { JRDataSource ds = new JRResultSetDataSource(resultSet); return generateJasperPrint(dr, layoutManager, ds, new HashMap()); }
505152535455565758
/** * Produces the main test datasource, which will be displayed in the details * band of the report */ public JRDataSource buildDefaultTestReport(Map<String, Object> reportParameters) { JRDataSource defaultDataSource = new JRBeanCollectionDataSource(reportDataContainer.getTestResults()); fillMainReportDataParameters(reportParameters, reportDataContainer.getClassName(), reportDataContainer.getMethodTestResults()); return defaultDataSource; }
6061626364656667
/** * Produces the method duration datasource, which will be displayed in the details band of the report * @param reportParameters */ public JRDataSource buildTestMethodDurationReport(Map<String, Object> reportParameters) { JRDataSource methodDurationDataSource = fillMethodDurationReportDataParametersAndGetDataSource(reportParameters, reportDataContainer.getClassName(), reportDataContainer.getMethodTestResults()); return methodDurationDataSource; }
110111112113114115116117118
methodDurationReportBeans.add(methodDurationBean); } reportParameters.put(CLASS_NAME, className); JRDataSource methodDurationDataSource = new JRBeanCollectionDataSource(methodDurationReportBeans); return methodDurationDataSource; }
5354555657585960616263
* Prepares the report and calls the print method */ public Boolean call() throws Exception { Map<String, Object> reportParameters = new HashMap<String, Object>(); JRDataSource reportDataSource; Boolean returnValue = true; for (REPORT_TYPE type: types) { if (returnValue == false) {