[jasper-library-upgrade] Fixes deprecation warnings
authorCarlos Aristu <carlos.aristu@openbravo.com>
Tue, 19 May 2015 10:44:13 +0200
changeset 26750 80c2246bd89f
parent 26749 5ea02a80a35c
child 26751 115b1a6cb502
[jasper-library-upgrade] Fixes deprecation warnings
modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java
src/org/openbravo/base/secureApp/HttpSecureAppServlet.java
src/org/openbravo/erpCommon/utility/ExportGrid.java
src/org/openbravo/erpCommon/utility/GridBO.java
src/org/openbravo/erpCommon/utility/ReportDesignBO.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java	Fri May 15 15:17:50 2015 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java	Tue May 19 10:44:13 2015 +0200
@@ -38,7 +38,6 @@
 
 import net.sf.jasperreports.engine.JRDataSource;
 import net.sf.jasperreports.engine.JRException;
-import net.sf.jasperreports.engine.JRExporterParameter;
 import net.sf.jasperreports.engine.JRParameter;
 import net.sf.jasperreports.engine.JasperCompileManager;
 import net.sf.jasperreports.engine.JasperExportManager;
@@ -74,11 +73,9 @@
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.database.ConnectionProvider;
-import org.openbravo.erpCommon.utility.GridReportVO;
 import org.openbravo.erpCommon.utility.JRFieldProviderDataSource;
 import org.openbravo.erpCommon.utility.JRFormatFactory;
 import org.openbravo.erpCommon.utility.OBMessageUtils;
-import org.openbravo.erpCommon.utility.ReportDesignBO;
 import org.openbravo.model.ad.utility.FileType;
 import org.openbravo.service.db.DalConnectionProvider;
 import org.openbravo.uiTranslation.TranslationHandler;
