← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5357: WIP org unit groups in data mart

 

------------------------------------------------------------
revno: 5357
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-12-10 18:55:41 +0100
message:
  WIP org unit groups in data mart
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java
  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/resources/META-INF/dhis/beans.xml


--
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-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java	2011-12-01 17:08:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java	2011-12-10 17:55:41 +0000
@@ -174,35 +174,23 @@
      * @param dataElementIds a collection of DataElement identifiers.
      * @param periodIds a collection of Period identifiers.
      * @param organisationUnitIds a collection of OrganisationUnit identifiers.
-     * @return the number of deleted AggregatedDataValues.
      */
-    int deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds,
+    void deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds,
         Collection<Integer> organisationUnitIds );
 
     /**
      * Deletes AggregatedDataValues registered for the given parameters.
      * 
      * @param periodIds a collection of Period identifiers.
-     * @return the number of deleted AggregatedDataValues.
-     */
-    int deleteAggregatedDataValues( Collection<Integer> periodIds );
-    
-    /**
-     * Deletes AggregatedIndicatorValue registered for the given parameters.
-     * 
-     * @param periodIds a collection of Period identifiers.
-     * @return the number of deleted AggregatedIndicatorValues.
-     */
-    int deleteAggregatedIndicatorValues( Collection<Integer> periodIds );
+     */
+    void deleteAggregatedDataValues( Collection<Integer> periodIds );
     
     /**
      * Deletes all AggregatedDataValues.
      * 
      * @return the number of deleted AggregatedDataValues.
-     * @throws AggregationStoreException
      */
-    int deleteAggregatedDataValues();
-
+    void deleteAggregatedDataValues();
 
     /**
      * Returns agg data values for children of an orgunit at a particular level
@@ -302,18 +290,23 @@
      * @param indicatorIds a collection of Indicator identifiers.
      * @param periodIds a collection of Period identifiers.
      * @param organisationUnitIds a collection of OrganisationUnit identifiers.
-     * @return the number of deleted AggregatedIndicatorValues.
      */
-    int deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
+    void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
         Collection<Integer> organisationUnitIds );
+
+    /**
+     * Deletes AggregatedIndicatorValue registered for the given parameters.
+     * 
+     * @param periodIds a collection of Period identifiers.
+     */
+    void deleteAggregatedIndicatorValues( Collection<Integer> periodIds );
     
     /**
      * Deletes all AggregatedIndicatorValue.
      * 
      * @return the number of deleted AggregatedIndicatorValues.
-     * @throws AggregationStoreException
      */
-    int deleteAggregatedIndicatorValues();
+    void deleteAggregatedIndicatorValues();
 
     /**
      * Returns agg indicator values for children of an orgunit at a particular level

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java	2011-12-01 17:08:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java	2011-12-10 17:55:41 +0000
@@ -151,26 +151,23 @@
      * @param dataElementIds a collection of DataElement identifiers.
      * @param periodIds a collection of Period identifiers.
      * @param organisationUnitIds a collection of OrganisationUnit identifiers.
-     * @return the number of deleted AggregatedDataValues.
      */
-    int deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds,
+    void deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds,
         Collection<Integer> organisationUnitIds );
 
     /**
      * Deletes AggregatedDataValues registered for the given parameters.
      * 
      * @param periodIds a collection of Period identifiers.
-     * @return the number of deleted AggregatedDataValues.
      */
-    int deleteAggregatedDataValues( Collection<Integer> periodIds );
+    void deleteAggregatedDataValues( Collection<Integer> periodIds );
     
     /**
      * Deletes all AggregatedDataValues.
      * 
      * @return the number of deleted AggregatedDataValues.
-     * @throws AggregationStoreException
      */
-    int deleteAggregatedDataValues();
+    void deleteAggregatedDataValues();
 
     /**
      * Returns values for children of an orgunit at a particular level
@@ -270,26 +267,23 @@
      * @param indicatorIds a collection of Indicator identifiers.
      * @param periodIds a collection of Period identifiers.
      * @param organisationUnitIds a collection of OrganisationUnit identifiers.
-     * @return the number of deleted AggregatedIndicatorValues.
      */
-    int deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
+    void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
         Collection<Integer> organisationUnitIds );
 
     /**
      * Deletes AggregatedIndicatorValue registered for the given parameters.
      * 
      * @param periodIds a collection of Period identifiers.
-     * @return the number of deleted AggregatedIndicatorValues.
      */
