Package com.cfinkel.reports.wrappers

Examples of com.cfinkel.reports.wrappers.Report


     * updates custom classes
     */
    static void updateCustomClasses() {

        for (String reportPath : getReports().keySet()) {
            Report report = getReports().get(reportPath);
            try {
                report.updateCustomClasses();
            } catch (BadReportSyntaxException e) {
                log.error("Error updating class for report at path " + reportPath + ", unloading report from the app.");
                getReports().remove(reportPath);
            }
        }
View Full Code Here


        }

        try {
            ReportElement reportElement = (ReportElement) reportUnmarshaller.unmarshal
                    (new File(AppData.getReportsDirectory() + reportPath + ".xml"));
            Report report = new Report(reportElement, reportPath);
            reports.put(reportPath, report);
            String message = "Successfully loaded report at path " + reportPath + "\n\r";
            outputStream.write(message.getBytes());

        } catch (BadReportSyntaxException e) {
View Full Code Here

        }

    }

    public static void unloadReport(String reportPath, OutputStream outputStream) throws IOException {
        Report report = getReports().get(reportPath);
        if (report == null) {
            outputStream.write(("No report at '" + reportPath + "' is loaded.\n").getBytes());
        }

        // remove session data that attaches to this report:
View Full Code Here

        // lock for reads now:
        AppData.getReportsLock().readLock().lock();
        try {
            Map<String, Report> reports = AppData.getReports();
            Report report = reports.get(reportPath);

            if (report == null) {
                try {
                    report = createReport(reportPath);
                    // add report to app scope:
                    reports.put(reportPath,report);
                } catch (JAXBException e) {
                    log.info("Error unmarshalling XML report", e);
                    if ((e.getLinkedException() != null) &&
                            (e.getLinkedException() instanceof FileNotFoundException)) {
                        RequestDispatcher rd = request.getRequestDispatcher("/report_not_found.jsp");
                        rd.include(request, response);
                    } else {
                        RequestDispatcher rd = request.getRequestDispatcher("/bad_syntax.jsp");
                        request.setAttribute("error", e);
                        rd.include(request, response);
                    }
                    return;
                } catch (BadReportSyntaxException e) {
                    log.info("Bad Report Syntax", e);
                    RequestDispatcher rd = request.getRequestDispatcher("/invalid_xml.jsp");
                    request.setAttribute("error", e);
                    rd.include(request, response);
                    return;
                }
            }

            ReportSessionInfo reportSessionInfo = getReportSessionInfo(report,session,reportPath);
            request.setAttribute(AttributeNames.reportSessionInfo,reportSessionInfo);

            // check if user has access to this report:
            if (report.hasAccess(request)) {

                try {
                    if (request.getParameter(ParameterNames.clearData) != null) {
                        reportSessionInfo.clearCachedData();
                        response.sendRedirect(request.getContextPath() + request.getServletPath());
                        return;
                    }

                    if ((request.getParameter(ParameterNames.run) != null) || report.getAllInputs().size() == 0) {
                        Map<String, List> reportData = reportSessionInfo.runReport(request.getParameterMap());
                        request.setAttribute(AttributeNames.reportData,reportData);
                    } else if (reportSessionInfo.isReportWasRunAndDataWasNotCleared()) {
                        Map<String, List> reportData = reportSessionInfo.runOnlyForNonCachedData();
                        request.setAttribute(AttributeNames.reportData,reportData);
View Full Code Here

        JAXBContext jc = AppData.getJAXBContext();
        Unmarshaller u = jc.createUnmarshaller();

        ReportElement reportElement = (ReportElement) u.unmarshal
                (new File(AppData.getReportsDirectory() + reportPath + ".xml"));
        return new Report(reportElement, reportPath);
    }
View Full Code Here

TOP

Related Classes of com.cfinkel.reports.wrappers.Report

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.