dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00845
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 254: Simplified the way PDF and XLS are written for the completeness functionality + moved code from t...
------------------------------------------------------------
revno: 254
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-04-24 14:42:45 +0200
message:
Simplified the way PDF and XLS are written for the completeness functionality + moved code from the web layer to the service layer
removed:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/pdf/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/pdf/DataCompletenessPDFGenerator.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/OutputGenerator.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/OutputGeneratorPipeThread.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/workbook/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/workbook/DataCompletenessWorkbookGenerator.java
added:
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessOutputGenerator.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessPDFGenerator.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessWorkbookGenerator.java
modified:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessPDFAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessWorkbookAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml
docs/Technical Architecture DHIS 2.doc
=== added directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator'
=== added file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessOutputGenerator.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessOutputGenerator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessOutputGenerator.java 2009-04-24 12:42:45 +0000
@@ -0,0 +1,46 @@
+package org.hisp.dhis.completeness.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.organisationunit.OrganisationUnit;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.completeness.DataSetCompletenessResult;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public interface DataCompletenessOutputGenerator
+{
+ void generateOutput( Collection<DataSetCompletenessResult> results, OutputStream out,
+ I18n i18n, OrganisationUnit unit, DataSet dataSet );
+}
=== added file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessPDFGenerator.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessPDFGenerator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessPDFGenerator.java 2009-04-24 12:42:45 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.completeness.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.dataset.DataSet;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.completeness.DataSetCompletenessResult;
+import org.hisp.dhis.system.util.DateUtils;
+import org.hisp.dhis.system.util.PDFUtils;
+
+import com.lowagie.text.Document;
+import com.lowagie.text.pdf.PdfPTable;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class DataCompletenessPDFGenerator
+ extends PDFUtils
+ implements DataCompletenessOutputGenerator
+{
+ public void generateOutput( Collection<DataSetCompletenessResult> results, OutputStream out, I18n i18n, OrganisationUnit unit, DataSet dataSet )
+ {
+ Document document = openDocument( out );
+
+ PdfPTable table = getPdfPTable( true, 0.501f, 0.10f, 0.10f, 0.10f, 0.10f, 0.10f );
+
+ table.setHeaderRows( 1 );
+
+ String dataSetName = dataSet != null ? " - " + dataSet.getName() : "";
+
+ table.addCell( getHeader3Cell( i18n.getString( "data_completeness_report" ) + " - " + unit.getName() + dataSetName, 6 ) );
+
+ table.addCell( getCell( 6, 8 ) );
+
+ table.addCell( getTextCell( i18n.getString( "district_health_information_software" ) + " - " + DateUtils.getMediumDateString(), 6 ) );
+
+ table.addCell( getCell( 6, 15 ) );
+
+ table.addCell( getItalicCell( i18n.getString( "name" ), 1 ) );
+ table.addCell( getItalicCell( i18n.getString( "actual" ), 1 ) );
+ table.addCell( getItalicCell( i18n.getString( "target" ), 1 ) );
+ table.addCell( getItalicCell( i18n.getString( "percent" ), 1 ) );
+ table.addCell( getItalicCell( i18n.getString( "on_time" ), 1 ) );
+ table.addCell( getItalicCell( i18n.getString( "percent" ), 1 ) );
+
+ table.addCell( getCell( 6, 8 ) );
+
+ if ( results != null )
+ {
+ for ( DataSetCompletenessResult result : results )
+ {
+ table.addCell( getTextCell( result.getName() ) );
+ table.addCell( getTextCell( String.valueOf( result.getRegistrations() ) ) );
+ table.addCell( getTextCell( String.valueOf( result.getSources() ) ) );
+ table.addCell( getTextCell( String.valueOf( result.getPercentage() ) ) );
+ table.addCell( getTextCell( String.valueOf( result.getRegistrationsOnTime() ) ) );
+ table.addCell( getTextCell( String.valueOf( result.getPercentageOnTime() ) ) );
+ }
+ }
+
+ addTableToDocument( document, table );
+
+ closeDocument( document );
+ }
+}
=== added file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessWorkbookGenerator.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessWorkbookGenerator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/generator/DataCompletenessWorkbookGenerator.java 2009-04-24 12:42:45 +0000
@@ -0,0 +1,118 @@
+package org.hisp.dhis.completeness.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.dataset.DataSet;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.completeness.DataSetCompletenessResult;
+import org.hisp.dhis.system.util.DateUtils;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class DataCompletenessWorkbookGenerator
+ implements DataCompletenessOutputGenerator
+{
+ private final static int MARGIN_LEFT = 1;
+
+ public void generateOutput( Collection<DataSetCompletenessResult> results, OutputStream out, I18n i18n, OrganisationUnit unit, DataSet dataSet )
+ {
+ 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( "Data completeness", 0 );
+
+ String dataSetName = dataSet != null ? " - " + dataSet.getName() : "";
+
+ sheet.addCell( new Label( MARGIN_LEFT, 1, i18n.getString( "data_completeness_report" ) + " - " + unit.getName() + dataSetName, 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, row, i18n.getString( "name" ), columnHeader ) );
+ sheet.addCell( new Label( MARGIN_LEFT + 1, row, i18n.getString( "actual" ), columnHeader ) );
+ sheet.addCell( new Label( MARGIN_LEFT + 2, row, i18n.getString( "target" ), columnHeader ) );
+ sheet.addCell( new Label( MARGIN_LEFT + 3, row, i18n.getString( "percent" ), columnHeader ) );
+ sheet.addCell( new Label( MARGIN_LEFT + 4, row, i18n.getString( "on_time" ), columnHeader ) );
+ sheet.addCell( new Label( MARGIN_LEFT + 5, row, i18n.getString( "percent" ), columnHeader ) );
+
+ row = 7;
+
+ for ( DataSetCompletenessResult result : results )
+ {
+ sheet.addCell( new Label( MARGIN_LEFT, row, result.getName(), text ) );
+ sheet.addCell( new Number( MARGIN_LEFT + 1, row, result.getRegistrations(), text ) );
+ sheet.addCell( new Number( MARGIN_LEFT + 2, row, result.getSources(), text ) );
+ sheet.addCell( new Number( MARGIN_LEFT + 3, row, result.getPercentage(), text ) );
+ sheet.addCell( new Number( MARGIN_LEFT + 4, row, result.getRegistrationsOnTime(), text ) );
+ sheet.addCell( new Number( MARGIN_LEFT + 5, row, result.getPercentageOnTime(), 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-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessPDFAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessPDFAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessPDFAction.java 2009-04-24 12:42:45 +0000
@@ -27,19 +27,18 @@
* 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.completeness.DataSetCompletenessResult;
+import org.hisp.dhis.completeness.generator.DataCompletenessOutputGenerator;
+import org.hisp.dhis.completeness.generator.DataCompletenessPDFGenerator;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
-import org.hisp.dhis.completeness.DataSetCompletenessResult;
-import org.hisp.dhis.reporting.completeness.pdf.DataCompletenessPDFGenerator;
-import org.hisp.dhis.reporting.completeness.util.OutputGeneratorPipeThread;
import org.hisp.dhis.util.SessionUtils;
import com.opensymphony.xwork.Action;
@@ -98,33 +97,14 @@
OrganisationUnit unit = selectionTreeManager.getSelectedOrganisationUnit();
- if ( results != null && unit != 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.setCompletenessResults( results );
- thread.setOutputStream( out );
- thread.setI18n( i18n );
- thread.setOrganisationUnit( unit );
- thread.setDataSet( dataSet );
- thread.setOutputGenerator( new DataCompletenessPDFGenerator() );
-
- thread.start();
+ DataCompletenessOutputGenerator generator = new DataCompletenessPDFGenerator();
- inputStream = new BufferedInputStream( in );
-
- return SUCCESS;
- }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
- return NONE;
+ generator.generateOutput( results, out, i18n, unit, dataSet );
+
+ inputStream = new ByteArrayInputStream( out.toByteArray() );
+
+ return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessWorkbookAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessWorkbookAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessWorkbookAction.java 2009-04-24 12:42:45 +0000
@@ -27,19 +27,18 @@
* 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.completeness.DataSetCompletenessResult;
+import org.hisp.dhis.completeness.generator.DataCompletenessOutputGenerator;
+import org.hisp.dhis.completeness.generator.DataCompletenessWorkbookGenerator;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
-import org.hisp.dhis.completeness.DataSetCompletenessResult;
-import org.hisp.dhis.reporting.completeness.util.OutputGeneratorPipeThread;
-import org.hisp.dhis.reporting.completeness.workbook.DataCompletenessWorkbookGenerator;
import org.hisp.dhis.util.SessionUtils;
import com.opensymphony.xwork.Action;
@@ -98,34 +97,14 @@
OrganisationUnit unit = selectionTreeManager.getSelectedOrganisationUnit();
- if ( results != null && unit != 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.setCompletenessResults( results );
- thread.setOutputStream( out );
- thread.setI18n( i18n );
- thread.setOrganisationUnit( unit );
- thread.setDataSet( dataSet );
- thread.setOutputGenerator( new DataCompletenessWorkbookGenerator() );
-
- thread.start();
-
- inputStream = new BufferedInputStream( in );
-
- return SUCCESS;
- }
-
- return NONE;
+ DataCompletenessOutputGenerator generator = new DataCompletenessWorkbookGenerator();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ generator.generateOutput( results, out, i18n, unit, dataSet );
+
+ inputStream = new ByteArrayInputStream( out.toByteArray() );
+
+ return SUCCESS;
}
}
-
=== removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/pdf'
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/pdf/DataCompletenessPDFGenerator.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/pdf/DataCompletenessPDFGenerator.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/pdf/DataCompletenessPDFGenerator.java 1970-01-01 00:00:00 +0000
@@ -1,96 +0,0 @@
-package org.hisp.dhis.reporting.completeness.pdf;
-
-/*
- * 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.dataset.DataSet;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.completeness.DataSetCompletenessResult;
-import org.hisp.dhis.reporting.completeness.util.OutputGenerator;
-import org.hisp.dhis.system.util.DateUtils;
-import org.hisp.dhis.system.util.PDFUtils;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.pdf.PdfPTable;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class DataCompletenessPDFGenerator
- extends PDFUtils
- implements OutputGenerator
-{
- public void generateOutput( Collection<DataSetCompletenessResult> results, OutputStream out, I18n i18n, OrganisationUnit unit, DataSet dataSet )
- {
- Document document = openDocument( out );
-
- PdfPTable table = getPdfPTable( true, 0.501f, 0.10f, 0.10f, 0.10f, 0.10f, 0.10f );
-
- table.setHeaderRows( 1 );
-
- String dataSetName = dataSet != null ? " - " + dataSet.getName() : "";
-
- table.addCell( getHeader3Cell( i18n.getString( "data_completeness_report" ) + " - " + unit.getName() + dataSetName, 6 ) );
-
- table.addCell( getCell( 6, 8 ) );
-
- table.addCell( getTextCell( i18n.getString( "district_health_information_software" ) + " - " + DateUtils.getMediumDateString(), 6 ) );
-
- table.addCell( getCell( 6, 15 ) );
-
- table.addCell( getItalicCell( i18n.getString( "name" ), 1 ) );
- table.addCell( getItalicCell( i18n.getString( "actual" ), 1 ) );
- table.addCell( getItalicCell( i18n.getString( "target" ), 1 ) );
- table.addCell( getItalicCell( i18n.getString( "percent" ), 1 ) );
- table.addCell( getItalicCell( i18n.getString( "on_time" ), 1 ) );
- table.addCell( getItalicCell( i18n.getString( "percent" ), 1 ) );
-
- table.addCell( getCell( 6, 8 ) );
-
- if ( results != null )
- {
- for ( DataSetCompletenessResult result : results )
- {
- table.addCell( getTextCell( result.getName() ) );
- table.addCell( getTextCell( String.valueOf( result.getRegistrations() ) ) );
- table.addCell( getTextCell( String.valueOf( result.getSources() ) ) );
- table.addCell( getTextCell( String.valueOf( result.getPercentage() ) ) );
- table.addCell( getTextCell( String.valueOf( result.getRegistrationsOnTime() ) ) );
- table.addCell( getTextCell( String.valueOf( result.getPercentageOnTime() ) ) );
- }
- }
-
- addTableToDocument( document, table );
-
- closeDocument( document );
- }
-}
=== removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util'
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/OutputGenerator.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/OutputGenerator.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/OutputGenerator.java 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-package org.hisp.dhis.reporting.completeness.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.organisationunit.OrganisationUnit;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.completeness.DataSetCompletenessResult;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public interface OutputGenerator
-{
- void generateOutput( Collection<DataSetCompletenessResult> results, OutputStream out,
- I18n i18n, OrganisationUnit unit, DataSet dataSet );
-}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/OutputGeneratorPipeThread.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/OutputGeneratorPipeThread.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/util/OutputGeneratorPipeThread.java 1970-01-01 00:00:00 +0000
@@ -1,121 +0,0 @@
-package org.hisp.dhis.reporting.completeness.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.dataset.DataSet;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.completeness.DataSetCompletenessResult;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class OutputGeneratorPipeThread
- extends Thread
-{
- // -------------------------------------------------------------------------
- // Properties
- // -------------------------------------------------------------------------
-
- private Collection<DataSetCompletenessResult> completenessResults;
-
- public void setCompletenessResults( Collection<DataSetCompletenessResult> completenessResults )
- {
- this.completenessResults = completenessResults;
- }
-
- private OutputStream outputStream;
-
- public void setOutputStream( OutputStream outputStream )
- {
- this.outputStream = outputStream;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- private OrganisationUnit organisationUnit;
-
- public void setOrganisationUnit( OrganisationUnit organisationUnit )
- {
- this.organisationUnit = organisationUnit;
- }
-
- private DataSet dataSet;
-
- public void setDataSet( DataSet dataSet )
- {
- this.dataSet = dataSet;
- }
-
- private OutputGenerator outputGenerator;
-
- public void setOutputGenerator( OutputGenerator outputGenerator )
- {
- this.outputGenerator = outputGenerator;
- }
-
- // -------------------------------------------------------------------------
- // Constructor
- // -------------------------------------------------------------------------
-
- public OutputGeneratorPipeThread()
- {
- }
-
- // -------------------------------------------------------------------------
- // Thread
- // -------------------------------------------------------------------------
-
- public void run()
- {
- try
- {
- outputGenerator.generateOutput( completenessResults, outputStream, i18n, organisationUnit, dataSet );
- }
- finally
- {
- try
- {
- outputStream.close();
- }
- catch ( IOException ex )
- {
- }
- }
- }
-}
=== removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/workbook'
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/workbook/DataCompletenessWorkbookGenerator.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/workbook/DataCompletenessWorkbookGenerator.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/workbook/DataCompletenessWorkbookGenerator.java 1970-01-01 00:00:00 +0000
@@ -1,119 +0,0 @@
-package org.hisp.dhis.reporting.completeness.workbook;
-
-/*
- * 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.dataset.DataSet;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.completeness.DataSetCompletenessResult;
-import org.hisp.dhis.reporting.completeness.util.OutputGenerator;
-import org.hisp.dhis.system.util.DateUtils;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class DataCompletenessWorkbookGenerator
- implements OutputGenerator
-{
- private final static int MARGIN_LEFT = 1;
-
- public void generateOutput( Collection<DataSetCompletenessResult> results, OutputStream out, I18n i18n, OrganisationUnit unit, DataSet dataSet )
- {
- 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( "Data completeness", 0 );
-
- String dataSetName = dataSet != null ? " - " + dataSet.getName() : "";
-
- sheet.addCell( new Label( MARGIN_LEFT, 1, i18n.getString( "data_completeness_report" ) + " - " + unit.getName() + dataSetName, 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, row, i18n.getString( "name" ), columnHeader ) );
- sheet.addCell( new Label( MARGIN_LEFT + 1, row, i18n.getString( "actual" ), columnHeader ) );
- sheet.addCell( new Label( MARGIN_LEFT + 2, row, i18n.getString( "target" ), columnHeader ) );
- sheet.addCell( new Label( MARGIN_LEFT + 3, row, i18n.getString( "percent" ), columnHeader ) );
- sheet.addCell( new Label( MARGIN_LEFT + 4, row, i18n.getString( "on_time" ), columnHeader ) );
- sheet.addCell( new Label( MARGIN_LEFT + 5, row, i18n.getString( "percent" ), columnHeader ) );
-
- row = 7;
-
- for ( DataSetCompletenessResult result : results )
- {
- sheet.addCell( new Label( MARGIN_LEFT, row, result.getName(), text ) );
- sheet.addCell( new Number( MARGIN_LEFT + 1, row, result.getRegistrations(), text ) );
- sheet.addCell( new Number( MARGIN_LEFT + 2, row, result.getSources(), text ) );
- sheet.addCell( new Number( MARGIN_LEFT + 3, row, result.getPercentage(), text ) );
- sheet.addCell( new Number( MARGIN_LEFT + 4, row, result.getRegistrationsOnTime(), text ) );
- sheet.addCell( new Number( MARGIN_LEFT + 5, row, result.getPercentageOnTime(), 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-reporting/src/main/resources/xwork.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml 2009-04-16 10:07:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml 2009-04-24 12:42:45 +0000
@@ -286,8 +286,6 @@
<param name="contentDisposition">filename="DataCompletenessReport.pdf"</param>
<param name="bufferSize">10240</param>
</result>
- <result name="none" type="redirect">displayViewDataCompletenessForm.action</result>
- <interceptor-ref name="transactionStack"/>
</action>
<action name="getDataCompletenessWorkbook" class="org.hisp.dhis.reporting.completeness.action.GetDataCompletenessWorkbookAction">
@@ -297,8 +295,6 @@
<param name="contentDisposition">filename="DataCompletenessReport.xls"</param>
<param name="bufferSize">10240</param>
</result>
- <result name="none" type="redirect">displayViewDataCompletenessForm.action</result>
- <interceptor-ref name="transactionStack"/>
</action>
<action name="displayConfigureDataCompletenessForm" class="org.hisp.dhis.reporting.completeness.action.GetDataCompletenessConfigurationAction">
=== modified file 'docs/Technical Architecture DHIS 2.doc'
Binary files docs/Technical Architecture DHIS 2.doc 2009-04-24 10:42:55 +0000 and docs/Technical Architecture DHIS 2.doc 2009-04-24 12:42:45 +0000 differ
--
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.