Search in sources :

Example 1 with ReportGeneratorStandardImpl

use of com.autentia.tnt.report.ReportGeneratorStandardImpl in project TNTConcept by autentia.

the class ReportServlet method generateReport.

private void generateReport(HttpServletRequest request, HttpServletResponse response, String reportName, String ext, String reportCategory) throws IOException {
    ReportInfoBuilder builder = new ReportInfoBuilder();
    builder.name(reportName).in(ReportFormat.valueOf(ext)).withCategory(reportCategory);
    Enumeration e = request.getParameterNames();
    while (e.hasMoreElements()) {
        String arg = (String) e.nextElement();
        final String value = request.getParameter(arg);
        builder.andParameter(arg, value);
    }
    ReportGeneratorStandardImpl generator = new ReportGeneratorStandardImpl();
    try {
        generator.generate(builder.build(), response.getOutputStream());
    } catch (ReportException e1) {
        log.error(e1);
        response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e1.getMessage());
    }
    response.setContentType(ReportFormat.valueOf(ext).getResponseType());
}
Also used : Enumeration(java.util.Enumeration) ReportGeneratorStandardImpl(com.autentia.tnt.report.ReportGeneratorStandardImpl) ReportInfoBuilder(com.autentia.tnt.report.ReportInfo.ReportInfoBuilder) ReportException(com.autentia.tnt.error.ReportException)

Aggregations

ReportException (com.autentia.tnt.error.ReportException)1 ReportGeneratorStandardImpl (com.autentia.tnt.report.ReportGeneratorStandardImpl)1 ReportInfoBuilder (com.autentia.tnt.report.ReportInfo.ReportInfoBuilder)1 Enumeration (java.util.Enumeration)1