public class AdhocManager extends Object
AdhocManager class.
Provides methods for creatingJasperReportBuilder given an AdhocReportCustomizer and the AdhocReport itself.
JasperReportBuilder reportBuilder = AdhocManager.createReport(configuration.getReport(), new ReportCustomizer());
The JasperReportBuilder may also be created using the createReport(AdhocReport) without providing an an implementation for AdhocReportCustomizer relying on the DefaultAdhocReportCustomizer object instead.
AdhocManager also provides saveConfiguration(AdhocConfiguration, OutputStream) and the loadConfiguration(InputStream) methods for marshalling configuration and
unmarshalling configuration to and from the outputStream and inputStream respectively.| Modifier and Type | Method and Description |
|---|---|
JasperReportBuilder |
createReport(AdhocReport adhocReport)
createReport.
|
JasperReportBuilder |
createReport(AdhocReport adhocReport,
AdhocReportCustomizer adhocReportCustomizer)
createReport.
|
static AdhocManager |
getInstance(IAdhocToXmlTransform adhocToXmlTransform,
IXmlToAdhocTransform xmlToAdhocTransform) |
AdhocConfiguration |
loadConfiguration(InputStream is)
loadConfiguration.
|
void |
saveConfiguration(AdhocConfiguration adhocConfiguration,
OutputStream os)
saveConfiguration.
|
public static AdhocManager getInstance(IAdhocToXmlTransform adhocToXmlTransform, IXmlToAdhocTransform xmlToAdhocTransform)
public JasperReportBuilder createReport(AdhocReport adhocReport) throws DRException
createReport.
Creates a JasperReportBuilder which is subsequently set up with theJRDataSource and finaly used to create a report like shown here:
AdhocConfiguration configuration = new AdhocConfiguration();
AdhocReport report = new AdhocReport();
configuration.setReport(report);
// configure report...
JasperReportBuilder reportBuilder = AdhocManager.createReport(configuration.getReport());
reportBuilder.setDataSource(createDataSource());
reportBuilder.show();
The AdhocReportCustomizer is internally provided by invocation of the DefaultAdhocReportCustomizeradhocReport - a AdhocReport object.JasperReportBuilder object.DRException - if any.public JasperReportBuilder createReport(AdhocReport adhocReport, AdhocReportCustomizer adhocReportCustomizer) throws DRException
createReport.
Creates a JasperReportBuilder which is subsequently set up with theJRDataSource and finaly used to create a report like shown here:
AdhocConfiguration configuration = new AdhocConfiguration();
AdhocReport report = new AdhocReport();
configuration.setReport(report);
// configure report...
JasperReportBuilder reportBuilder = AdhocManager.createReport(configuration.getReport(), new ReportCustomizer());
reportBuilder.setDataSource(createDataSource());
reportBuilder.show();
adhocReport - a AdhocReport object.adhocReportCustomizer - a AdhocReportCustomizer object.JasperReportBuilder object.DRException - if any.public void saveConfiguration(AdhocConfiguration adhocConfiguration, OutputStream os) throws DRException
saveConfiguration.
This method enables a client to save configuration to an XML file. Consider the folowing example
AdhocReport report = new AdhocReport();
AdhocColumn column = new AdhocColumn();
column.setName("item");
report.addColumn(column);
column = new AdhocColumn();
column.setName("quantity");
report.addColumn(column);
AdhocConfiguration configuration = new AdhocConfiguration();
configuration.setReport(report);
// Now saving to an XML file in the system
AdhocManager.saveConfiguration(configuration, new FileOutputStream("c:/temp/configuration.xml"));
adhocConfiguration - a AdhocConfiguration object.os - a OutputStream object.DRException - if any.public AdhocConfiguration loadConfiguration(InputStream is) throws DRException
loadConfiguration.
This method enables a client to readAdhocConfiguration from an InputStream The method may be applied as shown:
AdhocConfiguration loadedConfiguration = AdhocManager.loadConfiguration(new FileInputStream("c:/temp/configuration.xml"));
is - a InputStream object.AdhocConfiguration object.DRException - if any.Copyright © 2010–2021. All rights reserved.