← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10713: Removed datavalue archive and patientvalue archive functions

 

------------------------------------------------------------
revno: 10713
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-04-30 10:03:51 +0200
message:
  Removed datavalue archive and patientvalue archive functions
removed:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/DefaultDataArchiveService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/JdbcDataArchiveStore.java
  dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/
  dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/DataArchiveServiceTest.java
  dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/DataArchiveTest.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchiveDataAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchivePatientDataAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapingPatientValuesAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataArchive.js
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleGroupForm.vm


--
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
=== removed directory 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive'
=== removed file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java	2013-04-15 17:38:55 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java	1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
-package org.hisp.dhis.dataarchive;
-
-/*
- * Copyright (c) 2004-2012, 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 org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.system.deletion.DeletionHandler;
-import org.springframework.jdbc.core.JdbcTemplate;
-
-/**
- * @author Lars Helge Overland
- */
-public class ArchivedDataValueDeletionHandler
-    extends DeletionHandler
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private JdbcTemplate jdbcTemplate;
-
-    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
-    {
-        this.jdbcTemplate = jdbcTemplate;
-    }
-
-    // -------------------------------------------------------------------------
-    // DeletionHandler implementation
-    // -------------------------------------------------------------------------
-
-    protected String getClassName()
-    {
-        return "ArchivedDataValue";
-    }
-
-    @Override
-    public String allowDeleteDataElement( DataElement dataElement )
-    {
-        String sql = "SELECT COUNT(*) FROM datavaluearchive where dataelementid=" + dataElement.getId();
-        
-        return jdbcTemplate.queryForObject( sql, Integer.class ) == 0 ? null : ERROR;
-    }
-    
-    @Override
-    public String allowDeletePeriod( Period period )
-    {
-        String sql = "SELECT COUNT(*) FROM datavaluearchive where periodid=" + period.getId();
-        
-        return jdbcTemplate.queryForObject( sql, Integer.class ) == 0 ? null : ERROR;
-    }
-    
-    @Override
-    public String allowDeleteOrganisationUnit( OrganisationUnit unit )
-    {
-        String sql = "SELECT COUNT(*) FROM datavaluearchive where sourceid=" + unit.getId();
-        
-        return jdbcTemplate.queryForObject( sql, Integer.class ) == 0 ? null : ERROR;
-    }
-    
-    @Override
-    public String allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo combo )
-    {
-        String sql = "SELECT COUNT(*) FROM datavaluearchive where categoryoptioncomboid=" + combo.getId();
-        
-        return jdbcTemplate.queryForObject( sql, Integer.class ) == 0 ? null : ERROR;
-    }
-}

=== removed file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/DefaultDataArchiveService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/DefaultDataArchiveService.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/DefaultDataArchiveService.java	1970-01-01 00:00:00 +0000
@@ -1,137 +0,0 @@
-package org.hisp.dhis.dataarchive;
-
-/*
- * Copyright (c) 2004-2012, 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.Date;
-
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author Lars Helge Overland
- */
-public class DefaultDataArchiveService
-    implements DataArchiveService
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataArchiveStore dataArchiveStore;
-    
-    public void setDataArchiveStore( DataArchiveStore dataArchiveStore )
-    {
-        this.dataArchiveStore = dataArchiveStore;
-    }
-
-    // -------------------------------------------------------------------------
-    // DataArchiveService implementation
-    // -------------------------------------------------------------------------
-
-    @Transactional
-    public int archiveData( Date startDate, Date endDate, DataArchiveOperation operation, DataEliminationStrategy strategy )
-    {
-        // ---------------------------------------------------------------------
-        // Eliminate duplicate data
-        // ---------------------------------------------------------------------
-
-        if ( DataEliminationStrategy.ARCHIVE.equals( strategy ) )
-        {
-            dataArchiveStore.deleteArchivedOverlappingData();
-        }
-        else if ( DataEliminationStrategy.REGULAR.equals( strategy ) )
-        {
-            dataArchiveStore.deleteRegularOverlappingData();
-        }
-        else // OLDEST
-        {
-            dataArchiveStore.deleteOldestOverlappingData();
-        }
-        
-        // ---------------------------------------------------------------------
-        // Archive data
-        // ---------------------------------------------------------------------
-
-        if ( DataArchiveOperation.ARCHIVE.equals( operation ) )
-        {
-            dataArchiveStore.archiveData( startDate, endDate );
-        }
-        else // UNARCHIVE
-        {
-            dataArchiveStore.unArchiveData( startDate, endDate );
-        }
-
-        return dataArchiveStore.getNumberOfArchivedValues();
-    }
-
-    public int getNumberOfOverlappingValues()
-    {
-        return dataArchiveStore.getNumberOfOverlappingValues();
-    }
-    
-    @Transactional
-    public int archivePatientData( Date startDate, Date endDate, DataArchiveOperation operation, DataEliminationStrategy strategy )
-    {
-        // ---------------------------------------------------------------------
-        // Eliminate duplicate data
-        // ---------------------------------------------------------------------
-
-        if ( DataEliminationStrategy.ARCHIVE.equals( strategy ) )
-        {
-            dataArchiveStore.deleteArchivedOverlappingPatientData();
-        }
-        else if ( DataEliminationStrategy.REGULAR.equals( strategy ) )
-        {
-            dataArchiveStore.deleteRegularOverlappingPatientData();
-        }
-        else // OLDEST
-        {
-            dataArchiveStore.deleteOldestOverlappingPatientData();
-        }
-        
-        // ---------------------------------------------------------------------
-        // Archive data
-        // ---------------------------------------------------------------------
-
-        if ( DataArchiveOperation.ARCHIVE.equals( operation ) )
-        {
-            dataArchiveStore.archivePatientData( startDate, endDate );
-        }
-        else // UNARCHIVE
-        {
-            dataArchiveStore.unArchivePatientData( startDate, endDate );
-        }
-
-        return dataArchiveStore.getNumberOfArchivedPatientValues();
-    }
-
-    public int getNumberOfOverlappingPatientValues()
-    {
-        return dataArchiveStore.getNumberOfOverlappingPatientValues();
-    }
-    
-}

