private InputStream createReport() { OperationResult result = new OperationResult(OPERATION_DOWNLOAD_REPORT); ReportManager reportManager = getReportManager(); if (currentReport == null) { return null; } InputStream input = null; try { input = reportManager.getReportOutputData(currentReport.getOid(), result); } catch (Exception e) { error(getString("pageCreatedReports.message.downloadError") + " " + e.getMessage()); LoggingUtils.logException(LOGGER, "Couldn't download report.", e); LOGGER.trace(result.debugDump()); } finally { result.computeStatusIfUnknown(); } if (WebMiscUtil.showResultInPage(result)) { showResultInSession(result); } return input; }
public static InputStream createReport( ReportOutputType report, AjaxDownloadBehaviorFromStream ajaxDownloadBehaviorFromStream, PageBase pageBase) { OperationResult result = new OperationResult(OPERATION_DOWNLOAD_REPORT); ReportManager reportManager = pageBase.getReportManager(); if (report == null) { return null; } String contentType = reportExportTypeMap.get(report.getExportType()); if (StringUtils.isEmpty(contentType)) { contentType = "multipart/mixed; charset=UTF-8"; } ajaxDownloadBehaviorFromStream.setContentType(contentType); InputStream input = null; try { input = reportManager.getReportOutputData(report.getOid(), result); } catch (Exception e) { pageBase.error( pageBase.getString("pageCreatedReports.message.downloadError") + " " + e.getMessage()); LoggingUtils.logUnexpectedException(LOGGER, "Couldn't download report.", e); LOGGER.trace(result.debugDump()); } finally { result.computeStatusIfUnknown(); } if (WebComponentUtil.showResultInPage(result)) { pageBase.showResult(result); } return input; }