fixes issue 38518: Ability of compiling subreports with HttpSecureAppServlet.renderJR
authorCarlos Aristu <carlos.aristu@openbravo.com>
Fri, 11 May 2018 15:03:03 +0200
changeset 33949 4fa9879b9647
parent 33948 324ddcc5adc9
child 33950 0c8d2174716f
fixes issue 38518: Ability of compiling subreports with HttpSecureAppServlet.renderJR
src/org/openbravo/base/secureApp/HttpSecureAppServlet.java
--- a/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Fri May 11 00:45:46 2018 +0530
+++ b/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Fri May 11 15:03:03 2018 +0200
@@ -1247,13 +1247,13 @@
         localExportParameters.put(ReportingUtils.IMAGES_URI, localAddress
             + "/servlets/image?image={0}");
         ReportingUtils.exportJR(localStrReportName, expType, localDesignParameters, os, false,
-            readOnlyCP, data, localExportParameters);
+            readOnlyCP, data, localExportParameters, renderJRShouldCompileSubreports());
       } else if (expType != ExportType.XML) {
         reportId = UUID.randomUUID();
         File outputFile = new File(globalParameters.strFTPDirectory + "/" + localStrFileName + "-"
             + (reportId) + "." + localStrOutputType);
         ReportingUtils.exportJR(localStrReportName, expType, localDesignParameters, outputFile,
-            false, readOnlyCP, data, localExportParameters);
+            false, readOnlyCP, data, localExportParameters, renderJRShouldCompileSubreports());
         response.setContentType("text/html;charset=UTF-8");
         response.setHeader("Content-disposition", "inline" + "; filename=" + localStrFileName + "-"
             + (reportId) + ".html");
@@ -1297,6 +1297,19 @@
   }
 
   /**
+   * This method should be overridden by those classes which want to compile the sub-reports when
+   * invoking renderJR. Note that the sub-reports to be compiled will be the .jrxml files placed in
+   * the same folder as the main report and whose related parameter name starts with <b>SUBREP_</b>.
+   * By default, this method returns {@code false}.
+   * 
+   * @return {@code true} if renderJR should use the reporting engine to compile the sub-reports
+   *         automatically. Otherwise, this method should return {@code false}.
+   */
+  protected boolean renderJRShouldCompileSubreports() {
+    return false;
+  }
+
+  /**
    * Saves the file and request for download. This approach is required to close the loading pop-up
    * window.
    */