=== removed directory 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc'
=== removed file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/JdbcDataArchiveStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/JdbcDataArchiveStore.java	2013-04-15 17:38:55 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/jdbc/JdbcDataArchiveStore.java	1970-01-01 00:00:00 +0000
@@ -1,268 +0,0 @@
-package org.hisp.dhis.dataarchive.jdbc;
-
-/*
- * Copyright (c) 2004-2012, 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.DateUtils.getMediumDateString;
-
-import java.util.Date;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.dataarchive.DataArchiveStore;
-import org.hisp.dhis.jdbc.StatementBuilder;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author Lars Helge Overland
- */
-@Transactional
-public class JdbcDataArchiveStore
-    implements DataArchiveStore
-{
-    private static final Log log = LogFactory.getLog( JdbcDataArchiveStore.class );
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private JdbcTemplate jdbcTemplate;
-
-    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
-    {
-        this.jdbcTemplate = jdbcTemplate;
-    }
-
-    private StatementBuilder statementBuilder;
-
-    public void setStatementBuilder( StatementBuilder statementBuilder )
-    {
-        this.statementBuilder = statementBuilder;
-    }
-
-    // -------------------------------------------------------------------------
-    // Implementation methods for Data values
-    // -------------------------------------------------------------------------
-
-    public void archiveData( Date startDate, Date endDate )
-    {
-        // Move data from datavalue to datavaluearchive
-        String sql = "INSERT INTO datavaluearchive ( " 
-            + "SELECT d.* FROM datavalue AS d "
-            + "JOIN period AS p ON (d.periodid=p.periodid) " 
-            + "WHERE p.startdate>='" + getMediumDateString( startDate ) + "' " 
-            + "AND p.enddate<='" + getMediumDateString( endDate ) + "' );";
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-
-        // Delete data from datavalue
-        sql = statementBuilder.archiveData( getMediumDateString( startDate ), getMediumDateString( endDate ) );
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-        
-    }
-
-    public void unArchiveData( Date startDate, Date endDate )
-    {
-        // Move data from datavalue to datavaluearchive
-        String sql = "INSERT INTO datavalue ( " 
-            + "SELECT a.* FROM datavaluearchive AS a "
-            + "JOIN period AS p ON (a.periodid=p.periodid) " 
-            + "WHERE p.startdate>='" + getMediumDateString( startDate ) + "' " 
-            + "AND p.enddate<='" + getMediumDateString( endDate ) + "' );";
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-
-        // Delete data from datavalue
-
-        sql = statementBuilder.unArchiveData( getMediumDateString( startDate ), getMediumDateString( endDate ) );
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-        
-    }
-
-    public int getNumberOfOverlappingValues()
-    {
-        String sql = "SELECT COUNT(*) FROM datavaluearchive AS a "
-            + "JOIN datavalue AS d ON (a.dataelementid=d.dataelementid " 
-            + "AND a.periodid=d.periodid "
-            + "AND a.sourceid=d.sourceid " 
-            + "AND a.categoryoptioncomboid=d.categoryoptioncomboid);";
-
-        log.info( sql );
-
-        return jdbcTemplate.queryForObject( sql, Integer.class );
-    }
-
-    public int getNumberOfArchivedValues()
-    {
-        String sql = "SELECT COUNT(*) as dem FROM datavaluearchive;";
-
-        log.info( sql );
-        return jdbcTemplate.queryForObject( sql, Integer.class );
-    }
-
-    public void deleteRegularOverlappingData()
-    {
-        String sql = statementBuilder.deleteRegularOverlappingData();
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-    }
-
-    public void deleteArchivedOverlappingData()
-    {
-        String sql = statementBuilder.deleteArchivedOverlappingData();
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-    }
-
-    public void deleteOldestOverlappingData()
-    {
-        // Delete overlaps from datavalue which are older than datavaluearchive
-        String sql = statementBuilder.deleteOldestOverlappingDataValue();
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-
-        // Delete overlaps from datavaluearchive which are older than datavalue
-        sql = statementBuilder.deleteOldestOverlappingArchiveData();
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-    }
-
-    // -------------------------------------------------------------------------
-    // Implementation methods for Patient data values
-    // -------------------------------------------------------------------------
-
-    public void archivePatientData( Date startDate, Date endDate )
-    {
-        // Move data from patientdatavalue to patientdatavaluearchive
-        String sql = "INSERT INTO patientdatavaluearchive ( " 
-            + "SELECT pdv.programstageinstanceid, pdv.dataelementid, pdv.value, "
-                    +" pdv.timestamp, pdv.storedBy, pdv.providedelsewhere FROM patientdatavalue AS pdv "
-            + "INNER JOIN programstageinstance AS psi " 
-                + "ON pdv.programstageinstanceid = psi.programstageinstanceid "
-            + "INNER JOIN programinstance AS pi " 
-                + "ON pi.programinstanceid = psi.programinstanceid "
-            + "WHERE pi.enddate >= '" + getMediumDateString( startDate ) + "' " + "AND pi.enddate <= '"
-            + getMediumDateString( endDate ) + "' );";
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-
-        // Delete data from patientdatavalue
-        sql = statementBuilder.archivePatientData( getMediumDateString( startDate ), getMediumDateString( endDate ) );
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-    }
-
-    public void unArchivePatientData( Date startDate, Date endDate )
-    {
-        // Move data from patientdatavalue to patientdatavaluearchive
-        String sql = "INSERT INTO patientdatavalue ( " 
-            + "SELECT pdv.programstageinstanceid, pdv.dataelementid, pdv.value, "
-                    +" pdv.timestamp, pdv.providedelsewhere, pdv.storedBy FROM patientdatavaluearchive AS pdv "
-            + "INNER JOIN programstageinstance AS psi " 
-                + "ON pdv.programstageinstanceid = psi.programstageinstanceid "
-            + "INNER JOIN programinstance AS pi " 
-                + "ON pi.programinstanceid = psi.programinstanceid "
-            + "WHERE pi.enddate >= '" + getMediumDateString( startDate ) + "' " + "AND pi.enddate <= '"
-            + getMediumDateString( endDate ) + "' );";
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-
-        // Delete data from patientdatavalue
-        sql = statementBuilder.unArchivePatientData( getMediumDateString( startDate ), getMediumDateString( endDate ) );
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-    }
-
-    public int getNumberOfOverlappingPatientValues()
-    {
-        String sql = "SELECT COUNT(*) FROM patientdatavaluearchive AS pdv " 
-            + "INNER JOIN programstageinstance AS psi "
-                + "ON pdv.programstageinstanceid = psi.programstageinstanceid " 
-            + "INNER JOIN programinstance AS pi "
-                + "ON pi.programinstanceid = psi.programinstanceid";
-        log.info( sql );
-
-        return jdbcTemplate.queryForObject( sql, Integer.class );
-    }
-
-    public int getNumberOfArchivedPatientValues()
-    {
-        String sql = "SELECT COUNT(*) as dem FROM patientdatavaluearchive;";
-
-        log.info( sql );
-        return jdbcTemplate.queryForObject( sql, Integer.class );
-    }
-
-    public void deleteRegularOverlappingPatientData()
-    {
-        String sql = statementBuilder.deleteRegularOverlappingPatientData();
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-    }
-
-    public void deleteArchivedOverlappingPatientData()
-    {
-        String sql = statementBuilder.deleteArchivedOverlappingPatientData();
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-    }
-
-    public void deleteOldestOverlappingPatientData()
-    {
-        // Delete overlaps from patientdatavalue which are older than
-        // patientdatavaluearchive
-        String sql = statementBuilder.deleteOldestOverlappingPatientDataValue();
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-
-        // Delete overlaps from patientdatavaluearchive which are older than
-        // patientdatavalue
-        sql = statementBuilder.deleteOldestOverlappingPatientArchiveData();
-
-        log.info( sql );
-        jdbcTemplate.execute( sql );
-    }
-
-}

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml	2013-03-05 10:28:10 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml	2013-04-30 08:03:51 +0000
@@ -77,42 +77,11 @@
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
-  
-  <!-- Data archive -->
-
-  <bean id="org.hisp.dhis.dataarchive.DataArchiveStore" class="org.hisp.dhis.dataarchive.jdbc.JdbcDataArchiveStore">
-    <property name="jdbcTemplate" ref="jdbcTemplate" />
-    <property name="statementBuilder" ref="statementBuilder" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dataarchive.DataArchiveService" class="org.hisp.dhis.dataarchive.DefaultDataArchiveService">
-    <property name="dataArchiveStore" ref="org.hisp.dhis.dataarchive.DataArchiveStore" />
-  </bean>
-  
+    
   <!-- User audit -->
 
   <bean id="org.hisp.dhis.useraudit.UserAuditService" class="org.hisp.dhis.useraudit.DefaultUserAuditService"/>
-  
-  <!--DeletionHandler -->
-
-  <bean id="org.hisp.dhis.dataarchive.ArchivedDataValueDeletionHandler" class="org.hisp.dhis.dataarchive.ArchivedDataValueDeletionHandler">
-    <property name="jdbcTemplate" ref="jdbcTemplate" />
-  </bean>
-
-  <!-- DeletionManager -->
-
-  <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
-    <property name="targetObject" ref="deletionManager" />
-    <property name="targetMethod" value="addDeletionHandlers" />
-    <property name="arguments">
-      <list>
-        <list>
-          <ref local="org.hisp.dhis.dataarchive.ArchivedDataValueDeletionHandler" />
-        </list>
-      </list>
-    </property>
-  </bean>
-  
+    
   <!-- Sql View -->
 
   <bean id="org.hisp.dhis.sqlview.SqlViewStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">

