← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20199: Removed ExcelUtils

 

------------------------------------------------------------
revno: 20199
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-17 09:34:32 +0200
message:
  Removed ExcelUtils
removed:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java	2015-07-04 16:43:29 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java	2015-09-17 07:34:32 +0000
@@ -39,6 +39,7 @@
 import static org.hisp.dhis.system.util.PDFUtils.openDocument;
 import static org.hisp.dhis.system.util.PDFUtils.resetPaddings;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.io.StringWriter;
 import java.io.Writer;
@@ -49,6 +50,8 @@
 import java.util.List;
 import java.util.Map;
 
+import jxl.Workbook;
+import jxl.WorkbookSettings;
 import jxl.write.Label;
 import jxl.write.Number;
 import jxl.write.WritableCellFormat;
@@ -76,7 +79,6 @@
 import org.hisp.dhis.commons.util.Encoder;
 import org.hisp.dhis.commons.util.TextUtils;
 import org.hisp.dhis.system.util.DateUtils;
-import org.hisp.dhis.system.util.ExcelUtils;
 import org.hisp.dhis.system.util.MathUtils;
 import org.hisp.dhis.system.velocity.VelocityManager;
 import org.htmlparser.Node;
@@ -233,7 +235,7 @@
     public static void toXls( List<Grid> grids, OutputStream out )
         throws Exception
     {
-        WritableWorkbook workbook = ExcelUtils.openWorkbook( out );
+        WritableWorkbook workbook = openWorkbook( out );
         
         for ( int i = 0; i < grids.size(); i++ )
         {
@@ -254,7 +256,7 @@
     public static void toXls( Grid grid, OutputStream out )
         throws Exception
     {
-        WritableWorkbook workbook = ExcelUtils.openWorkbook( out );
+        WritableWorkbook workbook = openWorkbook( out );
         
         String sheetName = CodecUtils.filenameEncode( StringUtils.defaultIfEmpty( grid.getTitle(), XLS_SHEET_PREFIX + 1 ) );
 
@@ -698,4 +700,16 @@
     {
         return grid != null && grid.getVisibleWidth() > 0;
     }
+    
+    /**
+     * Opens a workbook with UTF-8 encoding.
+     */
+    private static WritableWorkbook openWorkbook( OutputStream outputStream )
+        throws IOException
+    {
+        WorkbookSettings ws = new WorkbookSettings();
+        ws.setEncoding( "UTF-8" );
+        
+        return Workbook.createWorkbook( outputStream, ws );
+    }
 }

=== removed file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java	2015-09-14 10:20:41 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java	1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
-package org.hisp.dhis.system.util;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import jxl.Workbook;
-import jxl.WorkbookSettings;
-import jxl.write.WritableWorkbook;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @author Dang Duy Hieu
- */
-public class ExcelUtils
-{
-    /**
-     * Creates a writable workbook.
-     *
-     * @param outputStream The output stream to write the document content.
-     * @param pageSize     the page size.
-     * @return A Document.
-     */
-    public static WritableWorkbook openWorkbook( OutputStream outputStream )
-    {
-        try
-        {
-            WorkbookSettings ws = new WorkbookSettings();
-            ws.setEncoding( "UTF-8" );
-
-            return Workbook.createWorkbook( outputStream, ws );
-        }
-        catch ( IOException e )
-        {
-            throw new RuntimeException( "Failed to open a writable workbook", e );
-        }
-    }
-}