-    int deleteAggregatedIndicatorValues( Collection<Integer> periodIds );
+    void deleteAggregatedIndicatorValues( Collection<Integer> periodIds );
     
     /**
      * Deletes all AggregatedIndicatorValue.
      * 
      * @return the number of deleted AggregatedIndicatorValues.
-     * @throws AggregationStoreException
      */
-    int deleteAggregatedIndicatorValues();
+    void deleteAggregatedIndicatorValues();
 
 
     /**

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java	2011-12-10 17:55:41 +0000
@@ -0,0 +1,35 @@
+package org.hisp.dhis.aggregation;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+public interface AggregatedOrgUnitDataValueService
+{
+    void createIndex( boolean dataElement, boolean indicator );
+    
+    void dropIndex( boolean dataElement, boolean indicator );
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java	2011-12-10 17:55:41 +0000
@@ -0,0 +1,36 @@
+package org.hisp.dhis.aggregation;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+public interface AggregatedOrgUnitDataValueStore
+{
+    void createIndex( boolean dataElement, boolean indicator );
+    
+    void dropIndex( boolean dataElement, boolean indicator );
+
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java	2011-12-01 17:08:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java	2011-12-10 17:55:41 +0000
@@ -47,6 +47,10 @@
 public class DefaultAggregatedDataValueService
     implements AggregatedDataValueService
 {
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
     private AggregatedDataValueStore aggregatedDataValueStore;
 
     public void setAggregatedDataValueStore( AggregatedDataValueStore aggregatedDataValueStore )
@@ -113,19 +117,19 @@
         return aggregatedDataValueStore.getAggregatedDataValueTotals( dataElementIds, periodIds, organisationUnitIds );
     }
     
-    public int deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
+    public void deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
     {
-        return aggregatedDataValueStore.deleteAggregatedDataValues( dataElementIds, periodIds, organisationUnitIds );
+        aggregatedDataValueStore.deleteAggregatedDataValues( dataElementIds, periodIds, organisationUnitIds );
     }
 
-    public int deleteAggregatedDataValues( Collection<Integer> periodIds )
+    public void deleteAggregatedDataValues( Collection<Integer> periodIds )
     {
-        return aggregatedDataValueStore.deleteAggregatedDataValues( periodIds );
+        aggregatedDataValueStore.deleteAggregatedDataValues( periodIds );
     }
     
-    public int deleteAggregatedDataValues()
+    public void deleteAggregatedDataValues()
     {
-        return aggregatedDataValueStore.deleteAggregatedDataValues();
+        aggregatedDataValueStore.deleteAggregatedDataValues();
     }
 
     public StoreIterator<AggregatedDataValue> getAggregateDataValuesAtLevel(OrganisationUnit orgunit, OrganisationUnitLevel level, Collection<Period> periods)
@@ -187,20 +191,20 @@
         return aggregatedDataValueStore.getAggregatedIndicatorValues( indicatorIds, periodIds, organisationUnitIds );
     }
     
-    public int deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
+    public void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
         Collection<Integer> organisationUnitIds )
     {
-        return aggregatedDataValueStore.deleteAggregatedIndicatorValues( indicatorIds, periodIds, organisationUnitIds );
+        aggregatedDataValueStore.deleteAggregatedIndicatorValues( indicatorIds, periodIds, organisationUnitIds );
     }
 
-    public int deleteAggregatedIndicatorValues( Collection<Integer> periodIds )
+    public void deleteAggregatedIndicatorValues( Collection<Integer> periodIds )
     {
-        return aggregatedDataValueStore.deleteAggregatedIndicatorValues( periodIds );
+        aggregatedDataValueStore.deleteAggregatedIndicatorValues( periodIds );
     }
     
-    public int deleteAggregatedIndicatorValues()
+    public void deleteAggregatedIndicatorValues()
     {
-        return aggregatedDataValueStore.deleteAggregatedIndicatorValues();
+        aggregatedDataValueStore.deleteAggregatedIndicatorValues();
     }
 
     public StoreIterator<AggregatedIndicatorValue> getAggregateIndicatorValuesAtLevel( OrganisationUnit orgunit, OrganisationUnitLevel level, Collection<Period> periods )

=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java	2011-12-10 17:55:41 +0000
@@ -0,0 +1,57 @@
+package org.hisp.dhis.aggregation;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+public class DefaultAggregatedOrgUnitDataValueService
+    implements AggregatedOrgUnitDataValueService
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private AggregatedOrgUnitDataValueStore aggregatedDataValueStore;
+
+    public void setAggregatedDataValueStore( AggregatedOrgUnitDataValueStore aggregatedDataValueStore )
+    {
+        this.aggregatedDataValueStore = aggregatedDataValueStore;
+    }
+
+    // -------------------------------------------------------------------------
+    // AggregatedOrgUnitDataValueService implementation
+    // -------------------------------------------------------------------------
+    
+    public void createIndex( boolean dataElement, boolean indicator )
+    {
+        aggregatedDataValueStore.createIndex( dataElement, indicator );
+    }
+    
+    public void dropIndex( boolean dataElement, boolean indicator )
+    {
+        aggregatedDataValueStore.dropIndex( dataElement, indicator );
+    }
+}

=== 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-05 15:42:24 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2011-12-10 17:55:41 +0000
@@ -69,7 +69,7 @@
  * @author Lars Helge Overland
  */
 public class JdbcAggregatedDataValueStore