=== removed directory 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive'
=== removed file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/DataArchiveServiceTest.java'
--- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/DataArchiveServiceTest.java	2010-11-30 09:29:57 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/DataArchiveServiceTest.java	1970-01-01 00:00:00 +0000
@@ -1,136 +0,0 @@
-package org.hisp.dhis.dataarchive;
-
-/*
- * Copyright (c) 2004-2008, 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.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.util.Date;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * @author Dang Duy Hieu
- * @version $Id DataArchiveServiceTest.java Sep 09, 2010 ddhieu$
- */
-public class DataArchiveServiceTest
-    extends DataArchiveTest
-{
-    private Date STARTDATE;
-
-    private Date ENDDATE;
-
-    @Override
-    public void setUpTest()
-        throws Exception
-    {
-        STARTDATE = getDate( 1900, 1, 1 );
-        ENDDATE = getDate( 3000, 1, 1 );
-
-        setUpDataArchiveTest();
-    }
-
-    @Override
-    public boolean emptyDatabaseAfterTest()
-    {
-        return true;
-    }
-
-    /**
-     * int archiveData( Date startDate, Date endDate, DataArchiveOperation
-     * operation, DataEliminationStrategy strategy );
-     */
-    @Test
-    @Ignore
-    public void testArchiveData()
-    {
-        /*
-         * STEP 1:
-         * 
-         * Archives all datavalues to datavaluearchive follows from earliest to
-         * latest date
-         */
-        int archivedValuesNo = dataArchiveService.archiveData( STARTDATE, ENDDATE, DataArchiveOperation.ARCHIVE,
-            DataEliminationStrategy.ARCHIVE );
-        
-        assertEquals( "There will have 54 records in datavaluearchive table from STARTDATE to ENDDATE", 54,
-            archivedValuesNo );
-
-        /*
-         * STEP 2:
-         * 
-         * Archives all datavalues to datavaluearchive from "2005-05-01" to
-         * "2005-05-31" of periodD by weekly
-         */
-        archivedValuesNo = dataArchiveService.archiveData( periodD.getStartDate(), periodD.getEndDate(),
-            DataArchiveOperation.ARCHIVE, DataEliminationStrategy.ARCHIVE );
-
-        assertEquals( "54 records still in datavaluearchive table because of "
-            + "periodD is also in range from STARTDATE to ENDDATE", 54, archivedValuesNo );
-
-        /*
-         * STEP 3: Un-archives all datavaluearchive to datavalues from
-         * "2005-05-01" to "2005-05-31" of periodD by weekly
-         */
-        archivedValuesNo = dataArchiveService.archiveData( periodD.getStartDate(), periodD.getEndDate(),
-            DataArchiveOperation.UNARCHIVE, DataEliminationStrategy.REGULAR );
-
-        assertSame( "54 records from 2005-05-01 to 2005-05-31 have been removed back into datavalue table."
-            + " So now, datavaluearchive are empty", 0, archivedValuesNo );
-
-        /*
-         * STEP 4: Un-archives all datavaluearchive to datavalues from earliest
-         * to latest date. This is the final step to do empty datavaluearchive
-         * table to avoid the referential integrity constraint violation.
-         * 
-         * Because the emptyDatabaseAfterTest() method doesn't work properly
-         */
-        archivedValuesNo = dataArchiveService.archiveData( STARTDATE, ENDDATE, DataArchiveOperation.UNARCHIVE,
-            DataEliminationStrategy.REGULAR );
-
-        assertEquals( "Empty datavaluearchive table", 0, archivedValuesNo );
-    }
-
-    /**
-     * int getNumberOfOverlappingValues();
-     */
-    @Test
-    public void testGetNumberOfOverlappingValues()
-    {
-        int archivedValuesNo = dataArchiveService.archiveData( STARTDATE, ENDDATE, DataArchiveOperation.UNARCHIVE,
-            DataEliminationStrategy.REGULAR );
-
-        assertEquals( "5Number of archived values equals 0", 0, archivedValuesNo );
-
-        archivedValuesNo = dataArchiveService.getNumberOfOverlappingValues();
-
-        assertEquals( "6Number of archived values equals 0", 0, archivedValuesNo );
-
-    }
-}

