← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6139: Using name columns instead of column indexes in RowMappers

 

------------------------------------------------------------
revno: 6139
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-02-29 11:55:58 +0100
message:
  Using name columns instead of column indexes in RowMappers
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataValueRowMapper.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorValueRowMapper.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-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataValueRowMapper.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataValueRowMapper.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataValueRowMapper.java	2012-02-29 10:55:58 +0000
@@ -35,7 +35,6 @@
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class AggregatedDataValueRowMapper
     implements RowMapper<AggregatedDataValue>, org.springframework.jdbc.core.RowMapper<AggregatedDataValue>
@@ -46,13 +45,13 @@
     {
         final AggregatedDataValue value = new AggregatedDataValue();
         
-        value.setDataElementId( resultSet.getInt( 1 ) );
-        value.setCategoryOptionComboId( resultSet.getInt( 2 ) );
-        value.setPeriodId( resultSet.getInt( 3 ) );
-        value.setOrganisationUnitId( resultSet.getInt( 4 ) );
-        value.setPeriodTypeId( resultSet.getInt( 5 ) );
-        value.setLevel( resultSet.getInt( 6 ) );
-        value.setValue( resultSet.getDouble( 7 ) );
+        value.setDataElementId( resultSet.getInt( "dataelementid" ) );
+        value.setCategoryOptionComboId( resultSet.getInt( "categoryoptioncomboid" ) );
+        value.setPeriodId( resultSet.getInt( "periodid" ) );
+        value.setOrganisationUnitId( resultSet.getInt( "organisationunitid" ) );
+        value.setPeriodTypeId( resultSet.getInt( "periodtypeid" ) );
+        value.setLevel( resultSet.getInt( "level" ) );
+        value.setValue( resultSet.getDouble( "value" ) );
         
         return value;
     }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorValueRowMapper.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorValueRowMapper.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorValueRowMapper.java	2012-02-29 10:55:58 +0000
@@ -45,16 +45,16 @@
     {
         final AggregatedIndicatorValue value = new AggregatedIndicatorValue();
         
-        value.setIndicatorId( resultSet.getInt( 1 ) );
-        value.setPeriodId( resultSet.getInt( 2 ) );
-        value.setOrganisationUnitId( resultSet.getInt( 3 ) );
-        value.setPeriodTypeId( resultSet.getInt( 4 ) );
-        value.setLevel( resultSet.getInt( 5 ) );
-        value.setAnnualized( resultSet.getString( 6 ) );
-        value.setFactor( resultSet.getDouble( 7 ) );
-        value.setValue( resultSet.getDouble( 8 ) );
-        value.setNumeratorValue( resultSet.getDouble( 9 ) );
-        value.setDenominatorValue( resultSet.getDouble( 10 ) );
+        value.setIndicatorId( resultSet.getInt( "indicatorid" ) );
+        value.setPeriodId( resultSet.getInt( "periodid" ) );
+        value.setOrganisationUnitId( resultSet.getInt( "organisationunitid" ) );
+        value.setPeriodTypeId( resultSet.getInt( "periodtypeid" ) );
+        value.setLevel( resultSet.getInt( "level" ) );
+        value.setAnnualized( resultSet.getString( "annualized" ) );
+        value.setFactor( resultSet.getDouble( "factor" ) );
+        value.setValue( resultSet.getDouble( "value" ) );
+        value.setNumeratorValue( resultSet.getDouble( "numeratorvalue" ) );
+        value.setDenominatorValue( resultSet.getDouble( "denominatorvalue" ) );
         
         return value;
     }