← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 255: Simplified the way PDF and XLS are written for validation results + moved code to the service lay...

 

------------------------------------------------------------
revno: 255
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-04-24 14:59:52 +0200
message:
  Simplified the way PDF and XLS are written for validation results + moved code to the service layer from the web layer
removed:
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/FilterUtil.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/OutputGenerator.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/OutputGeneratorPipeThread.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/ValidationResultPDFGenerator.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/ValidationResultWorkbookGenerator.java
added:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultOutputGenerator.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultPDFGenerator.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultWorkbookGenerator.java
modified:
  dhis-2/dhis-web/dhis-web-validationrule/pom.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultPDFAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetFilteredDataElementsAction.java

=== added directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation'
=== added directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator'
=== added file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultOutputGenerator.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultOutputGenerator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultOutputGenerator.java	2009-04-24 12:59:52 +0000
@@ -0,0 +1,44 @@
+package org.hisp.dhis.validation.generator;
+
+/*
+ * Copyright (c) 2004-2007, 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 java.io.OutputStream;
+import java.util.Collection;
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.validation.ValidationResult;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public interface ValidationResultOutputGenerator
+{
+    void generateOutput( Collection<ValidationResult> results, OutputStream out, I18n i18n, I18nFormat format );
+}

=== added file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultPDFGenerator.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultPDFGenerator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultPDFGenerator.java	2009-04-24 12:59:52 +0000
@@ -0,0 +1,104 @@
+package org.hisp.dhis.validation.generator;
+
+/*
+ * Copyright (c) 2004-2007, 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 java.io.OutputStream;
+import java.util.Collection;
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.system.util.DateUtils;
+import org.hisp.dhis.system.util.PDFUtils;
+import org.hisp.dhis.validation.ValidationResult;
+
+import com.lowagie.text.Document;
+import com.lowagie.text.pdf.PdfPTable;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class ValidationResultPDFGenerator
+    extends PDFUtils
+        implements ValidationResultOutputGenerator
+{
+    // -------------------------------------------------------------------------
+    // PDF functionality
+    // -------------------------------------------------------------------------
+
+    public void generateOutput( Collection<ValidationResult> results, OutputStream out, I18n i18n, I18nFormat format )
+    {
+        Document document = openDocument( out );
+        
+        PdfPTable table = getPdfPTable( true, 0.19f, 0.13f, 0.21f, 0.07f, 0.12f, 0.07f, 0.21f );
+        
+        table.setHeaderRows( 0 );
+        
+        table.addCell( getHeader3Cell( i18n.getString( "data_quality_report" ), 7 ) );
+
+        table.addCell( getCell( 7, 8 ) );
+        
+        table.addCell( getTextCell( i18n.getString( "district_health_information_software" ) + " - " + DateUtils.getMediumDateString(), 7 ) );
+        
+        table.addCell( getCell( 7, 15 ) );
+        
+        table.addCell( getItalicCell( i18n.getString( "source" ), 1 ) );
+        table.addCell( getItalicCell( i18n.getString( "period" ), 1 ) );
+        table.addCell( getItalicCell( i18n.getString( "left_side_description" ), 1 ) );
+        table.addCell( getItalicCell( i18n.getString( "value" ), 1 ) );
+        table.addCell( getItalicCell( i18n.getString( "operator" ), 1 ) );
+        table.addCell( getItalicCell( i18n.getString( "value" ), 1 ) );
+        table.addCell( getItalicCell( i18n.getString( "right_side_description" ), 1 ) );
+        
+        table.addCell( getCell( 7, 8 ) );
+        
+        if ( results != null )
+        {
+            for ( ValidationResult validationResult : results )
+            {
+                OrganisationUnit unit = (OrganisationUnit) validationResult.getSource();
+                
+                Period period = validationResult.getPeriod();
+                
+                table.addCell( getTextCell( unit.getName() ) );
+                table.addCell( getTextCell( format.formatPeriod( period ) ) );
+                table.addCell( getTextCell( validationResult.getValidationRule().getLeftSide().getDescription() ) );
+                table.addCell( getTextCell( String.valueOf( validationResult.getLeftsideValue() ) ) );
+                table.addCell( getTextCell( i18n.getString( validationResult.getValidationRule().getOperator() ), 1, ALIGN_CENTER ) );
+                table.addCell( getTextCell( String.valueOf( validationResult.getRightsideValue() ) ) );
+                table.addCell( getTextCell( validationResult.getValidationRule().getRightSide().getDescription() ) );                    
+            }
+        }
+        
+        addTableToDocument( document, table );
+        
+        closeDocument( document );
+    }
+}

=== added file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultWorkbookGenerator.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultWorkbookGenerator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/validation/generator/ValidationResultWorkbookGenerator.java	2009-04-24 12:59:52 +0000
@@ -0,0 +1,123 @@
+package org.hisp.dhis.validation.generator;
+
+/*
+ * Copyright (c) 2004-2007, 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 java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+
+import jxl.Workbook;
+import jxl.write.Label;
+import jxl.write.Number;
+import jxl.write.WritableCellFormat;
+import jxl.write.WritableFont;
+import jxl.write.WritableSheet;
+import jxl.write.WritableWorkbook;
+import jxl.write.WriteException;
+import jxl.write.biff.RowsExceededException;
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.system.util.DateUtils;
+import org.hisp.dhis.validation.ValidationResult;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class ValidationResultWorkbookGenerator
+    implements ValidationResultOutputGenerator
+{
+    private final static int MARGIN_LEFT = 1;
+    
+    public void generateOutput( Collection<ValidationResult> results, OutputStream out, I18n i18n, I18nFormat format )
+    {
+        WritableCellFormat documentTitle = new WritableCellFormat( new WritableFont( WritableFont.TAHOMA, 15, WritableFont.NO_BOLD, false ) );
+        WritableCellFormat subTitle = new WritableCellFormat( new WritableFont( WritableFont.TAHOMA, 13, WritableFont.NO_BOLD, false ) );
+        WritableCellFormat columnHeader = new WritableCellFormat( new WritableFont( WritableFont.TAHOMA, 11, WritableFont.NO_BOLD, true ) );
+        WritableCellFormat text = new WritableCellFormat( new WritableFont( WritableFont.ARIAL, 11, WritableFont.NO_BOLD, false ) );            
+        
+        try
+        {            
+            WritableWorkbook workbook = Workbook.createWorkbook( out );
+            
+            WritableSheet sheet = workbook.createSheet( "Validation results", 0 );
+            
+            sheet.addCell( new Label( MARGIN_LEFT, 1, i18n.getString( "data_quality_report" ), documentTitle ) );
+            
+            sheet.addCell( new Label( MARGIN_LEFT, 3, i18n.getString( "district_health_information_software" ) + " - " + DateUtils.getMediumDateString(), subTitle ) );
+            
+            int row = 5;
+            
+            sheet.addCell( new Label( MARGIN_LEFT + 0, row, i18n.getString( "source" ), columnHeader ) );
+            sheet.addCell( new Label( MARGIN_LEFT + 1, row, i18n.getString( "period" ), columnHeader ) );
+            sheet.addCell( new Label( MARGIN_LEFT + 2, row, i18n.getString( "left_side_description" ), columnHeader ) );
+            sheet.addCell( new Label( MARGIN_LEFT + 3, row, i18n.getString( "value" ), columnHeader ) );
+            sheet.addCell( new Label( MARGIN_LEFT + 4, row, i18n.getString( "operator" ), columnHeader ) );
+            sheet.addCell( new Label( MARGIN_LEFT + 5, row, i18n.getString( "value" ), columnHeader ) );
+            sheet.addCell( new Label( MARGIN_LEFT + 6, row, i18n.getString( "right_side_description" ), columnHeader ) );
+            
+            row = 7;
+            
+            for ( ValidationResult result : results )
+            {
+                OrganisationUnit unit = (OrganisationUnit) result.getSource();
+                
+                Period period = result.getPeriod();
+                
+                sheet.addCell( new Label( MARGIN_LEFT + 0, row, unit.getName(), text ) );
+                sheet.addCell( new Label( MARGIN_LEFT + 1, row, format.formatPeriod( period ), text ) );
+                sheet.addCell( new Label( MARGIN_LEFT + 2, row, result.getValidationRule().getLeftSide().getDescription(), text ) );
+                sheet.addCell( new Number( MARGIN_LEFT + 3, row, result.getLeftsideValue(), text ) );
+                sheet.addCell( new Label( MARGIN_LEFT + 4, row, i18n.getString( result.getValidationRule().getOperator(), text ) ) );
+                sheet.addCell( new Number( MARGIN_LEFT + 5, row, result.getRightsideValue(), text ) );
+                sheet.addCell( new Label( MARGIN_LEFT + 6, row, result.getValidationRule().getRightSide().getDescription(), text ) );
+                
+                row++;
+            }
+            
+            workbook.write();
+            
+            workbook.close();                        
+        }
+        catch ( IOException ex )
+        {
+            throw new RuntimeException( "Failed to create workbook", ex );
+        }
+        catch ( RowsExceededException ex )
+        {
+            throw new RuntimeException( "Rows exceeded", ex );
+        }
+        catch ( WriteException ex )
+        {
+            throw new RuntimeException( "Write failed", ex );
+        }
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/pom.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/pom.xml	2009-04-22 21:31:10 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/pom.xml	2009-04-24 12:59:52 +0000
@@ -35,6 +35,10 @@
     </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-reporting</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-support-system</artifactId>
     </dependency>
     <dependency>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultPDFAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultPDFAction.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultPDFAction.java	2009-04-24 12:59:52 +0000
@@ -27,18 +27,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
 import java.util.Collection;
 
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.util.SessionUtils;
 import org.hisp.dhis.validation.ValidationResult;
-import org.hisp.dhis.validationrule.util.OutputGeneratorPipeThread;
-import org.hisp.dhis.validationrule.util.ValidationResultPDFGenerator;
+import org.hisp.dhis.validation.generator.ValidationResultOutputGenerator;
+import org.hisp.dhis.validation.generator.ValidationResultPDFGenerator;
 
 import com.opensymphony.xwork.ActionSupport;
 
@@ -91,32 +90,14 @@
         Collection<ValidationResult> results = (Collection<ValidationResult>) SessionUtils.
             getSessionVar( KEY_VALIDATIONRESULT );
         
-        if ( results != null )
-        {
-            // -----------------------------------------------------------------
-            // Pipes are input/output pairs. Data written on the output stream 
-            // shows up on the input stream at the other end of the pipe. 
-            // -----------------------------------------------------------------
-            
-            PipedOutputStream out = new PipedOutputStream();
-            
-            PipedInputStream in = new PipedInputStream( out );
-            
-            OutputGeneratorPipeThread thread = new OutputGeneratorPipeThread();
-            
-            thread.setValidationResults( results );
-            thread.setOutputStream( out );
-            thread.setI18n( i18n );
-            thread.setFormat( format );
-            thread.setOutputGenerator( new ValidationResultPDFGenerator() );
-            
-            thread.start();
-            
-            inputStream = new BufferedInputStream( in );
-            
-            return SUCCESS;
-        }
+        ValidationResultOutputGenerator generator = new ValidationResultPDFGenerator();
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
         
-        return NONE;
+        generator.generateOutput( results, out, i18n, format );
+
+        inputStream = new ByteArrayInputStream( out.toByteArray() );
+                
+        return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.java	2009-04-24 12:59:52 +0000
@@ -27,18 +27,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
 import java.util.Collection;
 
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.util.SessionUtils;
 import org.hisp.dhis.validation.ValidationResult;
-import org.hisp.dhis.validationrule.util.OutputGeneratorPipeThread;
-import org.hisp.dhis.validationrule.util.ValidationResultWorkbookGenerator;
+import org.hisp.dhis.validation.generator.ValidationResultOutputGenerator;
+import org.hisp.dhis.validation.generator.ValidationResultWorkbookGenerator;
 
 import com.opensymphony.xwork.Action;
 
@@ -91,32 +90,14 @@
         Collection<ValidationResult> results = (Collection<ValidationResult>) SessionUtils.
             getSessionVar( KEY_VALIDATIONRESULT );
         
-        if ( results != null )
-        {
-            // -----------------------------------------------------------------
-            // Pipes are input/output pairs. Data written on the output stream 
-            // shows up on the input stream at the other end of the pipe. 
-            // -----------------------------------------------------------------
-            
-            PipedOutputStream out = new PipedOutputStream();
-            
-            PipedInputStream in = new PipedInputStream( out );
-            
-            OutputGeneratorPipeThread thread = new OutputGeneratorPipeThread();
-            
-            thread.setValidationResults( results );
-            thread.setOutputStream( out );
-            thread.setI18n( i18n );
-            thread.setFormat( format );
-            thread.setOutputGenerator( new ValidationResultWorkbookGenerator() );
-            
-            thread.start();
-            
-            inputStream = new BufferedInputStream( in );
-            
-            return SUCCESS;
-        }
+        ValidationResultOutputGenerator generator = new ValidationResultWorkbookGenerator();
+    
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
         
-        return NONE;
+        generator.generateOutput( results, out, i18n, format );
+    
+        inputStream = new ByteArrayInputStream( out.toByteArray() );
+                
+        return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetFilteredDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetFilteredDataElementsAction.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetFilteredDataElementsAction.java	2009-04-24 12:59:52 +0000
@@ -39,7 +39,6 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataelement.Operand;
 import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
-import org.hisp.dhis.validationrule.util.FilterUtil;
 
 import com.opensymphony.xwork.ActionSupport;
 
@@ -145,7 +144,7 @@
             Collection<DataElement> groupElements = dataElementService.getDataElementGroup( dataElementGroupId )
                 .getMembers();
 
-            dataElements = new ArrayList<DataElement>( FilterUtil.getIntegerDataElements( groupElements ) );
+            dataElements = new ArrayList<DataElement>( getIntegerDataElements( groupElements ) );
         }
 
         Collections.sort( dataElements, dataElementComparator );
@@ -176,4 +175,21 @@
 
         return SUCCESS;
     }
+
+    // TODO use predicate / commons instead
+    
+    private Collection<DataElement> getIntegerDataElements( Collection<DataElement> dataElements )
+    {
+        Iterator<DataElement> iterator = dataElements.iterator();
+        
+        while ( iterator.hasNext() )
+        {
+            if ( !iterator.next().getType().equals( DataElement.TYPE_INT ) )
+            {
+                iterator.remove();
+            }
+        }
+        
+        return dataElements;
+    }
 }

=== removed directory 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util'
=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/FilterUtil.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/FilterUtil.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/FilterUtil.java	1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-package org.hisp.dhis.validationrule.util;
-
-/*
- * Copyright (c) 2004-2007, 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 java.util.Collection;
-import java.util.Iterator;
-
-import org.hisp.dhis.dataelement.DataElement;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class FilterUtil
-{
-    public static Collection<DataElement> getIntegerDataElements( Collection<DataElement> dataElements )
-    {
-        Iterator<DataElement> iterator = dataElements.iterator();
-        
-        while ( iterator.hasNext() )
-        {
-            if ( !iterator.next().getType().equals( DataElement.TYPE_INT ) )
-            {
-                iterator.remove();
-            }
-        }
-        
-        return dataElements;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/OutputGenerator.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/OutputGenerator.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/OutputGenerator.java	1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
-package org.hisp.dhis.validationrule.util;
-
-/*
- * Copyright (c) 2004-2007, 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 java.io.OutputStream;
-import java.util.Collection;
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.validation.ValidationResult;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public interface OutputGenerator
-{
-    void generateOutput( Collection<ValidationResult> results, OutputStream out, I18n i18n, I18nFormat format );
-}

=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/OutputGeneratorPipeThread.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/OutputGeneratorPipeThread.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/OutputGeneratorPipeThread.java	1970-01-01 00:00:00 +0000
@@ -1,105 +0,0 @@
-package org.hisp.dhis.validationrule.util;
-
-/*
- * Copyright (c) 2004-2007, 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 java.io.IOException;
-import java.io.OutputStream;
-import java.util.Collection;
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.validation.ValidationResult;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class OutputGeneratorPipeThread
-    extends Thread
-{
-    // -------------------------------------------------------------------------
-    // Properties
-    // -------------------------------------------------------------------------
-
-    private Collection<ValidationResult> validationResults;
-
-    public void setValidationResults( Collection<ValidationResult> validationResults )
-    {
-        this.validationResults = validationResults;
-    }    
-    
-    private OutputStream outputStream;
-    
-    public void setOutputStream( OutputStream outputStream )
-    {
-        this.outputStream = outputStream;
-    }
-    
-    private I18n i18n;
-
-    public void setI18n( I18n i18n )
-    {
-        this.i18n = i18n;
-    }
-
-    private I18nFormat format;
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-    
-    private OutputGenerator outputGenerator;
-
-    public void setOutputGenerator( OutputGenerator outputGenerator )
-    {
-        this.outputGenerator = outputGenerator;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Thread
-    // -------------------------------------------------------------------------
-
-    public void run()
-    {
-        try
-        {
-            outputGenerator.generateOutput( validationResults, outputStream, i18n, format );
-        }
-        finally
-        {
-            try
-            {
-                outputStream.close();
-            }
-            catch ( IOException ex )
-            {   
-            }
-        }
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/ValidationResultPDFGenerator.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/ValidationResultPDFGenerator.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/ValidationResultPDFGenerator.java	1970-01-01 00:00:00 +0000
@@ -1,104 +0,0 @@
-package org.hisp.dhis.validationrule.util;
-
-/*
- * Copyright (c) 2004-2007, 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 java.io.OutputStream;
-import java.util.Collection;
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.system.util.DateUtils;
-import org.hisp.dhis.system.util.PDFUtils;
-import org.hisp.dhis.validation.ValidationResult;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.pdf.PdfPTable;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class ValidationResultPDFGenerator
-    extends PDFUtils
-        implements OutputGenerator
-{
-    // -------------------------------------------------------------------------
-    // PDF functionality
-    // -------------------------------------------------------------------------
-
-    public void generateOutput( Collection<ValidationResult> results, OutputStream out, I18n i18n, I18nFormat format )
-    {
-        Document document = openDocument( out );
-        
-        PdfPTable table = getPdfPTable( true, 0.19f, 0.13f, 0.21f, 0.07f, 0.12f, 0.07f, 0.21f );
-        
-        table.setHeaderRows( 0 );
-        
-        table.addCell( getHeader3Cell( i18n.getString( "data_quality_report" ), 7 ) );
-
-        table.addCell( getCell( 7, 8 ) );
-        
-        table.addCell( getTextCell( i18n.getString( "district_health_information_software" ) + " - " + DateUtils.getMediumDateString(), 7 ) );
-        
-        table.addCell( getCell( 7, 15 ) );
-        
-        table.addCell( getItalicCell( i18n.getString( "source" ), 1 ) );
-        table.addCell( getItalicCell( i18n.getString( "period" ), 1 ) );
-        table.addCell( getItalicCell( i18n.getString( "left_side_description" ), 1 ) );
-        table.addCell( getItalicCell( i18n.getString( "value" ), 1 ) );
-        table.addCell( getItalicCell( i18n.getString( "operator" ), 1 ) );
-        table.addCell( getItalicCell( i18n.getString( "value" ), 1 ) );
-        table.addCell( getItalicCell( i18n.getString( "right_side_description" ), 1 ) );
-        
-        table.addCell( getCell( 7, 8 ) );
-        
-        if ( results != null )
-        {
-            for ( ValidationResult validationResult : results )
-            {
-                OrganisationUnit unit = (OrganisationUnit) validationResult.getSource();
-                
-                Period period = validationResult.getPeriod();
-                
-                table.addCell( getTextCell( unit.getName() ) );
-                table.addCell( getTextCell( format.formatPeriod( period ) ) );
-                table.addCell( getTextCell( validationResult.getValidationRule().getLeftSide().getDescription() ) );
-                table.addCell( getTextCell( String.valueOf( validationResult.getLeftsideValue() ) ) );
-                table.addCell( getTextCell( i18n.getString( validationResult.getValidationRule().getOperator() ), 1, ALIGN_CENTER ) );
-                table.addCell( getTextCell( String.valueOf( validationResult.getRightsideValue() ) ) );
-                table.addCell( getTextCell( validationResult.getValidationRule().getRightSide().getDescription() ) );                    
-            }
-        }
-        
-        addTableToDocument( document, table );
-        
-        closeDocument( document );
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/ValidationResultWorkbookGenerator.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/ValidationResultWorkbookGenerator.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/util/ValidationResultWorkbookGenerator.java	1970-01-01 00:00:00 +0000
@@ -1,123 +0,0 @@
-package org.hisp.dhis.validationrule.util;
-
-/*
- * Copyright (c) 2004-2007, 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 java.io.IOException;
-import java.io.OutputStream;
-import java.util.Collection;
-
-import jxl.Workbook;
-import jxl.write.Label;
-import jxl.write.Number;
-import jxl.write.WritableCellFormat;
-import jxl.write.WritableFont;
-import jxl.write.WritableSheet;
-import jxl.write.WritableWorkbook;
-import jxl.write.WriteException;
-import jxl.write.biff.RowsExceededException;
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.system.util.DateUtils;
-import org.hisp.dhis.validation.ValidationResult;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class ValidationResultWorkbookGenerator
-    implements OutputGenerator
-{
-    private final static int MARGIN_LEFT = 1;
-    
-    public void generateOutput( Collection<ValidationResult> results, OutputStream out, I18n i18n, I18nFormat format )
-    {
-        WritableCellFormat documentTitle = new WritableCellFormat( new WritableFont( WritableFont.TAHOMA, 15, WritableFont.NO_BOLD, false ) );
-        WritableCellFormat subTitle = new WritableCellFormat( new WritableFont( WritableFont.TAHOMA, 13, WritableFont.NO_BOLD, false ) );
-        WritableCellFormat columnHeader = new WritableCellFormat( new WritableFont( WritableFont.TAHOMA, 11, WritableFont.NO_BOLD, true ) );
-        WritableCellFormat text = new WritableCellFormat( new WritableFont( WritableFont.ARIAL, 11, WritableFont.NO_BOLD, false ) );            
-        
-        try
-        {            
-            WritableWorkbook workbook = Workbook.createWorkbook( out );
-            
-            WritableSheet sheet = workbook.createSheet( "Validation results", 0 );
-            
-            sheet.addCell( new Label( MARGIN_LEFT, 1, i18n.getString( "data_quality_report" ), documentTitle ) );
-            
-            sheet.addCell( new Label( MARGIN_LEFT, 3, i18n.getString( "district_health_information_software" ) + " - " + DateUtils.getMediumDateString(), subTitle ) );
-            
-            int row = 5;
-            
-            sheet.addCell( new Label( MARGIN_LEFT + 0, row, i18n.getString( "source" ), columnHeader ) );
-            sheet.addCell( new Label( MARGIN_LEFT + 1, row, i18n.getString( "period" ), columnHeader ) );
-            sheet.addCell( new Label( MARGIN_LEFT + 2, row, i18n.getString( "left_side_description" ), columnHeader ) );
-            sheet.addCell( new Label( MARGIN_LEFT + 3, row, i18n.getString( "value" ), columnHeader ) );
-            sheet.addCell( new Label( MARGIN_LEFT + 4, row, i18n.getString( "operator" ), columnHeader ) );
-            sheet.addCell( new Label( MARGIN_LEFT + 5, row, i18n.getString( "value" ), columnHeader ) );
-            sheet.addCell( new Label( MARGIN_LEFT + 6, row, i18n.getString( "right_side_description" ), columnHeader ) );
-            
-            row = 7;
-            
-            for ( ValidationResult result : results )
-            {
-                OrganisationUnit unit = (OrganisationUnit) result.getSource();
-                
-                Period period = result.getPeriod();
-                
-                sheet.addCell( new Label( MARGIN_LEFT + 0, row, unit.getName(), text ) );
-                sheet.addCell( new Label( MARGIN_LEFT + 1, row, format.formatPeriod( period ), text ) );
-                sheet.addCell( new Label( MARGIN_LEFT + 2, row, result.getValidationRule().getLeftSide().getDescription(), text ) );
-                sheet.addCell( new Number( MARGIN_LEFT + 3, row, result.getLeftsideValue(), text ) );
-                sheet.addCell( new Label( MARGIN_LEFT + 4, row, i18n.getString( result.getValidationRule().getOperator(), text ) ) );
-                sheet.addCell( new Number( MARGIN_LEFT + 5, row, result.getRightsideValue(), text ) );
-                sheet.addCell( new Label( MARGIN_LEFT + 6, row, result.getValidationRule().getRightSide().getDescription(), text ) );
-                
-                row++;
-            }
-            
-            workbook.write();
-            
-            workbook.close();                        
-        }
-        catch ( IOException ex )
-        {
-            throw new RuntimeException( "Failed to create workbook", ex );
-        }
-        catch ( RowsExceededException ex )
-        {
-            throw new RuntimeException( "Rows exceeded", ex );
-        }
-        catch ( WriteException ex )
-        {
-            throw new RuntimeException( "Write failed", ex );
-        }
-    }
-}



--
Trunk
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.