=== removed file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/DataArchiveTest.java'
--- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/DataArchiveTest.java	2013-04-15 16:01:02 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataarchive/DataArchiveTest.java	1970-01-01 00:00:00 +0000
@@ -1,359 +0,0 @@
-package org.hisp.dhis.dataarchive;
-
-/*
- * Copyright (c) 2004-2008, 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.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.hisp.dhis.DhisTest;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.PeriodType;
-
-/**
- * @author Dang Duy Hieu
- * @version $Id$
- */
-public abstract class DataArchiveTest
-    extends DhisTest
-{
-    protected DataArchiveService dataArchiveService;
-
-    protected final String T = "true";
-
-    protected final String F = "false";
-
-    protected DataElementCategoryCombo categoryCombo;
-
-    protected DataElementCategoryOptionCombo categoryOptionCombo;
-
-    protected Collection<Integer> dataElementIds;
-
-    protected Collection<Integer> periodIds;
-
-    protected Collection<Integer> organisationUnitIds;
-
-    protected DataSet dataSetA;
-
-    protected DataSet dataSetB;
-
-    protected DataSet dataSetC;
-
-    protected DataElement dataElementA;
-
-    protected DataElement dataElementB;
-
-    protected DataElement dataElementC;
-
-    protected DataElement dataElementD;
-
-    protected DataElement dataElementE;
-
-    protected DataElement dataElementF;
-
-    protected Period periodA;
-
-    protected Period periodB;
-
-    protected Period periodC;
-
-    protected Period periodD;
-
-    protected OrganisationUnit unitA;
-
-    protected OrganisationUnit unitB;
-
-    protected OrganisationUnit unitC;
-
-    protected OrganisationUnit unitD;
-
-    protected OrganisationUnit unitE;
-
-    protected OrganisationUnit unitF;
-
-    protected OrganisationUnit unitG;
-
-    protected OrganisationUnit unitH;
-
-    protected OrganisationUnit unitI;
-
-    public void setUpDataArchiveTest()
-        throws Exception
-    {
-        dataArchiveService = (DataArchiveService) getBean( DataArchiveService.ID );
-
-        categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
-        dataSetService = (DataSetService) getBean( DataSetService.ID );
-
-        dataElementService = (DataElementService) getBean( DataElementService.ID );
-
-        dataValueService = (DataValueService) getBean( DataValueService.ID );
-
-        indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
-        periodService = (PeriodService) getBean( PeriodService.ID );
-
-        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
-        organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID );
-
-        categoryCombo = categoryService
-            .getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
-
-        categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
-
-        // ---------------------------------------------------------------------
-        // Setup identifier Collections
-        // ---------------------------------------------------------------------
-
-        dataElementIds = new HashSet<Integer>();
-        periodIds = new HashSet<Integer>();
-        organisationUnitIds = new HashSet<Integer>();
-
-        // ---------------------------------------------------------------------
-        // Setup DataElements
-        // ---------------------------------------------------------------------
-
-        dataElementA = createDataElement( 'A', DataElement.VALUE_TYPE_INT, DataElement.AGGREGATION_OPERATOR_SUM,
-            categoryCombo );
-        dataElementB = createDataElement( 'B', DataElement.VALUE_TYPE_BOOL, DataElement.AGGREGATION_OPERATOR_SUM,
-            categoryCombo );
-        dataElementC = createDataElement( 'C', DataElement.VALUE_TYPE_STRING,
-            DataElement.AGGREGATION_OPERATOR_SUM, categoryCombo );
-        dataElementD = createDataElement( 'D', DataElement.VALUE_TYPE_INT, DataElement.AGGREGATION_OPERATOR_SUM,
-            categoryCombo );
-        dataElementE = createDataElement( 'E', DataElement.VALUE_TYPE_BOOL, DataElement.AGGREGATION_OPERATOR_SUM,
-            categoryCombo );
-        dataElementF = createDataElement( 'F', DataElement.VALUE_TYPE_STRING,
-            DataElement.AGGREGATION_OPERATOR_SUM, categoryCombo );
-
-        dataElementIds.add( dataElementService.addDataElement( dataElementA ) );
-        dataElementIds.add( dataElementService.addDataElement( dataElementB ) );
-        dataElementIds.add( dataElementService.addDataElement( dataElementC ) );
-        dataElementIds.add( dataElementService.addDataElement( dataElementD ) );
-        dataElementIds.add( dataElementService.addDataElement( dataElementE ) );
-        dataElementIds.add( dataElementService.addDataElement( dataElementF ) );
-
-        Set<DataElement> dataElementsA = new HashSet<DataElement>();
-        Set<DataElement> dataElementsB = new HashSet<DataElement>();
-        Set<DataElement> dataElementsC = new HashSet<DataElement>();
-
-        // One dataElement
-        dataElementsA.add( dataElementA );
-
-        // Two dataElements
-        dataElementsB.add( dataElementB );
-        dataElementsB.add( dataElementD );
-
-        // Three dataElements
-        dataElementsC.add( dataElementC );
-        dataElementsC.add( dataElementE );
-        dataElementsC.add( dataElementF );
-
-        // ---------------------------------------------------------------------
-        // Setup Periods
-        // ---------------------------------------------------------------------
-
-        Iterator<PeriodType> periodTypeIt = periodService.getAllPeriodTypes().iterator();
-        PeriodType periodTypeA = periodTypeIt.next(); // Daily
-        PeriodType periodTypeB = periodTypeIt.next(); // Weekly
-
-        Date mar01 = getDate( 2005, 3, 1 );
-        Date mar31 = getDate( 2005, 3, 31 );
-        Date apr01 = getDate( 2005, 4, 1 );
-        Date apr30 = getDate( 2005, 4, 30 );
-        Date may01 = getDate( 2005, 5, 1 );
-        Date may31 = getDate( 2005, 5, 31 );
-
-        periodA = createPeriod( periodTypeA, mar01, mar31 );
-        periodB = createPeriod( periodTypeA, apr01, apr30 );
-        periodC = createPeriod( periodTypeB, mar01, may31 );
-        periodD = createPeriod( periodTypeB, may01, may31 );
-
-        periodIds.add( periodService.addPeriod( periodA ) );
-        periodIds.add( periodService.addPeriod( periodB ) );
-        periodIds.add( periodService.addPeriod( periodC ) );
-        periodIds.add( periodService.addPeriod( periodD ) );
-
-        // ---------------------------------------------------------------------
-        // Setup DataSets
-        // ---------------------------------------------------------------------
-
-        dataSetA = createDataSet( 'A', periodTypeA );
-        dataSetB = createDataSet( 'B', periodTypeB );
-        dataSetC = createDataSet( 'C', periodTypeB );
-
-        dataSetA.setDataElements( dataElementsA );
-        dataSetB.setDataElements( dataElementsB );
-        dataSetC.setDataElements( dataElementsC );
-
-        dataSetService.addDataSet( dataSetA );
-        dataSetService.addDataSet( dataSetB );
-        dataSetService.addDataSet( dataSetC );
-
-        // ---------------------------------------------------------------------
-        // Setup OrganisationUnits
-        // ---------------------------------------------------------------------
-
-        unitA = createOrganisationUnit( 'A' );
-        unitB = createOrganisationUnit( 'B', unitA );
-        unitC = createOrganisationUnit( 'C', unitA );
-        unitD = createOrganisationUnit( 'D', unitB );
-        unitE = createOrganisationUnit( 'E', unitB );
-        unitF = createOrganisationUnit( 'F', unitB );
-        unitG = createOrganisationUnit( 'G', unitF );
-        unitH = createOrganisationUnit( 'H', unitF );
-        unitI = createOrganisationUnit( 'I' );
-
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitA ) );
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitB ) );
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitC ) );
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitD ) );
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitE ) );
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitF ) );
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitG ) );
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitH ) );
-        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitI ) );
-
-        // ---------------------------------------------------------------------
-        // Setup DataValues
-        // ---------------------------------------------------------------------
-
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodA, unitC, "90", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodA, unitD, "10", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodA, unitE, "35", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodA, unitF, "25", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodA, unitG, "20", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodA, unitH, "60", categoryOptionCombo ) );
-
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodB, unitC, "70", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodB, unitD, "40", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodB, unitE, "65", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodB, unitF, "55", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodB, unitG, "20", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodB, unitH, "15", categoryOptionCombo ) );
-
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodC, unitC, "95", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodC, unitD, "40", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodC, unitE, "45", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodC, unitF, "30", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodC, unitG, "50", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementA, periodC, unitH, "70", categoryOptionCombo ) );
-
-        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitC, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitD, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitE, F, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitF, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitG, F, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitH, T, categoryOptionCombo ) );
-
-        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitC, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitD, F, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitE, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitF, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitG, F, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitH, T, categoryOptionCombo ) );
-
-        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitC, F, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitD, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitE, F, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitF, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitG, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitH, T, categoryOptionCombo ) );
-
-        dataValueService.addDataValue( createDataValue( dataElementC, periodD, unitC, "String1",
-            categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementC, periodD, unitD, "String2",
-            categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementC, periodD, unitE, "String3",
-            categoryOptionCombo ) );
-
-        dataValueService
-            .addDataValue( createDataValue( dataElementD, periodA, unitC, "10", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementD, periodA, unitD, "20", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementD, periodA, unitE, "30", categoryOptionCombo ) );
-
-        dataValueService
-            .addDataValue( createDataValue( dataElementD, periodB, unitF, "40", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementD, periodB, unitG, "50", categoryOptionCombo ) );
-        dataValueService
-            .addDataValue( createDataValue( dataElementD, periodB, unitH, "60", categoryOptionCombo ) );
-
-        dataValueService.addDataValue( createDataValue( dataElementE, periodC, unitC, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementE, periodC, unitD, F, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementE, periodC, unitE, T, categoryOptionCombo ) );
-
-        dataValueService.addDataValue( createDataValue( dataElementE, periodD, unitF, T, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementE, periodD, unitG, F, categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementE, periodD, unitH, T, categoryOptionCombo ) );
-
-        dataValueService.addDataValue( createDataValue( dataElementF, periodA, unitC, "String4",
-            categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementF, periodA, unitD, "String5",
-            categoryOptionCombo ) );
-        dataValueService.addDataValue( createDataValue( dataElementF, periodA, unitE, "String6",
-            categoryOptionCombo ) );
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-04-22 10:01:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-04-30 08:03:51 +0000
@@ -343,9 +343,9 @@
         executeSql( "ALTER TABLE completedatasetregistration DROP CONSTRAINT fk_datasetcompleteregistration_sourceid" );
         executeSql( "ALTER TABLE minmaxdataelement DROP CONSTRAINT fk_minmaxdataelement_sourceid" );
         executeSql( "ALTER TABLE datavalue DROP CONSTRAINT fk_datavalue_sourceid" );
-        executeSql( "ALTER TABLE datavaluearchive DROP CONSTRAINT fk_datavaluearchive_sourceid" );
         executeSql( "ALTER TABLE organisationunit DROP CONSTRAINT fke509dd5ef1c932ed" );
         executeSql( "DROP TABLE source CASCADE" );
+        executeSql( "DROP TABLE datavaluearchive" );
 
         // message
 
@@ -476,7 +476,6 @@
         executeSql( "DROP TABLE chartgroupmembers" );
         executeSql( "DROP TABLE chartgroup" );
 
-        executeSql( "ALTER TABLE patientdatavaluearchive DROP COLUMN categoryoptioncomboid" );
         executeSql( "delete from usersetting where name='currentStyle' and value like '%blue/blue.css'" );
         executeSql( "delete from systemsetting where name='currentStyle' and value like '%blue/blue.css'" );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java	2012-11-08 08:33:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java	2013-04-30 08:03:51 +0000
@@ -75,43 +75,6 @@
         createSilently( "CREATE INDEX crosstab ON datavalue ( periodid, sourceid )", "crosstab" );
         createSilently( "CREATE INDEX messageconversation_lastmessage ON messageconversation (lastmessage)", "messageconversation_lastmessage" );
         createSilently( "CREATE INDEX interpretation_lastupdated ON interpretation (lastupdated)", "interpretation_lastupdated" );
