← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2426: Removed unused code

 

------------------------------------------------------------
revno: 2426
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2010-12-26 17:55:25 +0100
message:
  Removed unused code
removed:
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/PdfServiceTest.java
modified:
  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/impl/ItextPdfService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-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-10-28 09:17:13 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/PdfService.java	2010-12-26 16:55:25 +0000
@@ -46,12 +46,6 @@
 {
     String ID = PdfService.class.getName();
 
-    void writeAllDataElements( OutputStream outputStream, I18n i18n );
-
-    void writeAllIndicators( OutputStream outputStream, I18n i18n );
-
-    void writeAllOrganisationUnits( OutputStream outputStream, I18n i18n, I18nFormat format );
-
     void writeDataSetCompletenessResult( Collection<DataSetCompletenessResult> results, OutputStream out, I18n i18n,
         OrganisationUnit unit, DataSet dataSet );
 

=== modified 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-10-28 09:17:13 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java	2010-12-26 16:55:25 +0000
@@ -37,29 +37,19 @@
 import static org.hisp.dhis.system.util.PDFUtils.getTextCell;
 import static org.hisp.dhis.system.util.PDFUtils.getTrueTypeFontByDimension;
 import static org.hisp.dhis.system.util.PDFUtils.openDocument;
-import static org.hisp.dhis.system.util.PDFUtils.printDataElement;
-import static org.hisp.dhis.system.util.PDFUtils.printIndicator;
-import static org.hisp.dhis.system.util.PDFUtils.printOrganisationUnit;
 
 import java.io.OutputStream;
 import java.util.Collection;
 import java.util.List;
 
 import org.hisp.dhis.completeness.DataSetCompletenessResult;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.pdf.PdfService;
 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 org.springframework.transaction.annotation.Transactional;
 
@@ -91,82 +81,9 @@
     private static Font HEADER3;
 
     // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private IndicatorService indicatorService;
-
-    public void setIndicatorService( IndicatorService indicatorService )
-    {
-        this.indicatorService = indicatorService;
-    }
-
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    private ExpressionService expressionService;
-
-    public void setExpressionService( ExpressionService expressionService )
-    {
-        this.expressionService = expressionService;
-    }
-
-    // -------------------------------------------------------------------------
     // PdfService implementation
     // -------------------------------------------------------------------------
 
-    public void writeAllDataElements( OutputStream outputStream, I18n i18n )
-    {
-        initFont();
-        Document document = PDFUtils.openDocument( outputStream );
-
-        for ( DataElement element : dataElementService.getAllDataElements() )
-        {
-            addTableToDocument( document, printDataElement( element, i18n, HEADER3, ITALIC, TEXT, true, 0.40f, 0.60f ) );
-        }
-
-        PDFUtils.closeDocument( document );
-    }
-
-    public void writeAllIndicators( OutputStream outputStream, I18n i18n )
-    {
-        initFont();
-        Document document = PDFUtils.openDocument( outputStream );
-
-        for ( Indicator indicator : indicatorService.getAllIndicators() )
-        {
-            addTableToDocument( document, printIndicator( indicator, i18n, expressionService, HEADER3, ITALIC, TEXT,
-                true, 0.40f, 0.60f ) );
-        }
-
-        PDFUtils.closeDocument( document );
-    }
-
-    public void writeAllOrganisationUnits( OutputStream outputStream, I18n i18n, I18nFormat format )
-    {
-        initFont();
-        Document document = PDFUtils.openDocument( outputStream );
-
-        for ( OrganisationUnit unit : organisationUnitService.getAllOrganisationUnits() )
-        {
-            addTableToDocument( document, printOrganisationUnit( unit, i18n, format, HEADER3, ITALIC, TEXT, true,
-                0.40f, 0.60f ) );
-        }
-
-        PDFUtils.closeDocument( document );
-    }
-
     public void writeDataSetCompletenessResult( Collection<DataSetCompletenessResult> results, OutputStream out,
         I18n i18n, OrganisationUnit unit, DataSet dataSet )
     {

=== 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 15:38:45 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2010-12-26 16:55:25 +0000
@@ -191,16 +191,7 @@
   <!-- PDF -->
   
   <bean id="org.hisp.dhis.pdf.PdfService"
-    class="org.hisp.dhis.pdf.impl.ItextPdfService">
-    <property name="dataElementService"
-      ref="org.hisp.dhis.dataelement.DataElementService"/>
-    <property name="indicatorService"
-      ref="org.hisp.dhis.indicator.IndicatorService"/>
-    <property name="organisationUnitService"
-      ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
-    <property name="expressionService"
-      ref="org.hisp.dhis.expression.ExpressionService"/>
-  </bean>
+    class="org.hisp.dhis.pdf.impl.ItextPdfService"/>
   
   <!-- Workbook -->
   

=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf'
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/PdfServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/PdfServiceTest.java	2010-11-12 17:52:09 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/PdfServiceTest.java	1970-01-01 00:00:00 +0000
@@ -1,157 +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 static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-
-import org.hisp.dhis.DhisTest;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.mock.MockI18n;
-import org.hisp.dhis.mock.MockI18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.system.util.StreamUtils;
-import org.junit.Test;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class PdfServiceTest
-    extends DhisTest
-{
-    private PdfService pdfService;
-
-    private DataElementService dataElementService;
-
-    private IndicatorService indicatorService;
-
-    private OrganisationUnitService organisationUnitService;
-
-    // -------------------------------------------------------------------------
-    // I18n
-    // -------------------------------------------------------------------------
-
-    private I18n i18n;
-
-    private I18nFormat format;
-
-    // -------------------------------------------------------------------------
-    // Fixture
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void setUpTest()
-    {
-        i18n = new MockI18n();        
-        
-        format = new MockI18nFormat();
-
-        pdfService = (PdfService) getBean( PdfService.ID );
-
-        dataElementService = (DataElementService) getBean( DataElementService.ID );
-
-        indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
-        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
-        dataElementService.addDataElement( createDataElement( 'A' ) );
-        dataElementService.addDataElement( createDataElement( 'B' ) );
-        dataElementService.addDataElement( createDataElement( 'C' ) );
-
-        IndicatorType indicatorType = createIndicatorType( 'A' );
-        indicatorService.addIndicatorType( indicatorType );
-
-        indicatorService.addIndicator( createIndicator( 'A', indicatorType ) );
-        indicatorService.addIndicator( createIndicator( 'B', indicatorType ) );
-        indicatorService.addIndicator( createIndicator( 'C', indicatorType ) );
-
-        organisationUnitService.addOrganisationUnit( createOrganisationUnit( 'A' ) );
-        organisationUnitService.addOrganisationUnit( createOrganisationUnit( 'B' ) );
-        organisationUnitService.addOrganisationUnit( createOrganisationUnit( 'C' ) );
-    }
-    
-    @Override
-    public boolean emptyDatabaseAfterTest()
-    {
-        return true;
-    }
-
-    // -------------------------------------------------------------------------
-    // Tests
-    //
-    // Change to
-    // new BufferedOutputStream( new FileOutputStream( "file.pdf" ) )
-    // to verify output visually
-    // -------------------------------------------------------------------------
-
-    @Test
-    public void testWriteAllDataElements()
-        throws Exception
-    {
-        OutputStream outputStreamA = new ByteArrayOutputStream();
-
-        pdfService.writeAllDataElements( outputStreamA, i18n );
-        
-        assertNotNull( outputStreamA );
-
-        StreamUtils.closeOutputStream( outputStreamA );
-    }
-
-    @Test
-    public void testWriteAllIndicators()
-        throws Exception
-    {
-        OutputStream outputStreamB = new ByteArrayOutputStream();
-
-        pdfService.writeAllIndicators( outputStreamB, i18n );
-
-        assertNotNull( outputStreamB );
-        
-        StreamUtils.closeOutputStream( outputStreamB );
-    }
-
-    @Test
-    public void testWriteAllOrganisationUnits()
-        throws Exception
-    {
-        OutputStream outputStreamC = new ByteArrayOutputStream();
-
-        pdfService.writeAllOrganisationUnits( outputStreamC, i18n, format );
-
-        assertNotNull( outputStreamC );
-        
-        StreamUtils.closeOutputStream( outputStreamC );
-    }
-}