Package uk.gov.nationalarchives.droid.report

Examples of uk.gov.nationalarchives.droid.report.ReportTransformerImpl


            ReportViewFrame reportViewDialog = new ReportViewFrame(this);
            //FIXME: the report transformer is defined as a singleton bean in the export report
            // action configured through spring.  Here we are instantiating a new specific
            // transformer - there was a bug in that this one did not have the droid config
            // object configured.  For the time being, just set up this transformer correctly.
            ReportTransformerImpl transformer = new ReportTransformerImpl();
            transformer.setConfig(globalContext.getGlobalConfig());
            reportViewDialog.setReportTransformer(transformer);           
           
           
            action.setProgressDialog(reportProgressDialog);
            action.setViewDialog(reportViewDialog);
View Full Code Here


            Report report = reportManager.generateReport(request, optionalFilter, null);
            //FIXME: the report transformer is defined as a singleton bean in the export report
            // action configured through spring.  Here we are instantiating a new specific
            // transformer - there was a bug in that this one did not have the droid config
            // object configured.  For the time being, just set up this transformer correctly.
            ReportTransformerImpl transformer = new ReportTransformerImpl();
            transformer.setConfig(config);
            String message = String.format("Exporting report as [%s] to: [%s]", reportOutputType, destination);
            log.info(message);
            if (DROID_REPORT_XML.equalsIgnoreCase(reportOutputType)) {
                FileWriter tempReport = new FileWriter(destination);
                reportXmlWriter.writeReport(report, tempReport);
            } else {
                // Write the report xml to a temporary file:
                File tempFile = File.createTempFile("report~", ".xml", config.getTempDir());
                FileWriter tempReport = new FileWriter(tempFile);
                reportXmlWriter.writeReport(report, tempReport);
                FileReader reader = new FileReader(tempFile);
                try {
                    if (PDF_FORMAT.equalsIgnoreCase(reportOutputType)) {
                        FileOutputStream out = new FileOutputStream(destination);
                        transformer.transformToPdf(reader, XHTML_TRANSFORM_LOCATION, out);
                        out.close();
                    } else {
                        ReportSpec spec = request.getReportSpec();
                        File xslFile = getXSLFile(spec.getXslTransforms());
                        if (xslFile != null) {
                            FileWriter out = new FileWriter(destination);
                            transformer.transformUsingXsl(reader, xslFile, out);
                            out.close();
                        }
                    }
                } finally {
                    reader.close();
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.report.ReportTransformerImpl

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.