-        
-        final String sqlDataValueArchive = 
-            "CREATE TABLE datavaluearchive ( " +
-            "dataelementid INTEGER NOT NULL, " +
-            "periodid INTEGER NOT NULL, " +
-            "sourceid INTEGER NOT NULL, " +
-            "categoryoptioncomboid INTEGER NOT NULL, " +
-            "value VARCHAR(255), " +
-            "storedby VARCHAR(31), " +
-            "lastupdated TIMESTAMP, " +
-            "comment VARCHAR(360), " +
-            "followup BOOLEAN, " +
-            "CONSTRAINT datavaluearchive_pkey PRIMARY KEY (dataelementid, periodid, sourceid, categoryoptioncomboid), " +
-            "CONSTRAINT fk_datavaluearchive_categoryoptioncomboid FOREIGN KEY (categoryoptioncomboid) " +
-                "REFERENCES categoryoptioncombo (categoryoptioncomboid), " +
-            "CONSTRAINT fk_datavaluearchive_dataelementid FOREIGN KEY (dataelementid) " +
-                "REFERENCES dataelement (dataelementid), " +
-            "CONSTRAINT fk_datavaluearchive_periodid FOREIGN KEY (periodid) " +
-                "REFERENCES period (periodid), " +
-            "CONSTRAINT fk_datavaluearchive_sourceid FOREIGN KEY (sourceid) " +
-                "REFERENCES organisationunit (organisationunitid) );";
-        
-        createSilently( sqlDataValueArchive, "datavaluearchive" );
-
-        final String sqlPatientDataValueArchive = 
-            "CREATE TABLE patientdatavaluearchive ( " +
-             " programstageinstanceid integer NOT NULL, " +
-             " dataelementid integer NOT NULL, " +
-             " organisationunitid integer NOT NULL, " +
-             " value varchar(255) default NULL, " +
-             " providedelsewhere boolean, " +
-             " timestamp TIMESTAMP, " +
-             " PRIMARY KEY  (programstageinstanceid,dataelementid,organisationunitid), " +
-             " CONSTRAINT fk_patientdatavaluearchivepatientdatavaluearchive_organisationunitid FOREIGN KEY (organisationunitid) REFERENCES organisationunit (organisationunitid), " +
-             " CONSTRAINT fk_patientdatavaluearchive_programstageinstanceid FOREIGN KEY (programstageinstanceid) REFERENCES programstageinstance (programstageinstanceid) );";
-        
-        createSilently( sqlPatientDataValueArchive, "patientdatavaluearchive" );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2013-04-19 03:50:54 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2013-04-30 08:03:51 +0000
@@ -106,10 +106,6 @@
         executeSql( "ALTER TABLE programstage_dataelements DROP COLUMN showOnReport" );
 
         executeSql( "ALTER TABLE patientdatavalue DROP COLUMN categoryoptioncomboid" );
-        executeSql( "ALTER TABLE patientdatavaluearchive DROP COLUMN providedbyanotherfacility" );
-        executeSql( "ALTER TABLE patientdatavaluearchive DROP COLUMN organisationunitid" );
-        executeSql( "ALTER TABLE patientdatavaluearchive ADD COLUMN storedby VARCHAR(31)" );
-        executeSql( "ALTER TABLE patientdatavaluearchive ADD COLUMN providedelsewhere BOOLEAN" );
         executeSql( "DROP TABLE patientchart" );
 
         executeSql( "ALTER TABLE program DROP COLUMN hidedateofincident" );
@@ -126,6 +122,7 @@
         executeSql( "DROP TABLE programinstance_attributes" );
         executeSql( "DROP TABLE programattributeoption" );
         executeSql( "DROP TABLE programattribute" );
+        executeSql( "DROP TABLE patientdatavaluearchive" );
 
         executeSql( "ALTER TABLE patientattribute DROP COLUMN noChars" );
         executeSql( "ALTER TABLE programstageinstance ALTER executiondate TYPE date" );

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java	2013-04-19 16:40:53 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java	2013-04-30 08:03:51 +0000
@@ -141,37 +141,7 @@
     
     String getPatientFullName();
 
-    //--------------------------------------------------------------------------
-    // Archiving
-    //--------------------------------------------------------------------------
-
-    String archiveData( String startDate, String endDate );
-    
-    String unArchiveData( String startDate, String endDate );
-    
-    String deleteRegularOverlappingData();
-    
-    String deleteArchivedOverlappingData();
-    
-    String deleteOldestOverlappingDataValue();
-    
-    String deleteOldestOverlappingArchiveData();
-    
-    String archivePatientData ( String startDate, String endDate );
-    
-    String unArchivePatientData ( String startDate, String endDate );
-    
-    String deleteRegularOverlappingPatientData();
-    
-    String deleteArchivedOverlappingPatientData();
-    
-    String deleteOldestOverlappingPatientDataValue();
-    
-    String deleteOldestOverlappingPatientArchiveData();
-    
     String queryDataElementStructureForOrgUnit();
 
-    String queryRawDataElementsForOrgUnitBetweenPeriods( Integer orgUnitId, List<Integer> betweenPeriodIds);
-
-  
+    String queryRawDataElementsForOrgUnitBetweenPeriods( Integer orgUnitId, List<Integer> betweenPeriodIds );
 }

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2013-04-19 16:40:53 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2013-04-30 08:03:51 +0000
@@ -167,143 +167,10 @@
     }
 
     @Override
-    public String archiveData( String startDate, String endDate )
-    {
-       return "DELETE FROM datavalue AS a " +
-            "WHERE EXISTS (" +
-            "SELECT 1 FROM period AS p " +
-            "WHERE a.periodid=p.periodid " +
-            "AND p.startdate>='" + startDate + "' " +
-            "AND p.enddate<='" + endDate + "')";
-    }
-
-    @Override
-    public String unArchiveData( String startDate, String endDate )
-    {
-       return "DELETE FROM datavaluearchive AS a " +
-           "WHERE EXISTS (" +
-           "SELECT 1 FROM period AS p " +
-           "WHERE a.periodid=p.periodid " +
-           "AND p.startdate>='" + startDate + "' " +
-           "AND p.enddate<='" + endDate + "')";
-    }
-
-    @Override
-    public String deleteRegularOverlappingData()
-    {       
-       return "DELETE FROM datavalue AS d " +
-           "WHERE EXISTS (" +
-           "SELECT 1 FROM datavaluearchive AS a " +
-           "WHERE d.dataelementid=a.dataelementid " +
-           "AND d.periodid=a.periodid " +
-           "AND d.sourceid=a.sourceid " +
-           "AND d.categoryoptioncomboid=a.categoryoptioncomboid)";
-
-    }
-
-    @Override
-    public String deleteArchivedOverlappingData()
-    {
-       return "DELETE FROM datavaluearchive AS a " +
-           "WHERE EXISTS (" +
-           "SELECT 1 FROM datavalue AS d " +
-           "WHERE a.dataelementid=d.dataelementid " +
-           "AND a.periodid=d.periodid " +
-           "AND a.sourceid=d.sourceid " +
-           "AND a.categoryoptioncomboid=d.categoryoptioncomboid)";
-    }
-
-    @Override
-    public String deleteOldestOverlappingDataValue()
-    {       
-       return "DELETE FROM datavalue AS d " +
-           "WHERE EXISTS (" +
-           "SELECT 1 FROM datavaluearchive AS a " +
-           "WHERE d.dataelementid=a.dataelementid " +
-           "AND d.periodid=a.periodid " +
-           "AND d.sourceid=a.sourceid " +
-           "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
-           "AND d.lastupdated<a.lastupdated)";
-    }
-
-    @Override
-    public String deleteOldestOverlappingArchiveData()
-    {       
-       return "DELETE FROM datavaluearchive AS a " +
-           "WHERE EXISTS (" +
-           "SELECT 1 FROM datavalue AS d " +
-           "WHERE a.dataelementid=d.dataelementid " +
-           "AND a.periodid=d.periodid " +
-           "AND a.sourceid=d.sourceid " +
-           "AND a.categoryoptioncomboid=d.categoryoptioncomboid " +
-           "AND a.lastupdated<=d.lastupdated)";
-    }
-
-    @Override
-    public String archivePatientData ( String startDate, String endDate )
-    {
-        return "DELETE FROM patientdatavalue AS pdv " 
-            + "USING programstageinstance AS psi ,  programinstance AS pi "
-            + "WHERE pdv.programstageinstanceid = psi.programstageinstanceid "
-            + "AND pi.programinstanceid = psi.programinstanceid "
-            + "WHERE pi.enddate >= '" + startDate + "' "
-            + "AND pi.enddate <= '" +  endDate + "';";
-    }
-
-    @Override
-    public String unArchivePatientData ( String startDate, String endDate )
-    {
-        return "DELETE FROM patientdatavaluearchive AS pdv " 
-            + "USING programstageinstance AS psi ,  programinstance AS pi "
-            + "WHERE pdv.programstageinstanceid = psi.programstageinstanceid "
-            + "AND pi.programinstanceid = psi.programinstanceid "
-            + "WHERE pi.enddate >= '" + startDate + "' "
-            + "AND pi.enddate <= '" +  endDate + "';";
-    }
-
-    @Override
-    public String deleteRegularOverlappingPatientData()
-    {
-        return "DELETE FROM patientdatavalue AS d " +
-            "USING patientdatavaluearchive AS a " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid " +
-            "AND d.timestamp<a.timestamp;";
-    }
-
-    @Override
-    public String deleteArchivedOverlappingPatientData()
-    {
-        return "DELETE FROM patientdatavaluearchive AS a " +
-            "USING patientdatavalue AS d " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid ";
-    }
-
-    @Override
-    public String deleteOldestOverlappingPatientDataValue()
-    {
-        return "DELETE FROM patientdatavalue AS d " +
-            "USING patientdatavaluearchive AS a " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid " +
-            "AND d.timestamp<a.timestamp;";
-    }
-
-    @Override
-    public String deleteOldestOverlappingPatientArchiveData()
-    {
-        return "DELETE FROM patientdatavalue AS d " +
-            "USING patientdatavaluearchive AS a " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid " +
-            "AND a.timestamp<=d.timestamp;";
-    }
-
-    @Override
     public String queryDataElementStructureForOrgUnit()
     {
         StringBuffer sqlsb = new StringBuffer();
+        
         sqlsb.append( "(SELECT DISTINCT de.dataelementid, (de.name || ' ' || cc.categoryoptioncomboname) AS DataElement " );
         sqlsb.append( "FROM dataelement AS de " );
         sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2013-04-19 16:40:53 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2013-04-30 08:03:51 +0000
@@ -152,72 +152,6 @@
     }
 
     @Override
