← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9115: Removed periodtype and level from AggregatedDataValuRowMapper and SQL queries, not necessary and ...

 

------------------------------------------------------------
revno: 9115
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-11-24 16:42:36 +0100
message:
  Removed periodtype and level from AggregatedDataValuRowMapper and SQL queries, not necessary and improves performance slightly.
modified:
  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/JdbcAggregatedOrgUnitDataValueStore.java
  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-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	2012-07-26 06:41:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2012-11-24 15:42:36 +0000
@@ -159,11 +159,11 @@
     public Collection<AggregatedDataValue> getAggregatedDataValueTotals( Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
     {
         final String sql = 
-            "SELECT dataelementid, 0 as categoryoptioncomboid, periodid, organisationunitid, periodtypeid, level, SUM(value) as value " +
+            "SELECT dataelementid, 0 as categoryoptioncomboid, periodid, organisationunitid, SUM(value) as value " +
             "FROM aggregateddatavalue " +
             "WHERE periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
             "AND organisationunitid IN ( " + getCommaDelimitedString( organisationUnitIds ) + " ) " +
-            "GROUP BY dataelementid, periodid, organisationunitid, periodtypeid, level";
+            "GROUP BY dataelementid, periodid, organisationunitid";
         
         return jdbcTemplate.query( sql, new AggregatedDataValueRowMapper() );
     }
@@ -196,12 +196,12 @@
     public Collection<AggregatedDataValue> getAggregatedDataValueTotals( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
     {
         final String sql = 
-            "SELECT dataelementid, 0 as categoryoptioncomboid, periodid, organisationunitid, periodtypeid, level, SUM(value) as value " +
+            "SELECT dataelementid, 0 as categoryoptioncomboid, periodid, organisationunitid, SUM(value) as value " +
             "FROM aggregateddatavalue " +
             "WHERE dataelementid IN ( " + getCommaDelimitedString( dataElementIds ) + " ) " +
             "AND periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
             "AND organisationunitid IN ( " + getCommaDelimitedString( organisationUnitIds ) + " ) " +
-            "GROUP BY dataelementid, periodid, organisationunitid, periodtypeid, level";
+            "GROUP BY dataelementid, periodid, organisationunitid";
         
         return jdbcTemplate.query( sql, new AggregatedDataValueRowMapper() );
     }
@@ -217,7 +217,7 @@
             String periodids = getCommaDelimitedString( getIdentifiers(Period.class, periods));
 
             final String sql =
-                "SELECT dataelementid, categoryoptioncomboid, periodid, adv.organisationunitid, periodtypeid, adv.level, value " +
+                "SELECT dataelementid, categoryoptioncomboid, periodid, adv.organisationunitid, value " +
                 "FROM aggregateddatavalue AS adv " +
                 "INNER JOIN _orgunitstructure AS ous on adv.organisationunitid=ous.organisationunitid " +
                 "WHERE adv.level = " + level.getLevel() +

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java	2012-07-26 06:41:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java	2012-11-24 15:42:36 +0000
@@ -74,13 +74,13 @@
         Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds )
     {
         final String sql = 
-            "SELECT dataelementid, 0 as categoryoptioncomboid, periodid, organisationunitid, organisationunitgroupid, periodtypeid, level, SUM(value) as value " +
+            "SELECT dataelementid, 0 as categoryoptioncomboid, periodid, organisationunitid, organisationunitgroupid, SUM(value) as value " +
             "FROM aggregatedorgunitdatavalue " +
             "WHERE dataelementid IN ( " + getCommaDelimitedString( dataElementIds ) + " ) " +
             "AND periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
             "AND organisationunitid = " + organisationUnitId + " " +
             "AND organisationunitgroupid IN ( " + getCommaDelimitedString( organisationUnitGroupIds ) + " ) " +
-            "GROUP BY dataelementid, periodid, organisationunitid, organisationunitgroupid, periodtypeid, level";
+            "GROUP BY dataelementid, periodid, organisationunitid, organisationunitgroupid";
         
         return jdbcTemplate.query( sql, new AggregatedOrgUnitDataValueRowMapper() );
     }

=== 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	2012-02-29 10:55:58 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedDataValueRowMapper.java	2012-11-24 15:42:36 +0000
@@ -49,8 +49,6 @@
         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	2012-02-29 12:26:39 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorValueRowMapper.java	2012-11-24 15:42:36 +0000
@@ -47,8 +47,6 @@
         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" ) );