]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-1451: Xlsx Report Configuration (#421)
authorMichael Ritter <mikejritter@users.noreply.github.com>
Tue, 3 Sep 2024 22:13:50 +0000 (16:13 -0600)
committerGitHub <noreply@github.com>
Tue, 3 Sep 2024 22:13:50 +0000 (18:13 -0400)
21 files changed:
services/report/3rdparty/jasper-cs-report/src/main/resources/accessions.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/artwork_description.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/borrowing_receipt.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/box_list.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/condition.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/deaccessions.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/deed_of_gift.jrxml
services/report/3rdparty/jasper-cs-report/src/main/resources/deed_of_gift.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/full_obj_place.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/incoming_loan.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/incoming_loan_letter.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/obj_computed_location.jrxml
services/report/3rdparty/jasper-cs-report/src/main/resources/obj_computed_location.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/obj_current_place_details.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/object_valuation.jrxml
services/report/3rdparty/jasper-cs-report/src/main/resources/outgoing_loan.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/outgoing_loan_letter.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/referral.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/tombstone_with_budget.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/tombstone_with_creator.xml
services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java

index 1567d24b0dd113caf3be4602609546b8f2cab0ef..a0eb6d1c47277fd96c0c844eae2f79dadf21d61c 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>accessions.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index d82ab47d2fba698b400416da60947aa33077ced6..24cb3a99a38a41fd0f8c125f1f61fb30f64a6738 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>artwork_description.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index f418e09cd58128a20b666aa559cf25817f068580..9c9bb98b410c0c197f18623d74eda9d633112580 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>borrowing_receipt.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index b566c2c594b78c1871c17bf26cf535b5978a14c7..6d5da1a7a75188a341979bd944092cc0d132c089 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>box_list.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index bf7ba9b196bbb1979e88b5f7414ad1a6d607a8af..b0cf52b008ce02dd5e6879f62dc7957db9789e2b 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>condition.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index 31b74882f997d48747b68f58971b89944ea41219..25e7dc6b0af502d0366e40009307fd7b6ac0e766 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>deaccessions.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index f66853b6fcac9ca7bdc894d1fb725c0dff6992f5..c99895c18de3bd6010fced43887caacfa83fc908 100644 (file)
@@ -4,19 +4,8 @@
        xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
        name="deedofgift" pageWidth="1500" pageHeight="800" orientation="Landscape" columnWidth="1460" leftMargin="20" rightMargin="20"
        topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="202f91ff-d0dd-4eda-90de-a15938303d79">
-       <property name="net.sf.jasperreports.jrparameter.is.ignore.pagination" value="true" />
-       <property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="false" />
-       <property name="net.sf.jasperreports.export.xls.sheet.names.all" value="DeedOfGift-Report/Footnotes" />
-       <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true" />
-       <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true" />
-       <property name="net.sf.jasperreports.export.xls.white.page.background" value="false" />
-       <property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true" />
-       <property name="net.sf.jasperreports.page.break.no.pagination" value="apply" />
-       <property name="net.sf.jasperreports.export.xls.freeze.row" value="2" />
-       <property name="net.sf.jasperreports.print.keep.full.text" value="true" />
        <property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="pageHeader" />
        <property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter" />
-       <property name="net.sf.jasperreports.exports.xls.font.size.fix.enabled" value="false" />
        <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="nuxeo"/>
        <property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w1" value="193"/>
index b47050a92ca7f8b6f5665705ad3b536aa2227fda..5ac742cbe40de89cf8c3660f14e3b910201d3cc3 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>deed_of_gift.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index 67f88e4c2d664903ff0a3b1879469e71903aadeb..e7d1913303fb1726fe9907d91645622e0be2c1ac 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>full_obj_place.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index b93065f761949752758ddc068fa52473ef13893e..32c0c4d87699003a33ea32b69370798f80355f76 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>incoming_loan.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index 29b0a9d4a9a2a7320e2e64c04fa54a7126924c80..6f2873a9252b22230c747f151a7d74e6f28df720 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>incoming_loan_letter.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index 4e3bf4f37eddcba77e8b6b7e58f6da6dca525cdd..d4011756ed0f808c20b2b9627fbdf2d490b18cca 100644 (file)
@@ -1,19 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Created with Jaspersoft Studio version 6.20.1.final using JasperReports Library version 6.20.1-7584acb244139816654f64e2fd57a00d3e31921e  -->
 <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="objcomputedlocation" pageWidth="1000" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="0b89017b-1c64-4285-9d1a-33596b3f5bb3">
-       <property name="net.sf.jasperreports.jrparameter.is.ignore.pagination" value="true" />
-       <property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="false" />
-       <property name="net.sf.jasperreports.export.xls.sheet.names.all" value="BasicObjWithLocation-Report/Footnotes" />
-       <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true" />
-       <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true" />
-       <property name="net.sf.jasperreports.export.xls.white.page.background" value="false" />
-       <property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true" />
-       <property name="net.sf.jasperreports.page.break.no.pagination" value="apply" />
-       <property name="net.sf.jasperreports.export.xls.freeze.row" value="2" />
-       <property name="net.sf.jasperreports.print.keep.full.text" value="true" />
        <property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="pageHeader" />
        <property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter" />
-       <property name="net.sf.jasperreports.exports.xls.font.size.fix.enabled" value="false" />
        <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="nuxeo"/>
        <property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w1" value="193"/>
index 62452fdb72746220f0d3a4c5c2a17114fb2e743f..78c6fa7b7980288f1f49b6563df6c947e93450a1 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>obj_computed_location.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index dc0e168a8a93630436760aa87109b8ab9c68179f..e8ac34f936fecc73d30103d35e79dd474753187a 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>obj_current_place_details.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index df2d25c2b1fb061b054e6a0d5ffb719f2298a9fa..376f9865bd2ab7bdb1743540b0137a712c2c9eae 100644 (file)
@@ -2,18 +2,8 @@
 <!-- Created with Jaspersoft Studio version 6.10.0.final using JasperReports Library version 6.10.0-unknown  -->
 <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="obj_val" pageWidth="1000" pageHeight="800" orientation="Landscape" columnWidth="100" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="49b29b35-57c3-422f-8699-01975b0a33f9">
        <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
-       <property name="net.sf.jasperreports.jrparameter.is.ignore.pagination" value="true"/>
-       <property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="false"/>
-       <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
-       <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
-       <property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
-       <property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
-       <property name="net.sf.jasperreports.page.break.no.pagination" value="apply"/>
-       <property name="net.sf.jasperreports.export.xls.freeze.row" value="2"/>
-       <property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
        <property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="pageHeader"/>
        <property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter"/>
-       <property name="net.sf.jasperreports.exports.xls.font.size.fix.enabled" value="false"/>
        <style name="Column header" fontName="SansSerif" fontSize="12" isBold="true"/>
        <style name="Detail" fontName="SansSerif" fontSize="12"/>
        <parameter name="csidlist" class="java.lang.String" isForPrompting="false"/>
index 09eac38cab5ce097efbd4765d832e5507c5d061b..718e6fffc688117260882030b83a43b6bb25beb8 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>outgoing_loan.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index 4c0d3a8137906f5e7d086e29d9426dd72570508f..31b9d8b15e7981f3b054bb537941d28d77c779ba 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>outgoing_loan_letter.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index ad8bf05b031f0fa826f4d7b4dc095232bf788377..0d28e80dd9e60c24498037ee51ccf5f4f5712286 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>referral.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index 9506a51926266ff754c62d1feaa69cc71d001494..e2a314230a93c233900f7e913298d018fbfa52c2 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>tombstone_with_budget.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index 70ce27376c0ee16b7435afb092642fd871100916..e7c80afb7acb3d5e93073d5f46bb10eaf7cd5a29 100644 (file)
@@ -11,6 +11,6 @@
     <supportsGroup>false</supportsGroup>
     <supportsNoContext>true</supportsNoContext>
     <filename>tombstone_with_creator.jrxml</filename>
-    <outputMIME>text/csv</outputMIME>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
   </ns2:reports_common>
 </document>
index cc9ae464699aabdb5f2b3a5d55296cc66b6aecc6..b4fe5bc0e2b9ee4a0030921f7e9a74780443e896 100644 (file)
@@ -40,23 +40,30 @@ import javax.naming.NamingException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import net.sf.jasperreports.engine.JRBreak;
 import net.sf.jasperreports.engine.JRException;
-import net.sf.jasperreports.engine.JRExporter;
-import net.sf.jasperreports.engine.JRExporterParameter;
 import net.sf.jasperreports.engine.JRParameter;
+import net.sf.jasperreports.engine.JRTextElement;
 import net.sf.jasperreports.engine.JasperCompileManager;
 import net.sf.jasperreports.engine.JasperFillManager;
 import net.sf.jasperreports.engine.JasperPrint;
 import net.sf.jasperreports.engine.design.JasperDesign;
 import net.sf.jasperreports.engine.export.HtmlExporter;
 import net.sf.jasperreports.engine.export.JRCsvExporter;
-import net.sf.jasperreports.engine.export.JRCsvExporterParameter;
 import net.sf.jasperreports.engine.export.JRPdfExporter;
 import net.sf.jasperreports.engine.export.JRXmlExporter;
 import net.sf.jasperreports.engine.export.ooxml.JRDocxExporter;
 import net.sf.jasperreports.engine.export.ooxml.JRPptxExporter;
 import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter;
 import net.sf.jasperreports.engine.xml.JRXmlLoader;
+import net.sf.jasperreports.export.Exporter;
+import net.sf.jasperreports.export.SimpleCsvExporterConfiguration;
+import net.sf.jasperreports.export.SimpleExporterInput;
+import net.sf.jasperreports.export.SimpleHtmlExporterOutput;
+import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
+import net.sf.jasperreports.export.SimpleWriterExporterOutput;
+import net.sf.jasperreports.export.SimpleXlsxReportConfiguration;
+import net.sf.jasperreports.export.SimpleXmlExporterOutput;
 import org.collectionspace.authentication.AuthN;
 import org.collectionspace.services.ReportJAXBSchema;
 import org.collectionspace.services.account.AccountResource;
@@ -70,7 +77,6 @@ import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.ReportClient;
 import org.collectionspace.services.common.CSWebApplicationException;
 import org.collectionspace.services.common.ServiceMain;
-import org.collectionspace.services.common.api.FileTools;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.authorization_mgt.ActionGroup;
 import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
@@ -97,7 +103,6 @@ import org.collectionspace.services.report.ReportsCommon.ForRoles;
 import org.collectionspace.services.report.ReportsOuputMimeList;
 import org.collectionspace.services.report.ResourceActionGroup;
 import org.collectionspace.services.report.ResourceActionGroupList;
-import org.jfree.util.Log;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.model.PropertyException;
 import org.slf4j.Logger;
@@ -200,7 +205,7 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<Report
                boolean releaseRepoSession = false;
 
                // Ensure the current user has permission to run this report
-               if (isAuthoritzed(reportsCommon) == false) {
+               if (!isAuthorized(reportsCommon)) {
                        String msg = String.format("Report Resource: The user '%s' is not authorized to run the report '%s' CSID='%s'",
                                        AuthN.get().getUserId(), reportsCommon.getName(), csid);
                        throw new PermissionException(msg);
@@ -355,56 +360,47 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<Report
 
        }
 
-    private InputStream buildReportResult(
-                       String reportCSID,
-                       HashMap<String, Object> params,
-                       String reportFileName,
-                       String outputMimeType,
-                       StringBuffer outReportFileName
-               ) throws Exception {
+       private InputStream buildReportResult(
+               String reportCSID,
+               HashMap<String, Object> params,
+               String reportFileName,
+               String outputMimeType,
+               StringBuffer outReportFileName) throws Exception {
 
-                       Connection conn = null;
-                       InputStream result = null;
+               try (Connection conn = getConnection()) {
+                       String reportName = Tools.getFilenameBase(reportFileName);
+                       File reportCompiledFile = ReportResource.getReportCompiledFile(reportName);
 
-       try {
-                               String reportName = Tools.getFilenameBase(reportFileName);
-                               File reportCompiledFile = ReportResource.getReportCompiledFile(reportName);
+                       if (!reportCompiledFile.exists()) {
+                               // Need to compile the file.
 
-                               if (!reportCompiledFile.exists()) {
-                                       // Need to compile the file.
+                               File reportSourceFile = ReportResource.getReportSourceFile(reportName);
 
-                                       File reportSourceFile = ReportResource.getReportSourceFile(reportName);
+                               if (!reportSourceFile.exists()) {
+                                       logger.error("Report for csid={} is missing source file: {}",
+                                                                reportCSID, reportSourceFile.getAbsolutePath());
 
-                                       if(!reportSourceFile.exists()) {
-                                               logger.error("Report for csid={} is missing source file: {}",
-                                                               reportCSID, reportSourceFile.getAbsolutePath());
-
-                                               throw new RuntimeException("Report is missing source file");
-                                       }
+                                       throw new RuntimeException("Report is missing source file");
+                               }
 
-                                       logger.info("Report for csid={} is not compiled. Compiling first, and saving to: {}",
+                               logger.info("Report for csid={} is not compiled. Compiling first, and saving to: {}",
                                                        reportCSID, reportCompiledFile.getAbsolutePath());
 
-                                       JasperDesign design = JRXmlLoader.load(reportSourceFile.getAbsolutePath());
+                               JasperDesign design = JRXmlLoader.load(reportSourceFile.getAbsolutePath());
 
-                                       design.setScriptletClass("org.collectionspace.services.report.jasperreports.CSpaceReportScriptlet");
+                               design.setScriptletClass("org.collectionspace.services.report.jasperreports.CSpaceReportScriptlet");
 
-                                       JasperCompileManager.compileReportToFile(design, reportCompiledFile.getAbsolutePath());
-                               }
-
-                               conn = getConnection();
+                               JasperCompileManager.compileReportToFile(design, reportCompiledFile.getAbsolutePath());
+                       }
 
-                               if (logger.isTraceEnabled()) {
-                                       logger.trace("ReportResource for csid=" + reportCSID
-                                                       + " output as " + outputMimeType + " using report file: " + reportCompiledFile.getAbsolutePath());
-                               }
+                       logger.trace("ReportResource for csid={} output as {} using report file: {}", reportCSID, outputMimeType,
+                                                reportCompiledFile.getAbsolutePath());
 
                        FileInputStream fileStream = new FileInputStream(reportCompiledFile);
+                       // Report will be to a temporary file.
+                       File tempOutputFile = Files.createTempFile("report-", null).toFile();
+                       FileOutputStream tempOutputStream = new FileOutputStream(tempOutputFile);
 
-                       // export report to pdf and build a response with the bytes
-                       //JasperExportManager.exportReportToPdf(jasperprint);
-
-                       JRExporter exporter = null;
                        // Strip extension from report filename.
                        String outputFilename = reportFileName;
                        // Strip extension from report filename.
@@ -417,134 +413,168 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<Report
                        if (idx > 0) {
                                outputFilename = outputFilename.substring(idx + 1);
                        }
-                       if (outputMimeType.equals(MediaType.APPLICATION_XML)) {
-                               params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
-                               exporter = new JRXmlExporter();
-                               outputFilename = outputFilename+".xml";
-                       } else if(outputMimeType.equals(MediaType.TEXT_HTML)) {
-                               exporter = new HtmlExporter();
-                               outputFilename = outputFilename+".html";
-                       } else if(outputMimeType.equals(ReportClient.PDF_MIME_TYPE)) {
-                               exporter = new JRPdfExporter();
-                               outputFilename = outputFilename+".pdf";
-                       } else if(outputMimeType.equals(ReportClient.CSV_MIME_TYPE)) {
-                               params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
-                               exporter = new JRCsvExporter();
-                               exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ",");
-                               outputFilename = outputFilename+".csv";
-                       } else if(outputMimeType.equals(ReportClient.TSV_MIME_TYPE)) {
-                               params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
-                               exporter = new JRCsvExporter();
-                               exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, "\t");
-                               outputFilename = outputFilename+".csv";
-                       } else if(outputMimeType.equals(ReportClient.MSWORD_MIME_TYPE)  // Understand msword as docx
-                                       || outputMimeType.equals(ReportClient.OPEN_DOCX_MIME_TYPE)) {
-                               exporter = new JRDocxExporter();
-                               outputFilename = outputFilename+".docx";
-                       } else if(outputMimeType.equals(ReportClient.MSEXCEL_MIME_TYPE) // Understand msexcel as xlsx
-                                       || outputMimeType.equals(ReportClient.OPEN_XLSX_MIME_TYPE)) {
-                               exporter = new JRXlsxExporter();
-                               outputFilename = outputFilename+".xlsx";
-                       } else if(outputMimeType.equals(ReportClient.MSPPT_MIME_TYPE)   // Understand msppt as xlsx
-                                       || outputMimeType.equals(ReportClient.OPEN_PPTX_MIME_TYPE)) {
-                               exporter = new JRPptxExporter();
-                               outputFilename = outputFilename+".pptx";
-                       } else {
-                               logger.error("Reporting: unsupported output MIME type - defaulting to PDF");
-                               exporter = new JRPdfExporter();
-                               outputFilename = outputFilename+"-default-to.pdf";
+
+                       Exporter exporter;
+                       switch (outputMimeType) {
+                               case MediaType.APPLICATION_XML:
+                                       params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
+                                       exporter = xmlExporter(tempOutputStream);
+                                       outputFilename = outputFilename + ".xml";
+                                       break;
+                               case MediaType.TEXT_HTML:
+                                       exporter = htmlExporter(tempOutputStream);
+                                       outputFilename = outputFilename + ".html";
+                                       break;
+                               case ReportClient.PDF_MIME_TYPE:
+                                       exporter = pdfExporter(tempOutputStream);
+                                       outputFilename = outputFilename + ".pdf";
+                                       break;
+                               case ReportClient.CSV_MIME_TYPE:
+                                       params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
+                                       exporter = csvExporter(tempOutputStream);
+                                       outputFilename = outputFilename + ".csv";
+                                       break;
+                               case ReportClient.TSV_MIME_TYPE:
+                                       params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
+                                       exporter = tsvExporter(tempOutputStream);
+                                       outputFilename = outputFilename + ".csv";
+                                       break;
+                               case ReportClient.MSWORD_MIME_TYPE:
+                               case ReportClient.OPEN_DOCX_MIME_TYPE:
+                                       exporter = docxExporter(tempOutputStream);
+                                       outputFilename = outputFilename + ".docx";
+                                       break;
+                               case ReportClient.MSEXCEL_MIME_TYPE:
+                               case ReportClient.OPEN_XLSX_MIME_TYPE:
+                                       params.put(JRParameter.IS_IGNORE_PAGINATION, true);
+                                       params.put(JRBreak.PROPERTY_PAGE_BREAK_NO_PAGINATION, JRBreak.PAGE_BREAK_NO_PAGINATION_APPLY);
+                                       params.put(JRTextElement.PROPERTY_PRINT_KEEP_FULL_TEXT, true);
+                                       exporter = xlsxExporter(tempOutputStream, outputFilename);
+                                       outputFilename = outputFilename + ".xlsx";
+                                       break;
+                               case ReportClient.MSPPT_MIME_TYPE:
+                               case ReportClient.OPEN_PPTX_MIME_TYPE:
+                                       exporter = pptxExporter(tempOutputStream);
+                                       outputFilename = outputFilename + ".pptx";
+                                       break;
+                               default:
+                                       logger.error("Reporting: unsupported output MIME type - defaulting to PDF");
+                                       exporter = pdfExporter(tempOutputStream);
+                                       outputFilename = outputFilename + "-default-to.pdf";
+                                       break;
                        }
-                       outReportFileName.append(outputFilename); // Set the out going param to the report's final file name
-                        // FIXME: Logging temporarily set to INFO level for CSPACE-5766;
-                        // can change to TRACE or DEBUG level as warranted thereafter
-                        if (logger.isInfoEnabled()) {
-                            logger.info(FileTools.getJavaTmpDirInfo());
-                        }
-                        // fill the report
-                       JasperPrint jasperPrint = JasperFillManager.fillReport(fileStream, params,conn);
 
-                       // Report will be to a temporary file.
-                       File tempOutputFile = Files.createTempFile("report-", null).toFile();
-                       FileOutputStream tempOutputStream = new FileOutputStream(tempOutputFile);
-                       exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
-                       exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, tempOutputStream);
+                       outReportFileName.append(outputFilename); // Set the outgoing param to the report's final file name
+
+                       // fill the report
+                       JasperPrint jasperPrint = JasperFillManager.fillReport(fileStream, params, conn);
+                       exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
                        exporter.exportReport();
                        tempOutputStream.close();
 
-                       result = new FileInputStream(tempOutputFile);
-               return result;
-        } catch (SQLException sqle) {
-            // SQLExceptions can be chained. We have at least one exception, so
-            // set up a loop to make sure we let the user know about all of them
-            // if there happens to be more than one.
-            if (logger.isDebugEnabled()) {
-                   SQLException tempException = sqle;
-                   while (null != tempException) {
-                               logger.debug("SQL Exception: " + sqle.getLocalizedMessage());
-
-                       // loop to the next exception
-                       tempException = tempException.getNextException();
-                   }
-            }
-            Response response = Response.status(
-                    Response.Status.INTERNAL_SERVER_ERROR).entity(
-                               "Invoke failed (SQL problem) on Report csid=" + reportCSID).type("text/plain").build();
-            throw new CSWebApplicationException(sqle, response);
-        } catch (JRException jre) {
-            if (logger.isDebugEnabled()) {
-               logger.debug("JR Exception: " + jre.getLocalizedMessage() + " Cause: "+jre.getCause());
-            }
-            Response response = Response.status(
-                    Response.Status.INTERNAL_SERVER_ERROR).entity(
-                               "Invoke failed (Jasper problem) on Report csid=" + reportCSID).type("text/plain").build();
-            throw new CSWebApplicationException(jre, response);
-        } catch (FileNotFoundException fnfe) {
-            if (logger.isDebugEnabled()) {
-               logger.debug("FileNotFoundException: " + fnfe.getLocalizedMessage());
-            }
-            Response response = Response.status(
-                    Response.Status.INTERNAL_SERVER_ERROR).entity(
-                               "Invoke failed (SQL problem) on Report csid=" + reportCSID).type("text/plain").build();
-            throw new CSWebApplicationException(fnfe, response);
-               } finally {
-               if (conn!=null) {
-                       try {
-                               conn.close();
-                } catch (SQLException sqle) {
-                    // SQLExceptions can be chained. We have at least one exception, so
-                    // set up a loop to make sure we let the user know about all of them
-                    // if there happens to be more than one.
-                    if (logger.isDebugEnabled()) {
-                               logger.debug("SQL Exception closing connection: "
-                                               + sqle.getLocalizedMessage());
-                    }
-                } catch (Exception e) {
-                    if (logger.isDebugEnabled()) {
-                        logger.debug("Exception closing connection", e);
-                    }
-                }
-               }
-        }
-    }
+                       return new FileInputStream(tempOutputFile);
+               } catch (SQLException sqle) {
+                       logger.error("SQL Exception in report {}", reportCSID, sqle);
+                       Response response = Response.serverError()
+                               .entity("Invoke failed (SQL problem) on Report csid=" + reportCSID)
+                               .type("text/plain").build();
+                       throw new CSWebApplicationException(sqle, response);
+               } catch (JRException jre) {
+                       logger.error("JasperReports Exception: {} Cause: {}", jre.getLocalizedMessage(), jre.getCause());
+                       Response response = Response.serverError()
+                               .entity("Invoke failed (Jasper problem) on Report csid=" + reportCSID)
+                               .type("text/plain").build();
+                       throw new CSWebApplicationException(jre, response);
+               } catch (FileNotFoundException fnfe) {
+                       logger.error("FileNotFoundException: {}", fnfe.getLocalizedMessage());
+                       Response response = Response.serverError()
+                               .entity("Invoke failed (FileNotFound) on Report csid=" + reportCSID)
+                               .type("text/plain").build();
+                       throw new CSWebApplicationException(fnfe, response);
+               }
+       }
 
-    private Connection getConnection() throws NamingException, SQLException {
-       Connection result = null;
+       private JRPptxExporter pptxExporter(FileOutputStream outputStream) {
+               JRPptxExporter exporter = new JRPptxExporter();
+               exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outputStream));
+               return exporter;
+       }
 