- implements AggregatedDataValueStore
+    implements AggregatedDataValueStore
 {
     private int FETCH_SIZE = 1000; // Number of rows to fetch from db for large resultset
 
@@ -336,7 +336,7 @@
 
     public int countDataValuesAtLevel( OrganisationUnit rootOrgunit, OrganisationUnitLevel level, Collection<Period> periods )
     {
-        final String periodids = getCommaDelimitedString( getIdentifiers(Period.class, periods));
+        final String periodids = getCommaDelimitedString( getIdentifiers( Period.class, periods ) );
 
         final String sql =
             "SELECT count(*) " +
@@ -349,7 +349,7 @@
         return statementManager.getHolder().queryForInteger( sql );
     }
 
-    public int deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
+    public void deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
     {
         final String sql =
             "DELETE FROM aggregateddatavalue " +
@@ -357,21 +357,21 @@
             "AND periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
             "AND organisationunitid IN ( " + getCommaDelimitedString( organisationUnitIds ) + " )";
         
-        return statementManager.getHolder().executeUpdate( sql );        
+        jdbcTemplate.execute( sql );        
     }
 
-    public int deleteAggregatedDataValues( Collection<Integer> periodIds )
+    public void deleteAggregatedDataValues( Collection<Integer> periodIds )
     {
         final String sql =
             "DELETE FROM aggregateddatavalue " +
             "WHERE periodid IN ( " + getCommaDelimitedString( periodIds ) + " )";
         
-        return statementManager.getHolder().executeUpdate( sql );        
+        jdbcTemplate.execute( sql );        
     }
 
-    public int deleteAggregatedDataValues()
+    public void deleteAggregatedDataValues()
     {
-        return statementManager.getHolder().executeUpdate( "DELETE FROM aggregateddatavalue" ); 
+        jdbcTemplate.execute( "DELETE FROM aggregateddatavalue" ); 
     }
     
     public void createIndex( boolean dataElement, boolean indicator )
@@ -381,7 +381,7 @@
             try
             {
                 final String sql = "CREATE INDEX aggregateddatavalue_index ON aggregateddatavalue (dataelementid, categoryoptioncomboid, periodid, organisationunitid)";        
-                statementManager.getHolder().executeUpdate( sql, true );
+                jdbcTemplate.execute( sql );
             }
             catch ( Exception ex )
             {
@@ -394,7 +394,7 @@
             try
             {
                 final String sql = "CREATE INDEX aggregatedindicatorvalue_index ON aggregatedindicatorvalue (indicatorid, periodid, organisationunitid)";        
-                statementManager.getHolder().executeUpdate( sql, true );
+                jdbcTemplate.execute( sql );
             }
             catch ( Exception ex )
             {
@@ -410,7 +410,7 @@
             try
             {
                 final String sql = "DROP INDEX aggregateddatavalue_index";
-                statementManager.getHolder().executeUpdate( sql, true );
+                jdbcTemplate.execute( sql );
             }
             catch ( Exception ex )
             {
@@ -423,7 +423,7 @@
             try
             {
                 final String sql = "DROP INDEX aggregatedindicatorvalue_index";
-                statementManager.getHolder().executeUpdate( sql, true );
+                jdbcTemplate.execute( sql );
             }
             catch ( Exception ex )
             {
@@ -549,7 +549,7 @@
         }
     }
 
-    public int deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
+    public void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
         Collection<Integer> organisationUnitIds )
     {
         final String sql =
@@ -558,21 +558,21 @@
             "AND periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
             "AND organisationunitid IN ( " + getCommaDelimitedString( organisationUnitIds ) + " )";
         
-        return statementManager.getHolder().executeUpdate( sql );        
+        jdbcTemplate.execute( sql );        
     }
 
-    public int deleteAggregatedIndicatorValues( Collection<Integer> periodIds )
+    public void deleteAggregatedIndicatorValues( Collection<Integer> periodIds )
     {
         final String sql =
             "DELETE FROM aggregatedindicatorvalue " +
             "WHERE periodid IN ( " + getCommaDelimitedString( periodIds ) + " )";
-        
-        return statementManager.getHolder().executeUpdate( sql );        
+
+        jdbcTemplate.execute( sql );      
     }
     
-    public int deleteAggregatedIndicatorValues()
+    public void deleteAggregatedIndicatorValues()
     {
-        return statementManager.getHolder().executeUpdate( "DELETE FROM aggregatedindicatorvalue" );
+        jdbcTemplate.execute( "DELETE FROM aggregatedindicatorvalue" );
     }
 
     @Override

=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java	2011-12-10 17:55:41 +0000
@@ -0,0 +1,120 @@
+package org.hisp.dhis.aggregation.jdbc;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.amplecode.quick.StatementManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueStore;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+public class JdbcAggregatedOrgUnitDataValueStore
+    implements AggregatedOrgUnitDataValueStore
+{
+    private static final Log log = LogFactory.getLog( JdbcAggregatedOrgUnitDataValueStore.class );
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private StatementManager statementManager;
+
+    public void setStatementManager( StatementManager statementManager )
+    {
+        this.statementManager = statementManager;
+    }
+
+    protected JdbcTemplate jdbcTemplate;
+    
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
+    // -------------------------------------------------------------------------
+    // AggregatedOrgUnitDataValueStore implementation
+    // -------------------------------------------------------------------------
+
+    public void createIndex( boolean dataElement, boolean indicator )
+    {
+        if ( dataElement )
+        {
+            try
+            {
+                final String sql = "CREATE INDEX aggregatedorgunitdatavalue_index ON aggregatedorgunitdatavalue (dataelementid, categoryoptioncomboid, periodid, organisationunitid, organisationunitgroupid)";        
+                jdbcTemplate.execute( sql );
+            }
+            catch ( Exception ex )
+            {
+                log.debug( "Index already exists" );
+            }
+        }
+        
+        if ( indicator )
+        {
+            try
+            {
+                final String sql = "CREATE INDEX aggregatedorgunitindicatorvalue_index ON aggregatedorgunitindicatorvalue (indicatorid, periodid, organisationunitid, organisationunitgroupid)";        
+                jdbcTemplate.execute( sql );
+            }
+            catch ( Exception ex )
+            {
+                log.debug( "Index already exists" );
+            }
+        }
+    }
+    
+    public void dropIndex( boolean dataElement, boolean indicator )
+    {
+        if ( dataElement )
+        {
+            try
+            {
+                final String sql = "DROP INDEX aggregatedorgunitdatavalue_index";
+                jdbcTemplate.execute( sql );
+            }
+            catch ( Exception ex )
+            {
+                log.debug( "Index does not exist" );
+            }
+        }
+        
+        if ( indicator )
+        {
+            try
+            {
+                final String sql = "DROP INDEX aggregatedorgunitindicatorvalue_index";
+                jdbcTemplate.execute( sql );
+            }
+            catch ( Exception ex )
+            {
+                log.debug( "Index does not exist" );
+            }
+        }
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-12-09 19:48:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-12-10 17:55:41 +0000
@@ -203,6 +203,11 @@
 	<property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
+  <bean id="org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueStore" class="org.hisp.dhis.aggregation.jdbc.JdbcAggregatedOrgUnitDataValueStore">
+    <property name="statementManager" ref="statementManager" />
+	<property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
+
   <bean id="org.hisp.dhis.user.UserAuthorityGroupStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
     <property name="clazz" value="org.hisp.dhis.user.UserAuthorityGroup" />
     <property name="sessionFactory" ref="sessionFactory" />
@@ -447,6 +452,10 @@
     <property name="aggregatedDataValueStore" ref="org.hisp.dhis.aggregation.AggregatedDataValueStore" />
   </bean>
 
+  <bean id="org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueService" class="org.hisp.dhis.aggregation.DefaultAggregatedOrgUnitDataValueService">
+    <property name="aggregatedDataValueStore" ref="org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueStore" />
+  </bean>
+
   <bean id="org.hisp.dhis.message.MessageService" class="org.hisp.dhis.message.DefaultMessageService">
     <property name="messageConversationStore" ref="org.hisp.dhis.message.MessageConversationStore" />
     <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />