OutputStream out = null;
try
{
out = new BufferedOutputStream(new FileOutputStream(targetFile));
final ZipRepository zipRepository = new ZipRepository(out);
final ContentLocation root = zipRepository.getRoot();
final ContentLocation data = RepositoryUtilities.createLocation
(zipRepository, RepositoryUtilities.splitPath(dataDirectory, "/")); //$NON-NLS-1$
final ReportProcessor sp;
if ("pageable".equals(exportMethod))//$NON-NLS-1$
{
final PageableHtmlOutputProcessor outputProcessor = new PageableHtmlOutputProcessor(report.getConfiguration());
final HtmlPrinter printer = new AllItemsHtmlPrinter(report.getResourceManager());
printer.setContentWriter(root, new DefaultNameGenerator(root, "report.html")); //$NON-NLS-1$
printer.setDataWriter(data, new DefaultNameGenerator(data, "content")); //$NON-NLS-1$
printer.setUrlRewriter(new SingleRepositoryURLRewriter());
outputProcessor.setPrinter(printer);
sp = new PageableReportProcessor(report, outputProcessor);
}
else
{
final HtmlOutputProcessor outputProcessor = createOutputProcessor();
final HtmlPrinter printer = new AllItemsHtmlPrinter(report.getResourceManager());
printer.setContentWriter(root, new DefaultNameGenerator(root, "report.html")); //$NON-NLS-1$
printer.setDataWriter(data, new DefaultNameGenerator(data, "content")); //$NON-NLS-1$
printer.setUrlRewriter(new SingleRepositoryURLRewriter());
outputProcessor.setPrinter(printer);
sp = new FlowReportProcessor(report, outputProcessor);
}
if (progressDialog != null)
{
progressDialog.setModal(false);
progressDialog.setVisible(true);
sp.addReportProgressListener(progressDialog);
}
sp.processReport();
sp.close();
zipRepository.close();
out.close();
out = null;
if (progressDialog != null)
{