← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5263: Using column name instead of index for Aggregated*MapValueRowmapper

 

------------------------------------------------------------
revno: 5263
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-12-01 20:39:40 +0100
message:
  Using column name instead of index for Aggregated*MapValueRowmapper
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataMapValueRowMapper.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorMapValueRowMapper.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-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2011-12-01 17:08:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2011-12-01 19:39:40 +0000
@@ -433,7 +433,7 @@
     public Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, Collection<Integer> organisationUnitIds )
     {
         final String sql = 
-            "SELECT o.organisationunitid, o.name, a.value, a.periodid " +
+            "SELECT a.periodid, o.organisationunitid, o.name, a.value " +
             "FROM aggregateddatavalue AS a " +
             "JOIN organisationunit AS o ON (a.organisationunitid=o.organisationunitid) " +
             "WHERE a.dataelementid  = " + dataElementId + " " +
@@ -649,7 +649,7 @@
     public Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, Collection<Integer> organisationUnitIds )
     {
         final String sql = 
-            "SELECT o.organisationunitid, o.name, a.value, a.periodid, a.factor, a.numeratorvalue, a.denominatorvalue " +
+            "SELECT a.periodid, o.organisationunitid, o.name, a.value, a.factor, a.numeratorvalue, a.denominatorvalue " +
             "FROM aggregatedindicatorvalue AS a " +
             "JOIN organisationunit AS o ON (a.organisationunitid=o.organisationunitid) " +
             "WHERE a.indicatorid  = " + indicatorId + " " +

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataMapValueRowMapper.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataMapValueRowMapper.java	2011-12-01 13:36:23 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataMapValueRowMapper.java	2011-12-01 19:39:40 +0000
@@ -45,10 +45,10 @@
     {
         final AggregatedMapValue value = new AggregatedMapValue();
 
-        value.setOrganisationUnitId( resultSet.getInt( 1 ) );
-        value.setOrganisationUnitName( resultSet.getString( 2 ) );
-        value.setValue( resultSet.getDouble( 3 ) );
-        value.setPeriodId( resultSet.getInt( 4 ) );     
+        value.setPeriodId( resultSet.getInt( "periodid" ) ); 
+        value.setOrganisationUnitId( resultSet.getInt( "organisationunitid" ) );
+        value.setOrganisationUnitName( resultSet.getString( "name" ) );
+        value.setValue( resultSet.getDouble( "value" ) );    
 
         return value;
     }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorMapValueRowMapper.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorMapValueRowMapper.java	2011-12-01 13:36:23 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorMapValueRowMapper.java	2011-12-01 19:39:40 +0000
@@ -45,13 +45,13 @@
     {
         final AggregatedMapValue value = new AggregatedMapValue();
 
-        value.setOrganisationUnitId( resultSet.getInt( 1 ) );
-        value.setOrganisationUnitName( resultSet.getString( 2 ) );
-        value.setValue( resultSet.getDouble( 3 ) );
-        value.setPeriodId( resultSet.getInt( 4 ) );
-        value.setFactor( resultSet.getDouble( 5 ) );
-        value.setNumeratorValue( resultSet.getDouble( 6 ) );
-        value.setDenominatorValue( resultSet.getDouble( 7 ) );        
+        value.setPeriodId( resultSet.getInt( "periodid" ) );
+        value.setOrganisationUnitId( resultSet.getInt( "organisationunitid" ) );
+        value.setOrganisationUnitName( resultSet.getString( "name" ) );
+        value.setValue( resultSet.getDouble( "value" ) );
+        value.setFactor( resultSet.getDouble( "factor" ) );
+        value.setNumeratorValue( resultSet.getDouble( "numeratorvalue" ) );
+        value.setDenominatorValue( resultSet.getDouble( "denominatorvalue" ) );        
 
         return value;
     }