public String execute() { // remove results of any previous query report from session ActionContext.getContext().getSession().remove(ORStatics.QUERY_REPORT_RESULTS); ActionContext.getContext().getSession().remove(ORStatics.QUERY_REPORT_PROPERTIES); ReportUser user = (ReportUser) ActionContext.getContext().getSession().get(ORStatics.REPORT_USER); report = (Report) ActionContext.getContext().getSession().get(ORStatics.REPORT); Map<String, Object> reportParameters = getReportParameterMap(user); ReportLog reportLog = new ReportLog(user, report, new Date()); try { log.debug("Starting Query Report: " + report.getName()); log.debug("Query: " + report.getQuery()); reportLogProvider.insertReportLog(reportLog); ReportEngineInput input = new ReportEngineInput(report, reportParameters); if (report.isJFreeReport()) { JFreeReportEngine jfreeReportEngine = new JFreeReportEngine(dataSourceProvider, directoryProvider, propertiesProvider); ReportEngineOutput output = jfreeReportEngine.generateReport(input); html = new String(output.getContent()); } else { QueryReportEngine queryReportEngine = new QueryReportEngine(dataSourceProvider, directoryProvider, propertiesProvider); QueryEngineOutput output = (QueryEngineOutput) queryReportEngine.generateReport(input); session.put(ORStatics.QUERY_REPORT_RESULTS, output.getResults()); session.put(ORStatics.QUERY_REPORT_PROPERTIES, output.getProperties()); } reportLog.setEndTime(new Date()); reportLog.setStatus(ReportLog.STATUS_SUCCESS); reportLogProvider.updateReportLog(reportLog); log.debug("Finished Query Report: " + report.getName()); } catch (Exception e) { addActionError(e.getMessage()); log.error(e.getMessage()); reportLog.setMessage(e.getMessage()); reportLog.setStatus(ReportLog.STATUS_FAILURE); reportLog.setEndTime(new Date()); try { reportLogProvider.updateReportLog(reportLog); } catch (Exception ex) { log.error("Unable to create ReportLog: " + ex.getMessage()); } return ERROR; } if (report.isJFreeReport()) return ORStatics.JFREEREPORT_RESULT; return SUCCESS; }