public abstract class JasperReportsUtils
extends java.lang.Object
This class is compatible with classic JasperReports releases back until 2.x.
As a consequence, it keeps using the JRExporter
API which has been deprecated in early 2014.
Constructor and Description |
---|
JasperReportsUtils() |
Modifier and Type | Method and Description |
---|---|
static net.sf.jasperreports.engine.JRDataSource |
convertReportData(java.lang.Object value)
Convert the given report data value to a
JRDataSource . |
static void |
render(net.sf.jasperreports.engine.JRExporter exporter,
net.sf.jasperreports.engine.JasperPrint print,
java.io.OutputStream outputStream)
Render the supplied
JasperPrint instance using the
supplied JRAbstractExporter instance and write the results
to the supplied OutputStream . |
static void |
render(net.sf.jasperreports.engine.JRExporter exporter,
net.sf.jasperreports.engine.JasperPrint print,
java.io.Writer writer)
Render the supplied
JasperPrint instance using the
supplied JRAbstractExporter instance and write the results
to the supplied Writer . |
static void |
renderAsCsv(net.sf.jasperreports.engine.JasperReport report,
java.util.Map<java.lang.String,java.lang.Object> parameters,
java.lang.Object reportData,
java.io.Writer writer)
Render a report in CSV format using the supplied report data.
|
static void |
renderAsCsv(net.sf.jasperreports.engine.JasperReport report,
java.util.Map<java.lang.String,java.lang.Object> parameters,
java.lang.Object reportData,
java.io.Writer writer,
java.util.Map<net.sf.jasperreports.engine.JRExporterParameter,java.lang.Object> exporterParameters)
Render a report in CSV format using the supplied report data.
|
static void |
renderAsHtml(net.sf.jasperreports.engine.JasperReport report,
java.util.Map<java.lang.String,java.lang.Object> parameters,
java.lang.Object reportData,
java.io.Writer writer)
Render a report in HTML format using the supplied report data.
|
static void |
renderAsHtml(net.sf.jasperreports.engine.JasperReport report,
java.util.Map<java.lang.String,java.lang.Object> parameters,
java.lang.Object reportData,
java.io.Writer writer,
java.util.Map<net.sf.jasperreports.engine.JRExporterParameter,java.lang.Object> exporterParameters)
Render a report in HTML format using the supplied report data.
|
static void |
renderAsPdf(net.sf.jasperreports.engine.JasperReport report,
java.util.Map<java.lang.String,java.lang.Object> parameters,
java.lang.Object reportData,
java.io.OutputStream stream)
Render a report in PDF format using the supplied report data.
|
static void |
renderAsPdf(net.sf.jasperreports.engine.JasperReport report,
java.util.Map<java.lang.String,java.lang.Object> parameters,
java.lang.Object reportData,
java.io.OutputStream stream,
java.util.Map<net.sf.jasperreports.engine.JRExporterParameter,java.lang.Object> exporterParameters)
Render a report in PDF format using the supplied report data.
|
static void |
renderAsXls(net.sf.jasperreports.engine.JasperReport report,
java.util.Map<java.lang.String,java.lang.Object> parameters,
java.lang.Object reportData,
java.io.OutputStream stream)
Render a report in XLS format using the supplied report data.
|
static void |
renderAsXls(net.sf.jasperreports.engine.JasperReport report,
java.util.Map<java.lang.String,java.lang.Object> parameters,
java.lang.Object reportData,
java.io.OutputStream stream,
java.util.Map<net.sf.jasperreports.engine.JRExporterParameter,java.lang.Object> exporterParameters)
Render a report in XLS format using the supplied report data.
|
public static net.sf.jasperreports.engine.JRDataSource convertReportData(java.lang.Object value) throws java.lang.IllegalArgumentException
JRDataSource
.
In the default implementation, a JRDataSource
,
java.util.Collection
or object array is detected.
The latter are converted to JRBeanCollectionDataSource
or JRBeanArrayDataSource
, respectively.
value
- the report data value to convertnull
)java.lang.IllegalArgumentException
- if the value could not be convertedJRDataSource
,
JRBeanCollectionDataSource
,
JRBeanArrayDataSource
public static void render(net.sf.jasperreports.engine.JRExporter exporter, net.sf.jasperreports.engine.JasperPrint print, java.io.Writer writer) throws net.sf.jasperreports.engine.JRException
JasperPrint
instance using the
supplied JRAbstractExporter
instance and write the results
to the supplied Writer
.
Make sure that the JRAbstractExporter
implementation
you supply is capable of writing to a Writer
.
exporter
- the JRAbstractExporter
to use to render the reportprint
- the JasperPrint
instance to renderwriter
- the Writer
to write the result tonet.sf.jasperreports.engine.JRException
- if rendering failedpublic static void render(net.sf.jasperreports.engine.JRExporter exporter, net.sf.jasperreports.engine.JasperPrint print, java.io.OutputStream outputStream) throws net.sf.jasperreports.engine.JRException
JasperPrint
instance using the
supplied JRAbstractExporter
instance and write the results
to the supplied OutputStream
.
Make sure that the JRAbstractExporter
implementation you
supply is capable of writing to a OutputStream
.
exporter
- the JRAbstractExporter
to use to render the reportprint
- the JasperPrint
instance to renderoutputStream
- the OutputStream
to write the result tonet.sf.jasperreports.engine.JRException
- if rendering failedpublic static void renderAsCsv(net.sf.jasperreports.engine.JasperReport report, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Object reportData, java.io.Writer writer) throws net.sf.jasperreports.engine.JRException
Writer
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingwriter
- the Writer
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromnet.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsCsv(net.sf.jasperreports.engine.JasperReport report, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Object reportData, java.io.Writer writer, java.util.Map<net.sf.jasperreports.engine.JRExporterParameter,java.lang.Object> exporterParameters) throws net.sf.jasperreports.engine.JRException
Writer
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingwriter
- the Writer
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromexporterParameters
- a Map
of JRExporterParameter exporter parameters
net.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsHtml(net.sf.jasperreports.engine.JasperReport report, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Object reportData, java.io.Writer writer) throws net.sf.jasperreports.engine.JRException
Writer
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingwriter
- the Writer
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromnet.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsHtml(net.sf.jasperreports.engine.JasperReport report, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Object reportData, java.io.Writer writer, java.util.Map<net.sf.jasperreports.engine.JRExporterParameter,java.lang.Object> exporterParameters) throws net.sf.jasperreports.engine.JRException
Writer
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingwriter
- the Writer
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromexporterParameters
- a Map
of JRExporterParameter exporter parameters
net.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsPdf(net.sf.jasperreports.engine.JasperReport report, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Object reportData, java.io.OutputStream stream) throws net.sf.jasperreports.engine.JRException
OutputStream
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingstream
- the OutputStream
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromnet.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsPdf(net.sf.jasperreports.engine.JasperReport report, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Object reportData, java.io.OutputStream stream, java.util.Map<net.sf.jasperreports.engine.JRExporterParameter,java.lang.Object> exporterParameters) throws net.sf.jasperreports.engine.JRException
OutputStream
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingstream
- the OutputStream
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromexporterParameters
- a Map
of JRExporterParameter exporter parameters
net.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsXls(net.sf.jasperreports.engine.JasperReport report, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Object reportData, java.io.OutputStream stream) throws net.sf.jasperreports.engine.JRException
OutputStream
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingstream
- the OutputStream
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromnet.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)
public static void renderAsXls(net.sf.jasperreports.engine.JasperReport report, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Object reportData, java.io.OutputStream stream, java.util.Map<net.sf.jasperreports.engine.JRExporterParameter,java.lang.Object> exporterParameters) throws net.sf.jasperreports.engine.JRException
OutputStream
.report
- the JasperReport
instance to renderparameters
- the parameters to use for renderingstream
- the OutputStream
to write the rendered report toreportData
- a JRDataSource
, java.util.Collection
or object array
(converted accordingly), representing the report data to read fields fromexporterParameters
- a Map
of JRExporterParameter exporter parameters
net.sf.jasperreports.engine.JRException
- if rendering failedconvertReportData(java.lang.Object)