← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 252: Minor simplification of the JDBC related code

 

------------------------------------------------------------
revno: 252
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-04-24 12:42:55 +0200
message:
  Minor simplification of the JDBC related code
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/maintenance/jdbc/JdbcMaintenanceStore.java
  dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statement/JDBCStatementManager.java
  docs/Technical Architecture DHIS 2.doc

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java	2009-04-24 10:42:55 +0000
@@ -45,8 +45,7 @@
             StringBuffer sqlsb = new StringBuffer();
             sqlsb.append( "SELECT d.datasetid AS ID, d.name AS DataSet, count(*) AS Count " );
             sqlsb.append( "FROM datavalue dv " );
-            sqlsb
-                .append( "JOIN datasetmembers dsm ON (dv.dataelementid = dsm.dataelementid) JOIN dataset d ON (d.datasetid = dsm.datasetid) " );
+            sqlsb.append( "JOIN datasetmembers dsm ON (dv.dataelementid = dsm.dataelementid) JOIN dataset d ON (d.datasetid = dsm.datasetid) " );
             sqlsb.append( "WHERE dv.periodid IN " + splitListHelper( betweenPeriodIds ) + " " );
             sqlsb.append( "GROUP BY d.datasetid, d.name " );
             sqlsb.append( "ORDER BY Count DESC;" );
@@ -263,6 +262,5 @@
         Statement stm = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY );
         stm.execute( sql );
         return stm.getResultSet();
-
     }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/maintenance/jdbc/JdbcMaintenanceStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/maintenance/jdbc/JdbcMaintenanceStore.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/maintenance/jdbc/JdbcMaintenanceStore.java	2009-04-24 10:42:55 +0000
@@ -31,12 +31,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.jdbc.JDBCConfiguration;
-import org.hisp.dhis.jdbc.JDBCConfigurationProvider;
-import org.hisp.dhis.jdbc.StatementBuilder;
 import org.hisp.dhis.jdbc.StatementHolder;
 import org.hisp.dhis.jdbc.StatementManager;
-import org.hisp.dhis.jdbc.factory.StatementBuilderFactory;
 import org.hisp.dhis.maintenance.MaintenanceStore;
 
 /**
@@ -59,13 +55,6 @@
         this.statementManager = statementManager;
     }
     
-    private JDBCConfigurationProvider configurationProvider;
-
-    public void setConfigurationProvider( JDBCConfigurationProvider configurationProvider )
-    {
-        this.configurationProvider = configurationProvider;
-    }
-    
     // -------------------------------------------------------------------------
     // MaintenanceStore implementation
     // -------------------------------------------------------------------------
@@ -74,13 +63,9 @@
     {
         final StatementHolder holder = statementManager.getHolder();
         
-        final JDBCConfiguration configuration = configurationProvider.getConfiguration();
-        
-        final StatementBuilder builder = StatementBuilderFactory.createStatementBuilder( configuration.getDialect() );
-        
         try
         {
-            final String sql = builder.getDeleteZeroDataValues();
+            final String sql = statementManager.getStatementBuilder().getDeleteZeroDataValues();
             
             log.debug( "Deleting zero values: " + 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	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml	2009-04-24 10:42:55 +0000
@@ -48,8 +48,6 @@
     class="org.hisp.dhis.maintenance.jdbc.JdbcMaintenanceStore">
     <property name="statementManager"
       ref="org.hisp.dhis.jdbc.StatementManager"/>
-    <property name="configurationProvider"
-      ref="org.hisp.dhis.jdbc.JDBCConfigurationProvider"/>
   </bean>
   
   <bean id="org.hisp.dhis.maintenance.MaintenanceService"

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java	2009-04-06 18:55:31 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java	2009-04-24 10:42:55 +0000
@@ -47,12 +47,8 @@
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DeflatedDataValue;
 import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.jdbc.JDBCConfiguration;
-import org.hisp.dhis.jdbc.JDBCConfigurationProvider;
-import org.hisp.dhis.jdbc.StatementBuilder;
 import org.hisp.dhis.jdbc.StatementHolder;
 import org.hisp.dhis.jdbc.StatementManager;
-import org.hisp.dhis.jdbc.factory.StatementBuilderFactory;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.system.objectmapper.AggregatedDataValueRowMapper;
@@ -79,13 +75,6 @@
         this.statementManager = statementManager;
     }
     
-    private JDBCConfigurationProvider configurationProvider;
-
-    public void setConfigurationProvider( JDBCConfigurationProvider configurationProvider )
-    {
-        this.configurationProvider = configurationProvider;
-    }
-
     // -------------------------------------------------------------------------
     // AggregatedDataValue
     // -------------------------------------------------------------------------
@@ -572,13 +561,9 @@
     {
         final StatementHolder holder = statementManager.getHolder();
         
-        final JDBCConfiguration configuration = configurationProvider.getConfiguration();
-        
-        final StatementBuilder builder = StatementBuilderFactory.createStatementBuilder( configuration.getDialect() );
-        
         try
         {
-            final String sql = builder.getDeleteRelativePeriods();
+            final String sql = statementManager.getStatementBuilder().getDeleteRelativePeriods();
             
             return holder.getStatement().executeUpdate( sql );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml	2009-04-23 21:12:33 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml	2009-04-24 10:42:55 +0000
@@ -26,8 +26,6 @@
     class="org.hisp.dhis.datamart.jdbc.JdbcDataMartStore">
     <property name="statementManager"
       ref="org.hisp.dhis.jdbc.StatementManager"/>
-    <property name="configurationProvider"
-      ref="org.hisp.dhis.jdbc.JDBCConfigurationProvider"/>
   </bean>
 	
   <!-- DataMartService -->

=== modified file 'dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statement/JDBCStatementManager.java'
--- dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statement/JDBCStatementManager.java	2009-03-13 11:51:35 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc/src/main/java/org/hisp/dhis/jdbc/statement/JDBCStatementManager.java	2009-04-24 10:42:55 +0000
@@ -103,7 +103,7 @@
         
         return new DefaultStatementHolder( getInternalConnection(), false );
     }
-
+    
     public void destroy()
     {
         StatementHolder holder = holderTag.get();

=== modified file 'docs/Technical Architecture DHIS 2.doc'
Binary files docs/Technical Architecture DHIS 2.doc	2009-04-24 10:20:52 +0000 and docs/Technical Architecture DHIS 2.doc	2009-04-24 10:42:55 +0000 differ


--
Trunk
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.