-    public String archiveData( String startDate, String endDate )
-    {
-        return "DELETE d FROM datavalue AS d " +
-            "INNER JOIN period as p " +
-            "WHERE d.periodid=p.periodid " +
-            "AND p.startdate>='" + startDate + "' " +
-            "AND p.enddate<='" + endDate + "'";
-    }
-
-    @Override
-    public String unArchiveData( String startDate, String endDate )
-    {    
-        return "DELETE a FROM datavaluearchive AS a " +
-            "INNER JOIN period AS p " +
-            "WHERE a.periodid=p.periodid " +
-            "AND p.startdate>='" + startDate + "' " +
-            "AND p.enddate<='" + endDate + "'";
-    }
-
-    @Override
-    public String deleteRegularOverlappingData()
-    {    
-        return "DELETE d FROM datavalue AS d " +
-            "INNER JOIN datavaluearchive AS a " +
-            "WHERE d.dataelementid=a.dataelementid " +
-            "AND d.periodid=a.periodid " +
-            "AND d.sourceid=a.sourceid " +
-            "AND d.categoryoptioncomboid=a.categoryoptioncomboid";
-    }
-
-    @Override
-    public String deleteArchivedOverlappingData()
-    {
-        return "DELETE a FROM datavaluearchive AS a " +
-            "INNER JOIN datavalue AS d " +
-            "WHERE a.dataelementid=d.dataelementid " +
-            "AND a.periodid=d.periodid " +
-            "AND a.sourceid=d.sourceid " +
-            "AND a.categoryoptioncomboid=d.categoryoptioncomboid";
-    }
-
-    @Override
-    public String deleteOldestOverlappingDataValue()
-    {    
-        return "DELETE d FROM datavalue AS d " +
-            "INNER JOIN datavaluearchive AS a " +
-            "WHERE d.dataelementid=a.dataelementid " +
-            "AND d.periodid=a.periodid " +
-            "AND d.sourceid=a.sourceid " +
-            "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
-            "AND d.lastupdated<a.lastupdated";
-    }
-
-    @Override
-    public String deleteOldestOverlappingArchiveData()
-    {       
-        return "DELETE a FROM datavaluearchive AS a " +
-            "INNER JOIN datavalue AS d " +
-            "WHERE a.dataelementid=d.dataelementid " +
-            "AND a.periodid=d.periodid " +
-            "AND a.sourceid=d.sourceid " +
-            "AND a.categoryoptioncomboid=d.categoryoptioncomboid " +
-            "AND a.lastupdated<=d.lastupdated";
-    }
-
-    @Override
     public String limitRecord( int min, int max )
     {
         return " LIMIT " + min + " ," + max;
@@ -236,76 +170,16 @@
     }
 
     @Override
-    public String archivePatientData ( String startDate, String endDate )
-    {
-        return "DELETE pdv FROM patientdatavalue AS pdv "
-            + "INNER JOIN programstageinstance AS psi "
-            +    "ON pdv.programstageinstanceid = psi.programstageinstanceid "
-            + "INNER JOIN programinstance AS pi "
-            +    "ON pi.programinstanceid = psi.programinstanceid "
-            + "WHERE pi.enddate >= '" + startDate + "' "
-            +    "AND pi.enddate <= '" +  endDate + "';";
-    }
-
-    @Override
-    public String unArchivePatientData ( String startDate, String endDate )
-    {
-        return "DELETE pdv FROM patientdatavaluearchive AS pdv "
-            + "INNER JOIN programstageinstance AS psi "
-            +    "ON pdv.programstageinstanceid = psi.programstageinstanceid "
-            + "INNER JOIN programinstance AS pi "
-            +    "ON pi.programinstanceid = psi.programinstanceid "
-            + "WHERE pi.enddate >= '" + startDate + "' "
-            +    "AND pi.enddate <= '" +  endDate + "';";
-    }
-
-    @Override
-    public String deleteRegularOverlappingPatientData()
-    {
-        return "DELETE d FROM patientdatavalue AS d " +
-            "INNER JOIN patientdatavaluearchive AS a " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid; " ;
-    }
-
-    @Override
-    public String deleteArchivedOverlappingPatientData()
-    {
-        return "DELETE a FROM patientdatavaluearchive AS a " +
-            "INNER JOIN patientdatavalue AS d " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid ";
-    }
-
-    @Override
-    public String deleteOldestOverlappingPatientDataValue()
-    {
-        return "DELETE d FROM patientdatavalue AS d " +
-            "INNER JOIN patientdatavaluearchive AS a " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid " +
-            "AND d.timestamp<a.timestamp;";
-    }
-
-    @Override
-    public String deleteOldestOverlappingPatientArchiveData()
-    {
-        return "DELETE a FROM patientdatavaluearchive AS a " +
-            "INNER JOIN patientdatavalue AS d " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid " +
-            "AND a.timestamp<=d.timestamp;";
-    }
-
-    @Override
     public String queryDataElementStructureForOrgUnit()
     {
         StringBuffer sqlsb = new StringBuffer();
+        
         sqlsb.append( "(SELECT DISTINCT de.dataelementid, concat(de.name, \" \", cc.categoryoptioncomboname) AS DataElement " );
         sqlsb.append( "FROM dataelement AS de " );
         sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
         sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
         sqlsb.append( "ORDER BY DataElement) " );
+        
         return sqlsb.toString();
     }
 

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2013-04-19 16:40:53 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2013-04-30 08:03:51 +0000
@@ -170,140 +170,16 @@
     }
 
     @Override
