Java 类net.sf.jasperreports.engine.JRDataSourceProvider 实例源码

项目:spring4-understanding    文件:AbstractJasperReportsView.java   
/**
 * Create a report using the given provider.
 * @param provider the JRDataSourceProvider to use
 * @return the created report
 */
protected JRDataSource createReport(JRDataSourceProvider provider) {
    try {
        JasperReport report = getReport();
        if (report == null) {
            throw new IllegalStateException("No main report defined for JRDataSourceProvider - " +
                    "specify a 'url' on this view or override 'getReport()'");
        }
        return provider.create(report);
    }
    catch (JRException ex) {
        throw new IllegalArgumentException("Supplied JRDataSourceProvider is invalid", ex);
    }
}
项目:jasperreports    文件:DataSourceProviderDataAdapterService.java   
@Override
public void contributeParameters(Map<String, Object> parameters) throws JRException 
{
    JRDataSourceProvider dsProvider = getProvider();
    if (dsProvider != null) 
    {
        JasperReport jr = (JasperReport) parameters.get(JRParameter.JASPER_REPORT);
        parameters.put(JRParameter.REPORT_DATA_SOURCE, dsProvider.create(jr));
    }
}
项目:class-guard    文件:AbstractJasperReportsView.java   
/**
 * Create a report using the given provider.
 * @param provider the JRDataSourceProvider to use
 * @return the created report
 */
protected JRDataSource createReport(JRDataSourceProvider provider) {
    try {
        JasperReport report = getReport();
        if (report == null) {
            throw new IllegalStateException("No main report defined for JRDataSourceProvider - " +
                    "specify a 'url' on this view or override 'getReport()'");
        }
        return provider.create(report);
    }
    catch (JRException ex) {
        throw new IllegalArgumentException("Supplied JRDataSourceProvider is invalid", ex);
    }
}
项目:PDFReporter-Studio    文件:JRDSProviderFieldsProvider.java   
public void setProvider(JRDataSourceProvider jrdsp) {
    this.jrdsp = jrdsp;
}
项目:spring4-understanding    文件:AbstractJasperReportsView.java   
/**
 * Convert the given report data value to a {@code JRDataSource}.
 * <p>The default implementation delegates to {@code JasperReportUtils} unless
 * the report data value is an instance of {@code JRDataSourceProvider}.
 * A {@code JRDataSource}, {@code JRDataSourceProvider},
 * {@code java.util.Collection} or object array is detected.
 * {@code JRDataSource}s are returned as is, whilst {@code JRDataSourceProvider}s
 * are used to create an instance of {@code JRDataSource} which is then returned.
 * The latter two are converted to {@code JRBeanCollectionDataSource} or
 * {@code JRBeanArrayDataSource}, respectively.
 * @param value the report data value to convert
 * @return the JRDataSource
 * @throws IllegalArgumentException if the value could not be converted
 * @see org.springframework.ui.jasperreports.JasperReportsUtils#convertReportData
 * @see net.sf.jasperreports.engine.JRDataSource
 * @see net.sf.jasperreports.engine.JRDataSourceProvider
 * @see net.sf.jasperreports.engine.data.JRBeanCollectionDataSource
 * @see net.sf.jasperreports.engine.data.JRBeanArrayDataSource
 */
protected JRDataSource convertReportData(Object value) throws IllegalArgumentException {
    if (value instanceof JRDataSourceProvider) {
        return createReport((JRDataSourceProvider) value);
    }
    else {
        return JasperReportsUtils.convertReportData(value);
    }
}
项目:class-guard    文件:AbstractJasperReportsView.java   
/**
 * Convert the given report data value to a {@code JRDataSource}.
 * <p>The default implementation delegates to {@code JasperReportUtils} unless
 * the report data value is an instance of {@code JRDataSourceProvider}.
 * A {@code JRDataSource}, {@code JRDataSourceProvider},
 * {@code java.util.Collection} or object array is detected.
 * {@code JRDataSource}s are returned as is, whilst {@code JRDataSourceProvider}s
 * are used to create an instance of {@code JRDataSource} which is then returned.
 * The latter two are converted to {@code JRBeanCollectionDataSource} or
 * {@code JRBeanArrayDataSource}, respectively.
 * @param value the report data value to convert
 * @return the JRDataSource
 * @throws IllegalArgumentException if the value could not be converted
 * @see org.springframework.ui.jasperreports.JasperReportsUtils#convertReportData
 * @see net.sf.jasperreports.engine.JRDataSource
 * @see net.sf.jasperreports.engine.JRDataSourceProvider
 * @see net.sf.jasperreports.engine.data.JRBeanCollectionDataSource
 * @see net.sf.jasperreports.engine.data.JRBeanArrayDataSource
 */
protected JRDataSource convertReportData(Object value) throws IllegalArgumentException {
    if (value instanceof JRDataSourceProvider) {
        return createReport((JRDataSourceProvider) value);
    }
    else {
        return JasperReportsUtils.convertReportData(value);
    }
}