-       ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
-       try {
-               String repositoryName = ctx.getRepositoryName();
-               if (repositoryName != null && repositoryName.trim().isEmpty() == false) {
-                        String cspaceInstanceId = ServiceMain.getInstance().getCspaceInstanceId();
-                        String databaseName = JDBCTools.getDatabaseName(repositoryName, cspaceInstanceId);
-                       result = JDBCTools.getConnection(JDBCTools.NUXEO_READER_DATASOURCE_NAME, databaseName);
-               }
+       private JRXlsxExporter xlsxExporter(FileOutputStream outputStream, String outputFilename) {
+               JRXlsxExporter exporter = new JRXlsxExporter();
+               SimpleXlsxReportConfiguration reportConfig = new SimpleXlsxReportConfiguration();
+               reportConfig.setCollapseRowSpan(true);
+               reportConfig.setDetectCellType(true);
+               reportConfig.setRemoveEmptySpaceBetweenRows(true);
+               reportConfig.setRemoveEmptySpaceBetweenColumns(true);
+               reportConfig.setOnePagePerSheet(false);
+               reportConfig.setFontSizeFixEnabled(false);
+               reportConfig.setWhitePageBackground(false);
+               reportConfig.setFreezeRow(2);
+               reportConfig.setSheetNames(new String[] {outputFilename});
+
+               exporter.setConfiguration(reportConfig);
+               exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outputStream));
+               return exporter;
+       }
+
+       private JRDocxExporter docxExporter(FileOutputStream outputStream) {
+               JRDocxExporter exporter = new JRDocxExporter();
+               exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outputStream));
+               return exporter;
+       }
+
+       private JRCsvExporter tsvExporter(FileOutputStream outputStream) {
+               JRCsvExporter exporter = new JRCsvExporter();
+               final SimpleCsvExporterConfiguration exportConfig = new SimpleCsvExporterConfiguration();
+               exportConfig.setFieldDelimiter("\t");
+               exporter.setConfiguration(exportConfig);
+               exporter.setExporterOutput(new SimpleWriterExporterOutput(outputStream));
+               return exporter;
+       }
+
+       private JRCsvExporter csvExporter(FileOutputStream outputStream) {
+               JRCsvExporter exporter = new JRCsvExporter();
+               exporter.setExporterOutput(new SimpleWriterExporterOutput(outputStream));
+               return exporter;
+       }
+
+       private JRPdfExporter pdfExporter(FileOutputStream outputStream) {
+               JRPdfExporter exporter = new JRPdfExporter();
+               exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outputStream));
+               return exporter;
+       }
+
+       private HtmlExporter htmlExporter(FileOutputStream outputStream) {
+               HtmlExporter exporter = new HtmlExporter();
+               exporter.setExporterOutput(new SimpleHtmlExporterOutput(outputStream));
+               return exporter;
+       }
+
+       private JRXmlExporter xmlExporter(FileOutputStream outputStream) {
+               JRXmlExporter exporter = new JRXmlExporter();
+               exporter.setExporterOutput(new SimpleXmlExporterOutput(outputStream));
+               return exporter;
+       }
+
+       private Connection getConnection() throws NamingException, SQLException {
+               Connection result = null;
+
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
+               try {
+                       String repositoryName = ctx.getRepositoryName();
+                       if (repositoryName != null && repositoryName.trim().isEmpty() == false) {
+                               String cspaceInstanceId = ServiceMain.getInstance().getCspaceInstanceId();
+                               String databaseName = JDBCTools.getDatabaseName(repositoryName, cspaceInstanceId);
+                               result = JDBCTools.getConnection(JDBCTools.NUXEO_READER_DATASOURCE_NAME, databaseName);
+                       }
                } catch (Exception e) {
-                       Log.error(e);
+                       logger.error("Error getting database connection", e);
                        throw new NamingException();
                }
 
-       return result;
-    }
+               return result;
+       }
 
        /**
         * Check to see if the current user is authorized to run/invoke this report.  If the report
@@ -552,7 +582,7 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<Report
         * @param reportsCommon
         * @return
         */
-       protected boolean isAuthoritzedWithPermissions(ReportsCommon reportsCommon) {
+       protected boolean isAuthorizedWithPermissions(ReportsCommon reportsCommon) {
                boolean result = true;
 
                ResourceActionGroupList resourceActionGroupList = reportsCommon.getResourceActionGroupList();
@@ -618,13 +648,13 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<Report
         * @param reportsCommon
         * @return
         */
-       protected boolean isAuthoritzed(ReportsCommon reportsCommon) {
+       protected boolean isAuthorized(ReportsCommon reportsCommon) {
                boolean result = true;
 
                if (hasRequiredRoles(reportsCommon)) {
                        result = isAuthorizedWithRoles(reportsCommon);
                } else if (hasRequiredPermissions(reportsCommon)) {
-                       result = isAuthoritzedWithPermissions(reportsCommon);
+                       result = isAuthorizedWithPermissions(reportsCommon);
                }
 
                return result;