@@ -737,7 +734,8 @@
     while (it.hasNext()) {
       @SuppressWarnings("rawtypes")
       Map.Entry pair = (Map.Entry) it.next();
-      String parameter = ((JRExporterParameter) pair.getKey()).toString();
+      String parameter = ((net.sf.jasperreports.engine.JRExporterParameter) pair.getKey())
+          .toString();
       if (parameter.equals("Is One Page per Sheet")) {
         configuration.setOnePagePerSheet((Boolean) pair.getValue());
       } else if (parameter.equals("Is Remove Empty Space Between Rows")) {
@@ -786,7 +784,8 @@
     while (it.hasNext()) {
       @SuppressWarnings("rawtypes")
       Map.Entry pair = (Map.Entry) it.next();
-      String parameter = ((JRExporterParameter) pair.getKey()).toString();
+      String parameter = ((net.sf.jasperreports.engine.JRExporterParameter) pair.getKey())
+          .toString();
       if (parameter.equals("Images URI")) {
         exporterOutput.setImageHandler(new WebHtmlResourceHandler((String) pair.getValue()));
       } else if (parameter.equals("Is Remove Empty Space Between Rows")) {
@@ -1180,6 +1179,8 @@
   /**
    * Creates a JasperPrint from a grid report.
    * 
+   * @deprecated
+   * 
    * @param reportFile
    *          An input stream containing the report file.
    * @param gridReportVO
@@ -1192,12 +1193,13 @@
    *           In case there is any error generating the JasperPrint an exception is thrown with the
    *           error message.
    */
-  public static JasperPrint createJasperPrint(InputStream reportFile, GridReportVO gridReportVO)
-      throws JRException, IOException {
+  public static JasperPrint createJasperPrint(InputStream reportFile,
+      org.openbravo.erpCommon.utility.GridReportVO gridReportVO) throws JRException, IOException {
     JasperDesign jasperDesign = JRXmlLoader.load(reportFile);
     if (log.isDebugEnabled())
       log.debug("Create JasperDesign");
-    ReportDesignBO designBO = new ReportDesignBO(jasperDesign, gridReportVO);
+    org.openbravo.erpCommon.utility.ReportDesignBO designBO = new org.openbravo.erpCommon.utility.ReportDesignBO(
+        jasperDesign, gridReportVO);
     designBO.define();
     if (log.isDebugEnabled())
       log.debug("JasperDesign created, pageWidth: " + jasperDesign.getPageWidth()
--- a/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Fri May 15 15:17:50 2015 +0200
+++ b/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Tue May 19 10:44:13 2015 +0200
@@ -35,7 +35,6 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import net.sf.jasperreports.engine.JRDataSource;
-import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
 
 import org.codehaus.jettison.json.JSONObject;
 import org.hibernate.criterion.Restrictions;
@@ -1226,6 +1225,7 @@
         exportParameters, false);
   }
 
+  @SuppressWarnings("deprecation")
   private void renderJR(VariablesSecureApp variables, HttpServletResponse response,
       String strReportName, String strFileName, String strOutputType,
       HashMap<String, Object> designParameters, JRDataSource data,
@@ -1283,8 +1283,8 @@
             + strOutputType);
         HttpServletRequest request = RequestContext.get().getRequest();
         String localAddress = HttpBaseUtils.getLocalAddress(request);
-        exportParameters.put(JRHtmlExporterParameter.IMAGES_URI, localAddress
-            + "/servlets/image?image={0}");
+        exportParameters.put(net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI,
+            localAddress + "/servlets/image?image={0}");
         ReportingUtils.exportJR(strReportName, expType, designParameters, os, false, this, data,
             exportParameters);
       } else if (strOutputType.equals("pdf") || strOutputType.equalsIgnoreCase("xls")) {
--- a/src/org/openbravo/erpCommon/utility/ExportGrid.java	Fri May 15 15:17:50 2015 +0200
+++ b/src/org/openbravo/erpCommon/utility/ExportGrid.java	Tue May 19 10:44:13 2015 +0200
@@ -43,6 +43,9 @@
   // text length multiplied by a factor (character width)
   private static final int CHAR_WIDTH = 10;
 
+  /**
+   * @deprecated
+   */
   public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException,
       ServletException {
     VariablesSecureApp vars = new VariablesSecureApp(request);
@@ -103,6 +106,9 @@
     }
   }
 
+  /**
+   * @deprecated
+   */
   private GridReportVO createGridReport(VariablesSecureApp vars, String strTabId,
       String strWindowId, String strAccessLevel, boolean useFieldLength) throws ServletException {
     if (log4j.isDebugEnabled())
--- a/src/org/openbravo/erpCommon/utility/GridBO.java	Fri May 15 15:17:50 2015 +0200
+++ b/src/org/openbravo/erpCommon/utility/GridBO.java	Tue May 19 10:44:13 2015 +0200
@@ -30,6 +30,9 @@
 import org.openbravo.client.application.report.ReportingUtils.ExportType;
 
 class GridBO {
+  /**
+   * @deprecated
+   */
   public static void createHTMLReport(InputStream reportFile, GridReportVO gridReportVO,
       String path, String fileName) throws JRException, IOException {
     gridReportVO.setPagination(false);
@@ -37,6 +40,9 @@
     ReportingUtils.saveReport(jasperPrint, ExportType.HTML, null, new File(path + "/" + fileName));
   }
 
+  /**
+   * @deprecated
+   */
   public static void createPDFReport(InputStream reportFile, GridReportVO gridReportVO,
       String path, String fileName) throws JRException, IOException {
     gridReportVO.setPagination(false);
@@ -44,6 +50,9 @@
     ReportingUtils.saveReport(jasperPrint, ExportType.PDF, null, new File(path + "/" + fileName));
   }
 
+  /**
+   * @deprecated
+   */
   public static void createXLSReport(InputStream reportFile, GridReportVO gridReportVO,
       String path, String fileName) throws JRException, IOException {
     gridReportVO.setPagination(true);
@@ -51,6 +60,9 @@
     ReportingUtils.saveReport(jasperPrint, ExportType.XLS, null, new File(path + "/" + fileName));
   }
 
+  /**
+   * @deprecated
+   */
   public static void createCSVReport(InputStream reportFile, GridReportVO gridReportVO,
       String path, String fileName) throws JRException, IOException {
     gridReportVO.setPagination(true);
@@ -58,6 +70,9 @@
     ReportingUtils.saveReport(jasperPrint, ExportType.CSV, null, new File(path + "/" + fileName));
   }
 
+  /**
+   * @deprecated
+   */
   public static void createXMLReport(InputStream reportFile, GridReportVO gridReportVO,
       OutputStream os) throws JRException, IOException {
     gridReportVO.setPagination(true);
--- a/src/org/openbravo/erpCommon/utility/ReportDesignBO.java	Fri May 15 15:17:50 2015 +0200
+++ b/src/org/openbravo/erpCommon/utility/ReportDesignBO.java	Tue May 19 10:44:13 2015 +0200
@@ -44,6 +44,9 @@
 
   private GridReportVO gridReportVO;
 
+  /**
+   * @deprecated
+   */
   public ReportDesignBO(JasperDesign jasperDesign, GridReportVO gridReportVO) {
     super();
     this.jasperDesign = jasperDesign;