=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2010-12-11 19:58:29 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2010-12-27 00:21:07 +0000 @@ -29,14 +29,13 @@ import static org.hisp.dhis.system.util.MathUtils.expressionIsTrue; import static org.hisp.dhis.system.util.MathUtils.getRounded; + import java.util.Collection; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.hisp.dhis.common.Grid; import org.hisp.dhis.dataelement.DataElement; @@ -62,8 +61,6 @@ public class DefaultValidationRuleService implements ValidationRuleService { - private static final Log log = LogFactory.getLog( DefaultValidationRuleService.class ); - private static final int DECIMALS = 1; // ------------------------------------------------------------------------- @@ -167,8 +164,6 @@ { validationViolations.addAll( validateInternal( period, source, validationRules, true ) ); } - - log.info( "Validated " + source ); } return validationViolations; @@ -194,8 +189,6 @@ { validationViolations.addAll( validateInternal( period, source, validationRules, true ) ); } - - log.info( "Validated " + source ); } return validationViolations; @@ -218,8 +211,6 @@ validationViolations.addAll( validateInternal( period, source, relevantRules, false ) ); } } - - log.info( "Validated " + source ); } return validationViolations; @@ -244,8 +235,6 @@ validationViolations.addAll( validateInternal( period, source, relevantRules, false ) ); } } - - log.info( "Validated " + source ); } return validationViolations; === modified file 'dhis-2/dhis-services/dhis-service-reporting/pom.xml' --- dhis-2/dhis-services/dhis-service-reporting/pom.xml 2010-08-20 09:13:09 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/pom.xml 2010-12-27 00:21:07 +0000 @@ -53,10 +53,6 @@ jep - net.sourceforge.jexcelapi - jxl - - commons-math commons-math === removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf' === removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/PdfService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/PdfService.java 2010-12-26 23:25:10 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/PdfService.java 1970-01-01 00:00:00 +0000 @@ -1,46 +0,0 @@ -package org.hisp.dhis.pdf; - -/* - * Copyright (c) 2004-2010, 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.List; - -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 PdfService -{ - String ID = PdfService.class.getName(); - - void writeValidationResult( List results, OutputStream out, I18n i18n, I18nFormat format ); -} === removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl' === removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java 2010-12-26 23:25:10 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java 1970-01-01 00:00:00 +0000 @@ -1,118 +0,0 @@ -package org.hisp.dhis.pdf.impl; - -/* - * Copyright (c) 2004-2010, 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 static org.hisp.dhis.system.util.PDFUtils.addTableToDocument; -import static org.hisp.dhis.system.util.PDFUtils.closeDocument; -import static org.hisp.dhis.system.util.PDFUtils.getEmptyCell; -import static org.hisp.dhis.system.util.PDFUtils.getItalicCell; -import static org.hisp.dhis.system.util.PDFUtils.getPdfPTable; -import static org.hisp.dhis.system.util.PDFUtils.getSubtitleCell; -import static org.hisp.dhis.system.util.PDFUtils.getTextCell; -import static org.hisp.dhis.system.util.PDFUtils.getTitleCell; -import static org.hisp.dhis.system.util.PDFUtils.openDocument; - -import java.io.OutputStream; -import java.util.List; - -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.i18n.I18nFormat; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.pdf.PdfService; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.system.util.DateUtils; -import org.hisp.dhis.validation.ValidationResult; -import org.springframework.transaction.annotation.Transactional; - -import com.lowagie.text.Document; -import com.lowagie.text.pdf.PdfPTable; - -/** - * @author Lars Helge Overland - * @version $Id$ - * @modifier Dang Duy Hieu - * @since 2010-05-20 - */ -@Transactional -public class ItextPdfService - implements PdfService -{ - // ------------------------------------------------------------------------- - // PdfService implementation - // ------------------------------------------------------------------------- - - public void writeValidationResult( List 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( getTitleCell( i18n.getString( "data_quality_report" ), 7 ) ); - - table.addCell( getEmptyCell( 7, 10 ) ); - - table.addCell( getSubtitleCell( i18n.getString( "district_health_information_software" ) + " - " - + format.parseDate( DateUtils.getMediumDateString() ), 7) ); - - table.addCell( getEmptyCell( 7, 25 ) ); - - table.addCell( getItalicCell( i18n.getString( "source" ) ) ); - table.addCell( getItalicCell( i18n.getString( "period" ) ) ); - table.addCell( getItalicCell( i18n.getString( "left_side_description" ) ) ); - table.addCell( getItalicCell( i18n.getString( "value" ) ) ); - table.addCell( getItalicCell( i18n.getString( "operator" ) ) ); - table.addCell( getItalicCell( i18n.getString( "value" ) ) ); - table.addCell( getItalicCell( i18n.getString( "right_side_description" ) ) ); - - table.addCell( getEmptyCell( 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() ) ) ); - table.addCell( getTextCell( String.valueOf( validationResult.getRightsideValue() ) ) ); - table.addCell( getTextCell( validationResult.getValidationRule().getRightSide().getDescription() ) ); - } - } - - addTableToDocument( document, table ); - - closeDocument( document ); - } -} === removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/workbook' === removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/workbook/WorkbookService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/workbook/WorkbookService.java 2010-12-26 23:25:10 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/workbook/WorkbookService.java 1970-01-01 00:00:00 +0000 @@ -1,46 +0,0 @@ -package org.hisp.dhis.workbook; - -/* - * Copyright (c) 2004-2010, 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.List; - -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 WorkbookService -{ - String ID = WorkbookService.class.getName(); - - void writeValidationResult( List results, OutputStream out, I18n i18n, I18nFormat format ); -} === removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/workbook/impl' === removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/workbook/impl/JExcelWorkbookService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/workbook/impl/JExcelWorkbookService.java 2010-12-26 23:25:10 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/workbook/impl/JExcelWorkbookService.java 1970-01-01 00:00:00 +0000 @@ -1,142 +0,0 @@ -package org.hisp.dhis.workbook.impl; - -/* - * Copyright (c) 2004-2010, 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.List; - -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; -import org.hisp.dhis.workbook.WorkbookService; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -@Transactional -public class JExcelWorkbookService - implements WorkbookService -{ - // ------------------------------------------------------------------------- - // WorkbookService implementation - // ------------------------------------------------------------------------- - - public void writeValidationResult( List results, OutputStream out, I18n i18n, I18nFormat format ) - { - final int MARGIN_LEFT = 1; - - 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; - - if ( results != null ) - { - 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-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-12-26 16:55:25 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-12-27 00:21:07 +0000 @@ -188,16 +188,6 @@ - - - - - - - - results = (List) SessionUtils. + getSessionVar( KEY_VALIDATIONRESULT ); + + Grid grid = new ListGrid(); + + grid.setTitle( i18n.getString( "data_quality_report" ) ); + //TODO subtitle + + grid.addHeader( i18n.getString( "source" ) ); + grid.addHeader( i18n.getString( "period" ) ); + grid.addHeader( i18n.getString( "left_side_description" ) ); + grid.addHeader( i18n.getString( "value" ) ); + grid.addHeader( i18n.getString( "operator" ) ); + grid.addHeader( i18n.getString( "value" ) ); + grid.addHeader( i18n.getString( "right_side_description" ) ); + + for ( ValidationResult validationResult : results ) + { + OrganisationUnit unit = (OrganisationUnit) validationResult.getSource(); + Period period = validationResult.getPeriod(); + + grid.nextRow(); + grid.addValue( unit.getName() ); + grid.addValue( format.formatPeriod( period ) ); + grid.addValue( validationResult.getValidationRule().getLeftSide().getDescription() ); //TODO lazy prone + grid.addValue( String.valueOf( validationResult.getLeftsideValue() ) ); + grid.addValue( i18n.getString( validationResult.getValidationRule().getOperator() ) ); + grid.addValue( String.valueOf( validationResult.getRightsideValue() ) ); + grid.addValue( validationResult.getValidationRule().getRightSide().getDescription() ); + } + + return grid; + } +} === removed 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 2010-08-30 06:24:45 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultPDFAction.java 1970-01-01 00:00:00 +0000 @@ -1,107 +0,0 @@ -package org.hisp.dhis.validationrule.action; - -/* - * Copyright (c) 2004-2010, 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.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.util.List; - -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.i18n.I18nFormat; -import org.hisp.dhis.pdf.PdfService; -import org.hisp.dhis.util.SessionUtils; -import org.hisp.dhis.validation.ValidationResult; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -public class GenerateValidationResultPDFAction - extends ActionSupport -{ - private static final String KEY_VALIDATIONRESULT = "validationResult"; - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private PdfService pdfService; - - public void setPdfService( PdfService pdfService ) - { - this.pdfService = pdfService; - } - - private I18nFormat format; - - public void setFormat( I18nFormat format ) - { - this.format = format; - } - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private InputStream inputStream; - - public InputStream getInputStream() - { - return inputStream; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - @SuppressWarnings( "unchecked" ) - public String execute() - throws Exception - { - List results = (List) SessionUtils. - getSessionVar( KEY_VALIDATIONRESULT ); - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - - pdfService.writeValidationResult( results, out, i18n, format ); - - inputStream = new ByteArrayInputStream( out.toByteArray() ); - - return SUCCESS; - } -} === removed 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 2010-08-30 06:24:45 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GenerateValidationResultWorkbookAction.java 1970-01-01 00:00:00 +0000 @@ -1,107 +0,0 @@ -package org.hisp.dhis.validationrule.action; - -/* - * Copyright (c) 2004-2010, 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.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.util.List; - -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.workbook.WorkbookService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -public class GenerateValidationResultWorkbookAction - implements Action -{ - private static final String KEY_VALIDATIONRESULT = "validationResult"; - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private WorkbookService workbookService; - - public void setWorkbookService( WorkbookService workbookService ) - { - this.workbookService = workbookService; - } - - private I18nFormat format; - - public void setFormat( I18nFormat format ) - { - this.format = format; - } - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private InputStream inputStream; - - public InputStream getInputStream() - { - return inputStream; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - @SuppressWarnings( "unchecked" ) - public String execute() - throws Exception - { - List results = (List) SessionUtils. - getSessionVar( KEY_VALIDATIONRESULT ); - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - - workbookService.writeValidationResult( results, out, i18n, format ); - - inputStream = new ByteArrayInputStream( out.toByteArray() ); - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml 2010-12-09 05:53:20 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml 2010-12-27 00:21:07 +0000 @@ -230,21 +230,9 @@ - - - - - - - - - - - + === modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties 2010-12-09 06:15:40 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties 2010-12-27 00:21:07 +0000 @@ -142,4 +142,7 @@ description_not_null = Please specify a description expression_not_null = Please specify an expression number_of_members = Number of menbers -specify_organisationunit_has_children = Please specify an organisationunit which has children. \ No newline at end of file +specify_organisationunit_has_children = Please specify an organisationunit which has children. +get_report_as_xls = Download as Excel +get_report_as_csv = Download as CSV +get_report_as_pdf = Download as PDF \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2010-12-09 05:53:20 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2010-12-27 00:21:07 +0000 @@ -163,28 +163,15 @@ /popup.vm /dhis-web-validationrule/viewValidationResultDetailsForm.vm - - - - - application/pdf - inputStream - filename="ValidationReport.pdf" - 10240 - - showRunValidationForm.action - - - - - application/vnd.ms-excel - inputStream - filename="ValidationReport.xls" - 10240 - - showRunValidationForm.action - - + javascript/runValidation.js + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js' --- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js 2010-09-22 09:14:07 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js 2010-12-27 00:21:07 +0000 @@ -124,3 +124,9 @@ button.onclick = function() { showAggregateResults(); }; button.value = "See statistics"; } + +function exportValidationResult( type ) +{ + window.location.href = 'exportValidationResult.action?type=' + type; +} + === modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm' --- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm 2010-09-06 10:24:08 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm 2010-12-27 00:21:07 +0000 @@ -7,28 +7,24 @@ - + $i18n.getString( "start_date" ): $startDate - - - - + + + #if( $aggregate )#end $i18n.getString( "end_date" ): $endDate - - - #if( $aggregate )#end + + + - + #if ( $validationResults.size() == 0 )