protected void generateReport(Report report, ReportTemplate reportTemplate, ReportOutputType outputType, OutputStream outputStream, Map<String, Object> handledParams, BandData rootBand) { String extension = StringUtils.substringAfterLast(reportTemplate.getDocumentName(), "."); if (reportTemplate.isCustom()) { try { byte[] bytes = reportTemplate.getCustomReport().createReport(report, rootBand, handledParams); IOUtils.write(bytes, outputStream); } catch (IOException e) { throw new ReportingException(format("An error occurred while processing custom template [%s].", reportTemplate.getDocumentName()), e); } } else { FormatterFactoryInput factoryInput = new FormatterFactoryInput(extension, rootBand, reportTemplate, outputType, outputStream); ReportFormatter formatter = formatterFactory.createFormatter(factoryInput); formatter.renderDocument(); } }
protected void generateReport(Report report, ReportTemplate reportTemplate, ReportOutputType outputType, OutputStream outputStream, Map<String, Object> handledParams, BandData rootBand) { String extension = StringUtils.substringAfterLast(reportTemplate.getDocumentName(), "."); if (reportTemplate.isCustom()) { try { byte[] bytes = reportTemplate.getCustomReport().createReport(report, rootBand, handledParams); IOUtils.write(bytes, outputStream); } catch (IOException e) { throw new ReportingException(format("An error occurred while processing custom template [%s].", reportTemplate.getDocumentName()), e); } } else { FormatterFactoryInput factoryInput = new FormatterFactoryInput(extension, rootBand, reportTemplate, outputType, outputStream); ReportFormatter formatter = formatterFactory.createFormatter(factoryInput); formatter.renderDocument(); } }