-    public String archiveData( String startDate, String endDate )
-    {
-        return "DELETE FROM datavaluearchive AS a " +
-            "USING period AS p " +
-            "WHERE a.periodid=p.periodid " +
-            "AND p.startdate>='" + startDate + "' " +
-            "AND p.enddate<='" + endDate + "'";
-    }  
-
-    @Override
-    public String unArchiveData( String startDate, String endDate )
-    {
-        return "DELETE FROM datavaluearchive AS a " +
-            "USING period AS p " +
-            "WHERE a.periodid=p.periodid " +
-            "AND p.startdate>='" + startDate + "' " +
-            "AND p.enddate<='" + endDate + "'";
-    }
-
-    @Override
-    public String deleteRegularOverlappingData()
-    {
-        return "DELETE FROM datavalue AS d " +
-            "USING datavaluearchive AS a " +
-            "WHERE d.dataelementid=a.dataelementid " +
-            "AND d.periodid=a.periodid " +
-            "AND d.sourceid=a.sourceid " +
-            "AND d.categoryoptioncomboid=a.categoryoptioncomboid";
-    }
-
-    @Override
-    public String deleteArchivedOverlappingData()
-    {
-        return "DELETE FROM datavaluearchive AS a " +
-            "USING datavalue AS d " +
-            "WHERE a.dataelementid=d.dataelementid " +
-            "AND a.periodid=d.periodid " +
-            "AND a.sourceid=d.sourceid " +
-            "AND a.categoryoptioncomboid=d.categoryoptioncomboid";
-    }
-
-    @Override
-    public String deleteOldestOverlappingDataValue()
-    {      
-        return "DELETE FROM datavalue AS d " +
-            "USING datavaluearchive AS a " +
-            "WHERE d.dataelementid=a.dataelementid " +
-            "AND d.periodid=a.periodid " +
-            "AND d.sourceid=a.sourceid " +
-            "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
-            "AND d.lastupdated<a.lastupdated";
-    }
-
-    @Override
-    public String deleteOldestOverlappingArchiveData()
-    {      
-        return "DELETE FROM datavaluearchive AS a " +
-            "USING datavalue AS d " +
-            "WHERE a.dataelementid=d.dataelementid " +
-            "AND a.periodid=d.periodid " +
-            "AND a.sourceid=d.sourceid " +
-            "AND a.categoryoptioncomboid=d.categoryoptioncomboid " +
-            "AND a.lastupdated<=d.lastupdated";
-    }
-
-    @Override
-    public String archivePatientData ( String startDate, String endDate )
-    {
-        return "DELETE FROM patientdatavalue AS pdv " 
-            + "USING programstageinstance AS psi ,  programinstance AS pi "
-            + "WHERE pdv.programstageinstanceid = psi.programstageinstanceid "
-            + "AND pi.programinstanceid = psi.programinstanceid "
-            + "AND pi.enddate >= '" + startDate + "' "
-            + "AND pi.enddate <= '" +  endDate + "';";
-    }
-
-    @Override
-    public String unArchivePatientData ( String startDate, String endDate )
-    {
-        return "DELETE FROM patientdatavaluearchive AS pdv " 
-            + "USING programstageinstance AS psi ,  programinstance AS pi "
-            + "WHERE pdv.programstageinstanceid = psi.programstageinstanceid "
-            + "AND pi.programinstanceid = psi.programinstanceid "
-            + "AND pi.enddate >= '" + startDate + "' "
-            + "AND pi.enddate <= '" +  endDate + "';";
-    }
-
-    @Override
-    public String deleteRegularOverlappingPatientData()
-    {
-        return "DELETE FROM patientdatavalue AS d " +
-            "USING patientdatavaluearchive AS a " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid; ";
-    }
-
-    @Override
-    public String deleteArchivedOverlappingPatientData()
-    {
-        return "DELETE FROM patientdatavaluearchive AS a " +
-            "USING patientdatavalue AS d " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid ";
-    }
-
-    @Override
-    public String deleteOldestOverlappingPatientDataValue()
-    {
-        return "DELETE FROM patientdatavalue AS d " +
-            "USING patientdatavaluearchive AS a " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid " +
-            "AND d.timestamp<a.timestamp;";
-    }
-
-    @Override
-    public String deleteOldestOverlappingPatientArchiveData()
-    {
-        return "DELETE FROM patientdatavalue AS d " +
-            "USING patientdatavaluearchive AS a " +
-            "WHERE d.programstageinstanceid=a.programstageinstanceid " +
-            "AND d.dataelementid=a.dataelementid " +
-            "AND a.timestamp<=d.timestamp;";
-    }
-
-    @Override
     public String queryDataElementStructureForOrgUnit()
     {
         StringBuffer sqlsb = new StringBuffer();
+        
         sqlsb.append( "(SELECT DISTINCT de.dataelementid, (de.name || ' ' || cc.categoryoptioncomboname) AS DataElement " );
         sqlsb.append( "FROM dataelement AS de " );
         sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
         sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
         sqlsb.append( "ORDER BY DataElement) " );
+        
         return sqlsb.toString();           
     }
 

