← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8749: Moved some methods in *StatementBuilder to AbstractStatementBuilder

 

------------------------------------------------------------
revno: 8749
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-10-29 14:18:39 +0300
message:
  Moved some methods in *StatementBuilder to AbstractStatementBuilder
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/AbstractStatementBuilder.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-29 11:12:34 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java	2012-10-29 11:18:39 +0000
@@ -112,13 +112,6 @@
      */
     String getDeleteZeroDataValues();
     
-    /**
-     *  Drop Dataset foreign key for DataEntryForm table
-     *  
-     * @return
-     */
-    String getDropDatasetForeignKeyForDataEntryFormTable();
-    
     String getMoveDataValueToDestination( int sourceId, int destinationId );
 
     String getSummarizeDestinationAndSourceWhereMatching( int sourceId, int destinationId );

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java	2012-07-26 16:50:38 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java	2012-10-29 11:18:39 +0000
@@ -27,7 +27,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.system.util.DateUtils.getSqlDateString;
+
 import org.hisp.dhis.jdbc.StatementBuilder;
+import org.hisp.dhis.period.Period;
 
 /**
  * @author Lars Helge Overland
@@ -35,6 +38,7 @@
 public abstract class AbstractStatementBuilder
     implements StatementBuilder
 {
+    @Override
     public String encode( String value )
     {
         if ( value != null )
@@ -46,6 +50,16 @@
         return QUOTE + value + QUOTE;
     }
 
+    @Override
+    public String getPeriodIdentifierStatement( Period period )
+    {
+        return
+            "SELECT periodid FROM period WHERE periodtypeid=" + period.getPeriodType().getId() + " " + 
+            "AND startdate='" + getSqlDateString( period.getStartDate() ) + "' " +
+            "AND enddate='" + getSqlDateString( period.getEndDate() ) + "'";
+    }
+
+    @Override
     public String getCreateAggregatedDataValueTable( boolean temp )
     {
         return
@@ -59,6 +73,7 @@
             "value " + getDoubleColumnType() + " );";
     }
 
+    @Override
     public String getCreateAggregatedOrgUnitDataValueTable( boolean temp )
     {
         return
@@ -72,7 +87,8 @@
             "level INTEGER, " +
             "value " + getDoubleColumnType() + " );";
     }
-    
+
+    @Override
     public String getCreateAggregatedIndicatorTable( boolean temp )
     {
         return
@@ -89,6 +105,7 @@
             "denominatorvalue " + getDoubleColumnType() + " );";
     }
 
+    @Override
     public String getCreateAggregatedOrgUnitIndicatorTable( boolean temp )
     {
         return
@@ -106,6 +123,7 @@
             "denominatorvalue " + getDoubleColumnType() + " );";
     }
 
+    @Override
     public String getCreateDataSetCompletenessTable()
     {
         return
@@ -120,7 +138,8 @@
             "value " + getDoubleColumnType() + ", " +
             "valueOnTime " + getDoubleColumnType() + " );";
     }
-    
+
+    @Override
     public String getCreateOrgUnitDataSetCompletenessTable()
     {
         return

=== 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-29 11:12:34 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2012-10-29 11:18:39 +0000
@@ -27,12 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.system.util.DateUtils.getSqlDateString;
-
 import java.util.List;
 
-import org.hisp.dhis.period.Period;
-
 /**
  * @author Lars Helge Overland
  */
@@ -50,15 +46,6 @@
     {
         return null;
     }
-
-    @Override
-    public String getPeriodIdentifierStatement( Period period )
-    {
-        return
-            "SELECT periodid FROM period WHERE periodtypeid=" + period.getPeriodType().getId() + " " + 
-            "AND startdate='" + getSqlDateString( period.getStartDate() ) + "' " +
-            "AND enddate='" + getSqlDateString( period.getEndDate() ) + "'";
-    }
     
     @Override
     public String getDeleteZeroDataValues()
@@ -69,12 +56,6 @@
     }
 
     @Override
-    public String getDropDatasetForeignKeyForDataEntryFormTable()
-    {
-        return  "ALTER TABLE dataentryform DROP CONSTRAINT fk_dataentryform_datasetid;";
-    }
-
-    @Override
     public String getMoveDataValueToDestination( int sourceId, int destinationId )
     {
         return "UPDATE datavalue AS d1 SET sourceid=" + destinationId + " " + "WHERE sourceid=" + sourceId + " "

=== 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-29 11:12:34 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2012-10-29 11:18:39 +0000
@@ -27,12 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.system.util.DateUtils.getSqlDateString;
-
 import java.util.List;
 
-import org.hisp.dhis.period.Period;
-
 /**
  * @author Lars Helge Overland
  */
@@ -52,15 +48,6 @@
     }
 
     @Override
-    public String getPeriodIdentifierStatement( Period period )
-    {
-        return
-            "SELECT periodid FROM period WHERE periodtypeid=" + period.getPeriodType().getId() + " " + 
-            "AND startdate='" + getSqlDateString( period.getStartDate() ) + "' " +
-            "AND enddate='" + getSqlDateString( period.getEndDate() ) + "'";
-    }    
-
-    @Override
     public String getDeleteZeroDataValues()
     {
         return
@@ -72,12 +59,6 @@
     }
 
     @Override
-    public String getDropDatasetForeignKeyForDataEntryFormTable()
-    {
-        return  "ALTER TABLE dataentryform DROP FOREIGN KEY fk_dataentryform_datasetid;" ;
-    }
-
-    @Override
     public String getMoveDataValueToDestination( int sourceId, int destinationId )
     {
         return "UPDATE datavalue AS d1 SET sourceid=" + destinationId + " " + "WHERE sourceid=" + sourceId + " "

=== 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-29 11:12:34 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2012-10-29 11:18:39 +0000
@@ -27,12 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.system.util.DateUtils.getSqlDateString;
-
 import java.util.List;
 
-import org.hisp.dhis.period.Period;
-
 /**
  * @author Lars Helge Overland
  */
@@ -52,15 +48,6 @@
     }
 
     @Override
-    public String getPeriodIdentifierStatement( Period period )
-    {
-        return
-            "SELECT periodid FROM period WHERE periodtypeid=" + period.getPeriodType().getId() + " " + 
-            "AND startdate='" + getSqlDateString( period.getStartDate() ) + "' " +
-            "AND enddate='" + getSqlDateString( period.getEndDate() ) + "'";
-    }
-
-    @Override
     public String getDeleteZeroDataValues()
     {
         return
@@ -72,12 +59,6 @@
     }
 
     @Override
-    public String getDropDatasetForeignKeyForDataEntryFormTable()
-    {
-        return "ALTER TABLE dataentryform DROP CONSTRAINT fk_dataentryform_datasetid;" ;
-    }
-
-    @Override
     public String getMoveDataValueToDestination( int sourceId, int destinationId )
     {
         return "UPDATE datavalue AS d1 SET sourceid=" + destinationId + " " + "WHERE sourceid=" + sourceId + " "