← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8748: Codestyle

 

------------------------------------------------------------
revno: 8748
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-10-29 14:12:34 +0300
message:
  Codestyle
modified:
  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


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-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	2012-10-03 18:11:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java	2012-10-29 11:12:34 +0000
@@ -37,7 +37,11 @@
 public interface StatementBuilder
 {
     final String QUOTE = "'";
-    
+
+    //--------------------------------------------------------------------------
+    // General
+    //--------------------------------------------------------------------------
+
     /**
      * Encodes the provided SQL value.
      * 
@@ -109,13 +113,6 @@
     String getDeleteZeroDataValues();
     
     /**
-     * Returns the maximum number of columns in a table.
-     * 
-     * @return the maximum number of columns in a table.
-     */
-    int getMaximumNumberOfColumns();
-    
-    /**
      *  Drop Dataset foreign key for DataEntryForm table
      *  
      * @return
@@ -138,7 +135,17 @@
     
     String getDeflatedDataValues( int dataElementId, String dataElementName, int categoryOptionComboId,
     	String periodIds, int organisationUnitId, String organisationUnitName, int lowerBound, int upperBound );
-    	
+    
+    String limitRecord( int min, int max );
+    
+    String getAddDate( String dateField, int days );
+    
+    String getPatientFullName();
+
+    //--------------------------------------------------------------------------
+    // Archiving
+    //--------------------------------------------------------------------------
+
     String archiveData( String startDate, String endDate );
     
     String unArchiveData( String startDate, String endDate );
@@ -166,10 +173,4 @@
     String queryDataElementStructureForOrgUnit();
 
     String queryRawDataElementsForOrgUnitBetweenPeriods( Integer orgUnitId, List<Integer> betweenPeriodIds);
-    
-    String limitRecord( int min, int max );
-    
-    String getAddDate( String dateField, int days );
-    
-    String getPatientFullName();
 }

=== 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	2012-10-03 18:11:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2012-10-29 11:12:34 +0000
@@ -39,16 +39,19 @@
 public class H2StatementBuilder
     extends AbstractStatementBuilder
 {
+    @Override
     public String getDoubleColumnType()
     {
         return "DOUBLE";
     }
 
+    @Override
     public String getVacuum( String table )
     {
         return null;
     }
-    
+
+    @Override
     public String getPeriodIdentifierStatement( Period period )
     {
         return
@@ -56,7 +59,8 @@
             "AND startdate='" + getSqlDateString( period.getStartDate() ) + "' " +
             "AND enddate='" + getSqlDateString( period.getEndDate() ) + "'";
     }
-        
+    
+    @Override
     public String getDeleteZeroDataValues()
     {
         return
@@ -64,11 +68,7 @@
             "WHERE datavalue.value = '0'";
     }
 
-    public int getMaximumNumberOfColumns()
-    {
-        return 1580; // TODO verify
-    }
-
+    @Override
     public String getDropDatasetForeignKeyForDataEntryFormTable()
     {
         return  "ALTER TABLE dataentryform DROP CONSTRAINT fk_dataentryform_datasetid;";
@@ -122,7 +122,8 @@
             + "AND d2.dataelementid="
             + sourceDataElementId + " AND d2.categoryoptioncomboid=" + sourceCategoryOptionComboId + ";";
     }
-    
+
+    @Override
     public String getStandardDeviation( int dataElementId, int categoryOptionComboId, int organisationUnitId ){
     	
         return "SELECT STDDEV( CAST( value AS " + getDoubleColumnType() + " ) ) FROM datavalue " +
@@ -130,7 +131,8 @@
 	    "AND categoryoptioncomboid='" + categoryOptionComboId + "' " +
 	    "AND sourceid='" + organisationUnitId + "'";
     }
-    
+
+    @Override
     public String getAverage( int dataElementId, int categoryOptionComboId, int organisationUnitId )
     {    
       	 return "SELECT AVG( CAST( value AS " + getDoubleColumnType() + " ) ) FROM datavalue " +
@@ -138,7 +140,8 @@
              "AND categoryoptioncomboid='" + categoryOptionComboId + "' " +
              "AND sourceid='" + organisationUnitId + "'";
     }
-    
+
+    @Override
     public String getDeflatedDataValues( int dataElementId, String dataElementName, int categoryOptionComboId,
     		String periodIds, int organisationUnitId, String organisationUnitName, int lowerBound, int upperBound )
     {	
@@ -157,7 +160,26 @@
             "AND ( CAST( dv.value AS " + getDoubleColumnType() + " ) < '" + lowerBound + "' " +
             "OR CAST( dv.value AS " + getDoubleColumnType() + " ) > '" + upperBound + "' )";
     }
-    
+
+    @Override
+    public String limitRecord( int min, int max )
+    {
+        return " LIMIT " + max + " OFFSET " + min;
+    }
+
+    @Override
+    public String getAddDate( String dateField, int days )
+    {
+        return "DATEADD('DAY'," + days + "," + dateField + ")";
+    }
+
+    @Override
+    public String getPatientFullName()
+    {
+        return  "concat( firstname, \" \",middleName , \" \" , lastname)";
+    }
+
+    @Override
     public String archiveData( String startDate, String endDate )
     {
        return "DELETE FROM datavalue AS a " +
@@ -167,7 +189,8 @@
             "AND p.startdate>='" + startDate + "' " +
             "AND p.enddate<='" + endDate + "')";
     }
-   
+
+    @Override
     public String unArchiveData( String startDate, String endDate )
     {
        return "DELETE FROM datavaluearchive AS a " +
@@ -177,7 +200,8 @@
            "AND p.startdate>='" + startDate + "' " +
            "AND p.enddate<='" + endDate + "')";
     }
-   
+
+    @Override
     public String deleteRegularOverlappingData()
     {       
        return "DELETE FROM datavalue AS d " +
@@ -190,6 +214,7 @@
 
     }
 
+    @Override
     public String deleteArchivedOverlappingData()
     {
        return "DELETE FROM datavaluearchive AS a " +
@@ -201,6 +226,7 @@
            "AND a.categoryoptioncomboid=d.categoryoptioncomboid)";
     }
 
+    @Override
     public String deleteOldestOverlappingDataValue()
     {       
        return "DELETE FROM datavalue AS d " +
@@ -212,7 +238,8 @@
            "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
            "AND d.lastupdated<a.lastupdated)";
     }
-   
+
+    @Override
     public String deleteOldestOverlappingArchiveData()
     {       
        return "DELETE FROM datavaluearchive AS a " +
@@ -224,7 +251,8 @@
            "AND a.categoryoptioncomboid=d.categoryoptioncomboid " +
            "AND a.lastupdated<=d.lastupdated)";
     }
-    
+
+    @Override
     public String archivePatientData ( String startDate, String endDate )
     {
         return "DELETE FROM patientdatavalue AS pdv " 
@@ -234,7 +262,8 @@
             + "WHERE pi.enddate >= '" + startDate + "' "
             + "AND pi.enddate <= '" +  endDate + "';";
     }
-    
+
+    @Override
     public String unArchivePatientData ( String startDate, String endDate )
     {
         return "DELETE FROM patientdatavaluearchive AS pdv " 
@@ -245,6 +274,7 @@
             + "AND pi.enddate <= '" +  endDate + "';";
     }
 
+    @Override
     public String deleteRegularOverlappingPatientData()
     {
         return "DELETE FROM patientdatavalue AS d " +
@@ -253,7 +283,8 @@
             "AND d.dataelementid=a.dataelementid " +
             "AND d.timestamp<a.timestamp;";
     }
-    
+
+    @Override
     public String deleteArchivedOverlappingPatientData()
     {
         return "DELETE FROM patientdatavaluearchive AS a " +
@@ -261,7 +292,8 @@
             "WHERE d.programstageinstanceid=a.programstageinstanceid " +
             "AND d.dataelementid=a.dataelementid ";
     }
-    
+
+    @Override
     public String deleteOldestOverlappingPatientDataValue()
     {
         return "DELETE FROM patientdatavalue AS d " +
@@ -270,7 +302,8 @@
             "AND d.dataelementid=a.dataelementid " +
             "AND d.timestamp<a.timestamp;";
     }
-    
+
+    @Override
     public String deleteOldestOverlappingPatientArchiveData()
     {
         return "DELETE FROM patientdatavalue AS d " +
@@ -279,7 +312,8 @@
             "AND d.dataelementid=a.dataelementid " +
             "AND a.timestamp<=d.timestamp;";
     }
-    
+
+    @Override
     public String queryDataElementStructureForOrgUnit()
     {
         StringBuffer sqlsb = new StringBuffer();
@@ -291,7 +325,8 @@
         
         return sqlsb.toString();
     }
-    
+
+    @Override
     public String queryRawDataElementsForOrgUnitBetweenPeriods(Integer orgUnitId, List<Integer> betweenPeriodIds)
     {
         StringBuffer sqlsb = new StringBuffer();
@@ -316,20 +351,4 @@
         
         return sqlsb.toString();
     }
-    
-    public String limitRecord( int min, int max )
-    {
-        return " LIMIT " + max + " OFFSET " + min;
-    }
-    
-    public String getAddDate( String dateField, int days )
-    {
-        return "DATEADD('DAY'," + days + "," + dateField + ")";
-    }
-    
-    public String getPatientFullName()
-    {
-        return  "concat( firstname, \" \",middleName , \" \" , lastname)";
-    }
-
 }

=== 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	2012-10-03 18:11:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2012-10-29 11:12:34 +0000
@@ -39,16 +39,19 @@
 public class MySQLStatementBuilder
     extends AbstractStatementBuilder
 {
+    @Override
     public String getDoubleColumnType()
     {
         return "DECIMAL";
     }
 
+    @Override
     public String getVacuum( String table )
     {
         return null;
     }
-    
+
+    @Override
     public String getPeriodIdentifierStatement( Period period )
     {
         return
@@ -57,6 +60,7 @@
             "AND enddate='" + getSqlDateString( period.getEndDate() ) + "'";
     }    
 
+    @Override
     public String getDeleteZeroDataValues()
     {
         return
@@ -66,12 +70,8 @@
             "AND dataelement.aggregationtype = 'sum' " +
             "AND datavalue.value = '0'";
     }
-    
-    public int getMaximumNumberOfColumns()
-    {
-        return 720;
-    }
 
+    @Override
     public String getDropDatasetForeignKeyForDataEntryFormTable()
     {
         return  "ALTER TABLE dataentryform DROP FOREIGN KEY fk_dataentryform_datasetid;" ;
@@ -126,7 +126,8 @@
             + sourceDataElementId
             + " AND d2.categoryoptioncomboid=" + sourceCategoryOptionComboId + ";";
     }
-    
+
+    @Override
     public String getStandardDeviation( int dataElementId, int categoryOptionComboId, int organisationUnitId ){
     	
     	return "SELECT STDDEV( value ) FROM datavalue " +
@@ -134,14 +135,16 @@
             "AND categoryoptioncomboid='" + categoryOptionComboId + "' " +
             "AND sourceid='" + organisationUnitId + "'";        
     }
-    
+
+    @Override
     public String getAverage( int dataElementId, int categoryOptionComboId, int organisationUnitId ){
     	 return "SELECT AVG( value ) FROM datavalue " +
             "WHERE dataelementid='" + dataElementId + "' " +
             "AND categoryoptioncomboid='" + categoryOptionComboId + "' " +
             "AND sourceid='" + organisationUnitId + "'";
     }
-    
+
+    @Override
     public String getDeflatedDataValues( int dataElementId, String dataElementName, int categoryOptionComboId,
     		String periodIds, int organisationUnitId, String organisationUnitName, int lowerBound, int upperBound )
     {    	
@@ -159,8 +162,9 @@
             "AND dv.sourceid='" + organisationUnitId + "' " +
             "AND ( dv.value < '" + lowerBound + "' " +
             "OR  dv.value > '" + upperBound + "' )";
-   }
-   
+    }
+
+    @Override
     public String archiveData( String startDate, String endDate )
     {
         return "DELETE d FROM datavalue AS d " +
@@ -169,7 +173,8 @@
             "AND p.startdate>='" + startDate + "' " +
             "AND p.enddate<='" + endDate + "'";
     }
-    
+
+    @Override
     public String unArchiveData( String startDate, String endDate )
     {    
         return "DELETE a FROM datavaluearchive AS a " +
@@ -178,7 +183,8 @@
             "AND p.startdate>='" + startDate + "' " +
             "AND p.enddate<='" + endDate + "'";
     }
-    
+
+    @Override
     public String deleteRegularOverlappingData()
     {    
         return "DELETE d FROM datavalue AS d " +
@@ -188,7 +194,8 @@
             "AND d.sourceid=a.sourceid " +
             "AND d.categoryoptioncomboid=a.categoryoptioncomboid";
     }
-    
+
+    @Override
     public String deleteArchivedOverlappingData()
     {
         return "DELETE a FROM datavaluearchive AS a " +
@@ -198,7 +205,8 @@
             "AND a.sourceid=d.sourceid " +
             "AND a.categoryoptioncomboid=d.categoryoptioncomboid";
     }
-    
+
+    @Override
     public String deleteOldestOverlappingDataValue()
     {    
         return "DELETE d FROM datavalue AS d " +
@@ -209,7 +217,8 @@
             "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
             "AND d.lastupdated<a.lastupdated";
     }
-    
+
+    @Override
     public String deleteOldestOverlappingArchiveData()
     {       
         return "DELETE a FROM datavaluearchive AS a " +
@@ -220,7 +229,26 @@
             "AND a.categoryoptioncomboid=d.categoryoptioncomboid " +
             "AND a.lastupdated<=d.lastupdated";
     }
-    
+
+    @Override
+    public String limitRecord( int min, int max )
+    {
+        return " LIMIT " + min + " ," + max;
+    }
+
+    @Override
+    public String getAddDate( String dateField, int days )
+    {
+        return "ADDDATE(" + dateField + "," + days + ")";
+    }
+
+    @Override
+    public String getPatientFullName()
+    {
+        return  "concat( firstname, \" \",middleName , \" \" , lastname)";
+    }
+
+    @Override
     public String archivePatientData ( String startDate, String endDate )
     {
         return "DELETE pdv FROM patientdatavalue AS pdv "
@@ -231,7 +259,8 @@
             + "WHERE pi.enddate >= '" + startDate + "' "
             +    "AND pi.enddate <= '" +  endDate + "';";
     }
-   
+
+    @Override
     public String unArchivePatientData ( String startDate, String endDate )
     {
         return "DELETE pdv FROM patientdatavaluearchive AS pdv "
@@ -242,7 +271,8 @@
             + "WHERE pi.enddate >= '" + startDate + "' "
             +    "AND pi.enddate <= '" +  endDate + "';";
     }
-   
+
+    @Override
     public String deleteRegularOverlappingPatientData()
     {
         return "DELETE d FROM patientdatavalue AS d " +
@@ -250,7 +280,8 @@
             "WHERE d.programstageinstanceid=a.programstageinstanceid " +
             "AND d.dataelementid=a.dataelementid; " ;
     }
-   
+
+    @Override
     public String deleteArchivedOverlappingPatientData()
     {
         return "DELETE a FROM patientdatavaluearchive AS a " +
@@ -258,7 +289,8 @@
             "WHERE d.programstageinstanceid=a.programstageinstanceid " +
             "AND d.dataelementid=a.dataelementid ";
     }
-   
+
+    @Override
     public String deleteOldestOverlappingPatientDataValue()
     {
         return "DELETE d FROM patientdatavalue AS d " +
@@ -267,7 +299,8 @@
             "AND d.dataelementid=a.dataelementid " +
             "AND d.timestamp<a.timestamp;";
     }
-   
+
+    @Override
     public String deleteOldestOverlappingPatientArchiveData()
     {
         return "DELETE a FROM patientdatavaluearchive AS a " +
@@ -277,6 +310,7 @@
             "AND a.timestamp<=d.timestamp;";
     }
 
+    @Override
     public String queryDataElementStructureForOrgUnit()
     {
         StringBuffer sqlsb = new StringBuffer();
@@ -288,6 +322,7 @@
         return sqlsb.toString();
     }
 
+    @Override
     public String queryRawDataElementsForOrgUnitBetweenPeriods(Integer orgUnitId, List<Integer> betweenPeriodIds)
     {
         StringBuffer sqlsb = new StringBuffer();
@@ -311,21 +346,5 @@
         }
         
         return sqlsb.toString();
-    }
-    
-    public String limitRecord( int min, int max )
-    {
-        return " LIMIT " + min + " ," + max;
-    }
-
-    public String getAddDate( String dateField, int days )
-    {
-        return "ADDDATE(" + dateField + "," + days + ")";
-    }
-    
-    public String getPatientFullName()
-    {
-        return  "concat( firstname, \" \",middleName , \" \" , lastname)";
-    }
-    
+    }    
 }

=== 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	2012-10-03 18:11:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2012-10-29 11:12:34 +0000
@@ -39,16 +39,19 @@
 public class PostgreSQLStatementBuilder
     extends AbstractStatementBuilder
 {    
+    @Override
     public String getDoubleColumnType()
     {
         return "DOUBLE PRECISION";
     }
 
+    @Override
     public String getVacuum( String table )
     {
         return "vacuum analyze " + table + ";";
     }
-    
+
+    @Override
     public String getPeriodIdentifierStatement( Period period )
     {
         return
@@ -57,6 +60,7 @@
             "AND enddate='" + getSqlDateString( period.getEndDate() ) + "'";
     }
 
+    @Override
     public String getDeleteZeroDataValues()
     {
         return
@@ -67,11 +71,7 @@
             "AND datavalue.value = '0'";
     }
 
-    public int getMaximumNumberOfColumns()
-    {
-        return 1580; // TODO verify
-    }
-
+    @Override
     public String getDropDatasetForeignKeyForDataEntryFormTable()
     {
         return "ALTER TABLE dataentryform DROP CONSTRAINT fk_dataentryform_datasetid;" ;
@@ -125,7 +125,8 @@
             + "AND d2.dataelementid="
             + sourceDataElementId + " AND d2.categoryoptioncomboid=" + sourceCategoryOptionComboId + ";";
     }
-    
+
+    @Override
     public String getStandardDeviation( int dataElementId, int categoryOptionComboId, int organisationUnitId )
     {
     	return "SELECT STDDEV( CAST( value AS " + getDoubleColumnType() + " ) ) FROM datavalue " +
@@ -133,7 +134,8 @@
 	    "AND categoryoptioncomboid='" + categoryOptionComboId + "' " +
 	    "AND sourceid='" + organisationUnitId + "'";
     }
-    
+
+    @Override
     public String getAverage( int dataElementId, int categoryOptionComboId, int organisationUnitId )
     {
        	 return "SELECT AVG( CAST( value AS " + getDoubleColumnType() + " ) ) FROM datavalue " +
@@ -141,7 +143,8 @@
              "AND categoryoptioncomboid='" + categoryOptionComboId + "' " +
              "AND sourceid='" + organisationUnitId + "'";
     }
-   
+
+    @Override
     public String getDeflatedDataValues( int dataElementId, String dataElementName, int categoryOptionComboId,
         String periodIds, int organisationUnitId, String organisationUnitName, int lowerBound, int upperBound )
     {
@@ -160,68 +163,92 @@
             "AND ( CAST( dv.value AS " + getDoubleColumnType() + " ) < '" + lowerBound + "' " +
             "OR CAST( dv.value AS " + getDoubleColumnType() + " ) > '" + upperBound + "' )";
     }
-    
+
+    @Override
+    public String limitRecord( int min, int max )
+    {
+        return " LIMIT " + max + " OFFSET " + min;
+    }
+
+    @Override
+    public String getAddDate( String dateField, int days )
+    {
+        return "(" + dateField + "+" + days + ")";
+    }
+
+    @Override
+    public String getPatientFullName()
+    {
+        return  "firstname || ' ' || middleName || ' ' || lastname";
+    }
+
+    @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 + "'";
-    }
-  
+        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 + "'";
+        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";
+        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";
+        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";
+        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";
+        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 " 
@@ -231,7 +258,8 @@
             + "AND pi.enddate >= '" + startDate + "' "
             + "AND pi.enddate <= '" +  endDate + "';";
     }
-    
+
+    @Override
     public String unArchivePatientData ( String startDate, String endDate )
     {
         return "DELETE FROM patientdatavaluearchive AS pdv " 
@@ -241,7 +269,8 @@
             + "AND pi.enddate >= '" + startDate + "' "
             + "AND pi.enddate <= '" +  endDate + "';";
     }
-    
+
+    @Override
     public String deleteRegularOverlappingPatientData()
     {
         return "DELETE FROM patientdatavalue AS d " +
@@ -249,7 +278,8 @@
             "WHERE d.programstageinstanceid=a.programstageinstanceid " +
             "AND d.dataelementid=a.dataelementid; ";
     }
-    
+
+    @Override
     public String deleteArchivedOverlappingPatientData()
     {
         return "DELETE FROM patientdatavaluearchive AS a " +
@@ -257,7 +287,8 @@
             "WHERE d.programstageinstanceid=a.programstageinstanceid " +
             "AND d.dataelementid=a.dataelementid ";
     }
-    
+
+    @Override
     public String deleteOldestOverlappingPatientDataValue()
     {
         return "DELETE FROM patientdatavalue AS d " +
@@ -266,7 +297,8 @@
             "AND d.dataelementid=a.dataelementid " +
             "AND d.timestamp<a.timestamp;";
     }
-    
+
+    @Override
     public String deleteOldestOverlappingPatientArchiveData()
     {
         return "DELETE FROM patientdatavalue AS d " +
@@ -275,7 +307,8 @@
             "AND d.dataelementid=a.dataelementid " +
             "AND a.timestamp<=d.timestamp;";
     }
-    
+
+    @Override
     public String queryDataElementStructureForOrgUnit()
     {
         StringBuffer sqlsb = new StringBuffer();
@@ -287,6 +320,7 @@
         return sqlsb.toString();           
     }
 
+    @Override
     public String queryRawDataElementsForOrgUnitBetweenPeriods(Integer orgUnitId, List<Integer> betweenPeriodIds)
     {
         StringBuffer sqlsb = new StringBuffer();
@@ -311,19 +345,4 @@
         
         return sqlsb.toString();
     }
-    
-    public String limitRecord( int min, int max )
-    {
-        return " LIMIT " + max + " OFFSET " + min;
-    }
-    
-    public String getAddDate( String dateField, int days )
-    {
-        return "(" + dateField + "+" + days + ")";
-    }
-    
-    public String getPatientFullName()
-    {
-        return  "firstname || ' ' || middleName || ' ' || lastname";
-    }
 }