=== removed directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive'
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchiveDataAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchiveDataAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchiveDataAction.java	1970-01-01 00:00:00 +0000
@@ -1,123 +0,0 @@
-package org.hisp.dhis.dataadmin.action.dataarchive;
-
-/*
- * Copyright (c) 2004-2012, 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.Date;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.dataarchive.DataArchiveOperation;
-import org.hisp.dhis.dataarchive.DataArchiveService;
-import org.hisp.dhis.dataarchive.DataEliminationStrategy;
-import org.hisp.dhis.system.util.DateUtils;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class ArchiveDataAction
-    implements Action
-{
-    private static final Log log = LogFactory.getLog( ArchiveDataAction.class );
-    
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataArchiveService dataArchiveService;
-
-    public void setDataArchiveService( DataArchiveService dataArchiveService )
-    {
-        this.dataArchiveService = dataArchiveService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private String startDate;
-
-    public void setStartDate( String startDate )
-    {
-        this.startDate = startDate;
-    }
-
-    private String endDate;
-    
-    public void setEndDate( String endDate )
-    {
-        this.endDate = endDate;
-    }
-
-    private String operation;
-
-    public void setOperation( String operation )
-    {
-        this.operation = operation;
-    }
-
-    private String strategy;
-
-    public void setStrategy( String strategy )
-    {
-        this.strategy = strategy;
-    }
-
-    // -------------------------------------------------------------------------
-    // Output
-    // -------------------------------------------------------------------------
-
-    private int number;
-
-    public int getNumber()
-    {
-        return number;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        Date startDate_ = DateUtils.getMediumDate( startDate );
-        
-        Date endDate_ = DateUtils.getMediumDate( endDate );
-        
-        DataArchiveOperation operation_ = DataArchiveOperation.valueOf( operation.toUpperCase() );
-        
-        DataEliminationStrategy strategy_ = DataEliminationStrategy.valueOf( strategy.toUpperCase() );
-        
-        log.info( "Archiving: start date: " + startDate + ", end date: " + endDate + ", operation: " + operation + ", strategy: " + strategy );
-        
-        number = dataArchiveService.archiveData( startDate_, endDate_, operation_, strategy_ );
-        
-        return SUCCESS;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchivePatientDataAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchivePatientDataAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/ArchivePatientDataAction.java	1970-01-01 00:00:00 +0000
@@ -1,123 +0,0 @@
-package org.hisp.dhis.dataadmin.action.dataarchive;
-
-/*
- * Copyright (c) 2004-2012, 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.Date;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.dataarchive.DataArchiveOperation;
-import org.hisp.dhis.dataarchive.DataArchiveService;
-import org.hisp.dhis.dataarchive.DataEliminationStrategy;
-import org.hisp.dhis.system.util.DateUtils;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Chau Thu Tran
- */
-public class ArchivePatientDataAction
-    implements Action
-{
-    private static final Log log = LogFactory.getLog( ArchivePatientDataAction.class );
-    
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataArchiveService dataArchiveService;
-
-    public void setDataArchiveService( DataArchiveService dataArchiveService )
-    {
-        this.dataArchiveService = dataArchiveService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private String startDate;
-
-    public void setStartDate( String startDate )
-    {
-        this.startDate = startDate;
-    }
-
-    private String endDate;
-    
-    public void setEndDate( String endDate )
-    {
-        this.endDate = endDate;
-    }
-
-    private String operation;
-
-    public void setOperation( String operation )
-    {
-        this.operation = operation;
-    }
-
-    private String strategy;
-
-    public void setStrategy( String strategy )
-    {
-        this.strategy = strategy;
-    }
-
-    // -------------------------------------------------------------------------
-    // Output
-    // -------------------------------------------------------------------------
-
-    private int number;
-
-    public int getNumber()
-    {
-        return number;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        Date startDate_ = DateUtils.getMediumDate( startDate );
-        
-        Date endDate_ = DateUtils.getMediumDate( endDate );
-        
-        DataArchiveOperation operation_ = DataArchiveOperation.valueOf( operation.toUpperCase() );
-        
-        DataEliminationStrategy strategy_ = DataEliminationStrategy.valueOf( strategy.toUpperCase() );
-        
-        log.info( "Archiving: start date: " + startDate + ", end date: " + endDate + ", operation: " + operation + ", strategy: " + strategy );
-        
-        number = dataArchiveService.archivePatientData( startDate_, endDate_, operation_, strategy_ );
-        
-        return SUCCESS;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapingPatientValuesAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapingPatientValuesAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapingPatientValuesAction.java	1970-01-01 00:00:00 +0000
@@ -1,72 +0,0 @@
-package org.hisp.dhis.dataadmin.action.dataarchive;
-
-/*
- * Copyright (c) 2004-2012, 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 org.hisp.dhis.dataarchive.DataArchiveService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class GetNumberOfOverlapingPatientValuesAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataArchiveService dataArchiveService;
-
-    public void setDataArchiveService( DataArchiveService dataArchiveService )
-    {
-        this.dataArchiveService = dataArchiveService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    private int number;
-
-    public int getNumber()
-    {
-        return number;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        number = dataArchiveService.getNumberOfOverlappingPatientValues();
-        
-        return SUCCESS;
-    }   
-}

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapsAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataarchive/GetNumberOfOverlapsAction.java	1970-01-01 00:00:00 +0000
@@ -1,72 +0,0 @@
-package org.hisp.dhis.dataadmin.action.dataarchive;
-
-/*
- * Copyright (c) 2004-2012, 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 org.hisp.dhis.dataarchive.DataArchiveService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class GetNumberOfOverlapsAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataArchiveService dataArchiveService;
-
-    public void setDataArchiveService( DataArchiveService dataArchiveService )
-    {
-        this.dataArchiveService = dataArchiveService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    private int number;
-
-    public int getNumber()
-    {
-        return number;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        number = dataArchiveService.getNumberOfOverlappingValues();
-        
-        return SUCCESS;
-    }   
-}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2013-01-23 11:54:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2013-04-30 08:03:51 +0000
@@ -115,32 +115,6 @@
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
   </bean>
 
-  <!-- Data archive -->
-
-  <bean id="org.hisp.dhis.dataadmin.action.dataarchive.ArchiveDataAction"
-      class="org.hisp.dhis.dataadmin.action.dataarchive.ArchiveDataAction"
-      scope="prototype">
-    <property name="dataArchiveService" ref="org.hisp.dhis.dataarchive.DataArchiveService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dataadmin.action.dataarchive.ArchivePatientDataAction"
-      class="org.hisp.dhis.dataadmin.action.dataarchive.ArchivePatientDataAction"
-      scope="prototype">
-    <property name="dataArchiveService" ref="org.hisp.dhis.dataarchive.DataArchiveService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dataadmin.action.dataarchive.GetNumberOfOverlapsAction"
-      class="org.hisp.dhis.dataadmin.action.dataarchive.GetNumberOfOverlapsAction"
-      scope="prototype">
-    <property name="dataArchiveService" ref="org.hisp.dhis.dataarchive.DataArchiveService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dataadmin.action.dataarchive.GetNumberOfOverlapingPatientValuesAction"
-      class="org.hisp.dhis.dataadmin.action.dataarchive.GetNumberOfOverlapingPatientValuesAction"
-      scope="prototype">
-    <property name="dataArchiveService" ref="org.hisp.dhis.dataarchive.DataArchiveService" />
-  </bean>
-
   <!-- Min/Max validation -->
 
   <bean id="org.hisp.dhis.dataadmin.action.minmaxvalidation.GetMinMaxValidationParamsAction"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm	2012-03-04 15:54:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm	2013-04-30 08:03:51 +0000
@@ -10,8 +10,6 @@
 <ul class="introList">
     #introListImgItem( "displayDataBrowserForm.action" "data_browser" "databrowser" )
     #introListImgItem( "displayDataIntegrityForm.action" "data_integrity" "dataintegrity" )
-    #introListImgItem( "displayDataArchiveForm.action" "data_archive" "dataarchive" )
-	#introListImgItem( "displayPatientDataArchiveForm.action" "patient_data_archive" "dataarchive" )
     #introListImgItem( "displayMaintenanceForm.action" "maintenance" "maintenance" )
     #introListImgItem( "displayResourceTableForm.action" "resource_table" "resourcetable" )
     #introListImgItem( "showSqlViewListForm.action" "sql_view" "sqlview" )

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataArchive.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataArchive.js	2010-10-24 15:41:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataArchive.js	1970-01-01 00:00:00 +0000
@@ -1,72 +0,0 @@
-
-$( document ).ready( function()
-{
-	showLoader();
-	
-	$.getJSON( "getNumberOfOverlaps.action", {}, displayNumberOfOverlaps );
-} );
-
-function displayNumberOfOverlaps( json )
-{
-	hideLoader();
-	
-    if ( json.number != "0" )
-    {
-        $( "div#overlapsDiv" ).show();
-        $( "span#number" ).html( json.number );
-    }
-    else
-    {
-    	$( "div#noOverlapsDiv" ).show();
-    }
-}
-
-function archive( operation )
-{
-	var startDate = $( "#startDate" ).val();
-	var endDate = $( "#endDate" ).val();
-    var strategy = $( "input[name='strategy']:checked" ).val();
-    
-    var message = operation == "archive" ? i18n_archiving : i18n_unarchiving;
-    
-    setWaitMessage( message );
-    
-    $.getJSON( 
-        "archiveData.action",
-        {
-        	"startDate": startDate,
-        	"endDate": endDate,
-        	"operation": operation,
-        	"strategy": strategy
-        },
-        function( json )
-        {
-        	setMessage( message + " " + i18n_done_number_of_values + " " + json.number + "." );
-        }
-    );
-}
-
-function patientArchive( operation )
-{
-	var startDate = $( "#startDate" ).val();
-	var endDate = $( "#endDate" ).val();
-    var strategy = $( "input[name='strategy']:checked" ).val();
-    
-    var message = operation == "archive" ? i18n_archiving : i18n_unarchiving;
-    
-    setWaitMessage( message );
-    
-    $.getJSON( 
-        "archivePatientData.action",
-        {
-        	"startDate": startDate,
-        	"endDate": endDate,
-        	"operation": operation,
-        	"strategy": strategy
-        },
-        function( json )
-        {
-        	setMessage( message + " " + i18n_done_number_of_values + " " + json.number + "." );
-        }
-    );
-}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm	2012-03-06 17:26:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm	2013-04-30 08:03:51 +0000
@@ -4,8 +4,6 @@
 <ul>
 	<li><a href="displayDataBrowserForm.action">$i18n.getString( "data_browser" )&nbsp;</a></li>
     <li><a href="displayDataIntegrityForm.action">$i18n.getString( "data_integrity" )&nbsp;</a></li>
-    <li><a href="displayDataArchiveForm.action">$i18n.getString( "data_archive" )&nbsp;</a></li>
-	<li><a href="displayPatientDataArchiveForm.action">$i18n.getString( "patient_data_archive" )&nbsp;</a></li>
 	<li><a href="displayMaintenanceForm.action">$i18n.getString( "maintenance" )&nbsp;</a></li>
 	<li><a href="displayResourceTableForm.action">$i18n.getString( "resource_table" )&nbsp;</a></li>
 	<li><a href="showSqlViewListForm.action">$i18n.getString( "sql_view" )&nbsp;</a></li>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm	2013-03-16 05:57:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm	2013-04-30 08:03:51 +0000
@@ -113,5 +113,3 @@
 </table>
 	
 </form>
-
-<span id="message"#if ( $message ) style="display:block"#end>$!message</span>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm	2013-03-16 05:57:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm	2013-04-30 08:03:51 +0000
@@ -478,5 +478,3 @@
 </table>
 
 </form>
-
-<span id="message"></span>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js	2013-03-14 10:27:27 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js	2013-04-30 08:03:51 +0000
@@ -2,13 +2,13 @@
 {
     if ( $( "#reportForm #name" ).val().trim().length == 0  )
    	{
-   		setMessage( i18n_specify_name );
+    	setHeaderDelayMessage( i18n_specify_name );
    		return false;
    	}
 
     if ( $( "#reportForm #id" ).val().trim().length == 0 && !hasText( "upload" ) )
    	{
-   		setMessage( i18n_please_specify_file );
+    	setHeaderDelayMessage( i18n_please_specify_file );
    		return false;
    	}
 

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleGroupForm.vm	2012-10-17 18:53:29 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleGroupForm.vm	2013-04-30 08:03:51 +0000
@@ -81,5 +81,3 @@
 </p>
 
 </form>
-
-<span id="message"></span>