← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6141: WIP org unit group set based analysis in data visualizer

 

------------------------------------------------------------
revno: 6141
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-02-29 13:26:39 +0100
message:
  WIP org unit group set based analysis in data visualizer
added:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedOrgUnitDataValueRowMapper.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedOrgUnitIndicatorValueRowMapper.java
modified:
  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
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorValueRowMapper.java
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesAction.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-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java	2012-02-07 19:52:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java	2012-02-29 12:26:39 +0000
@@ -46,6 +46,9 @@
     
     Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, 
         Period period, OrganisationUnit organisationUnit, OrganisationUnitGroup group );
+
+    Collection<AggregatedDataValue> getAggregatedDataValueTotals( Collection<Integer> dataElementIds, 
+        Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds );
     
     void deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds );
     
@@ -62,6 +65,9 @@
     // -------------------------------------------------------------------------
     
     Double getAggregatedIndicatorValue( Indicator indicator, Period period, OrganisationUnit organisationUnit, OrganisationUnitGroup group );
+
+    Collection<AggregatedIndicatorValue> getAggregatedIndicatorValues( Collection<Integer> indicatorIds, 
+        Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds );
     
     void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds );
     

=== modified 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	2012-02-07 19:52:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java	2012-02-29 12:26:39 +0000
@@ -37,6 +37,9 @@
     
     Double getAggregatedDataValue( int dataElement, int categoryOptionCombo, int period, int organisationUnit, int organisationUnitGroup );
     
+    Collection<AggregatedDataValue> getAggregatedDataValueTotals( Collection<Integer> dataElementIds, 
+        Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds );
+    
     void deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds );
     
     void deleteAggregatedDataValues( Collection<Integer> periodIds );
@@ -53,6 +56,9 @@
     
     Double getAggregatedIndicatorValue( int indicator, int period, int organisationUnit, int organisationUnitGroup );
     
+    Collection<AggregatedIndicatorValue> getAggregatedIndicatorValues( Collection<Integer> indicatorIds, 
+        Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds );
+    
     void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds );
     
     void deleteAggregatedIndicatorValues( Collection<Integer> periodIds );

=== modified 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	2012-02-07 19:52:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java	2012-02-29 12:26:39 +0000
@@ -63,6 +63,11 @@
     {
         return aggregatedDataValueStore.getAggregatedDataValue( dataElement.getId(), optionCombo.getId(), period.getId(), organisationUnit.getId(), group.getId() );
     }
+    public Collection<AggregatedDataValue> getAggregatedDataValueTotals( Collection<Integer> dataElementIds, 
+        Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds )
+    {
+        return aggregatedDataValueStore.getAggregatedDataValueTotals( dataElementIds, periodIds, organisationUnitId, organisationUnitGroupIds );
+    }
     
     public void deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
     {
@@ -98,6 +103,12 @@
         return aggregatedDataValueStore.getAggregatedIndicatorValue( indicator.getId(), period.getId(), organisationUnit.getId(), group.getId() );
     }
     
+    public Collection<AggregatedIndicatorValue> getAggregatedIndicatorValues( Collection<Integer> indicatorIds, 
+        Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds )
+    {
+        return aggregatedDataValueStore.getAggregatedIndicatorValues( indicatorIds, periodIds, organisationUnitId, organisationUnitGroupIds );
+    }
+    
     public void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
     {
         aggregatedDataValueStore.deleteAggregatedIndicatorValues( indicatorIds, periodIds, organisationUnitIds );

=== 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-02-07 19:52:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java	2012-02-29 12:26:39 +0000
@@ -29,12 +29,20 @@
 
 import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
 
+import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.Collection;
 
+import org.amplecode.quick.StatementHolder;
 import org.amplecode.quick.StatementManager;
+import org.amplecode.quick.mapper.ObjectMapper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.aggregation.AggregatedDataValue;
+import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
 import org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueStore;
+import org.hisp.dhis.system.objectmapper.AggregatedOrgUnitDataValueRowMapper;
+import org.hisp.dhis.system.objectmapper.AggregatedOrgUnitIndicatorValueRowMapper;
 
 public class JdbcAggregatedOrgUnitDataValueStore
     implements AggregatedOrgUnitDataValueStore
@@ -70,6 +78,38 @@
         return statementManager.getHolder().queryForDouble( sql );
     }
 
+    public Collection<AggregatedDataValue> getAggregatedDataValueTotals( Collection<Integer> dataElementIds, 
+        Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds )
+    {
+        final StatementHolder holder = statementManager.getHolder();
+        
+        final ObjectMapper<AggregatedDataValue> mapper = new ObjectMapper<AggregatedDataValue>();
+        
+        try
+        {
+            final String sql = 
+                "SELECT dataelementid, 0 as categoryoptioncomboid, periodid, organisationunitid, organisationunitgroupid, periodtypeid, level, 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";
+            
+            final ResultSet resultSet = holder.getStatement().executeQuery( sql );
+            
+            return mapper.getCollection( resultSet, new AggregatedOrgUnitDataValueRowMapper() );
+        }
+        catch ( SQLException ex )
+        {
+            throw new RuntimeException( "Failed to get aggregated org unit data value", ex );
+        }
+        finally
+        {
+            holder.close();
+        }
+    }
+
     public void deleteAggregatedDataValues( Collection<Integer> dataElementIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
     {
         final String sql =
@@ -172,6 +212,37 @@
         return statementManager.getHolder().queryForDouble( sql );
     }
 
+    public Collection<AggregatedIndicatorValue> getAggregatedIndicatorValues( Collection<Integer> indicatorIds, 
+        Collection<Integer> periodIds, int organisationUnitId, Collection<Integer> organisationUnitGroupIds )
+    {
+        final StatementHolder holder = statementManager.getHolder();
+        
+        final ObjectMapper<AggregatedIndicatorValue> mapper = new ObjectMapper<AggregatedIndicatorValue>();
+        
+        try
+        {
+            final String sql =
+                "SELECT * " +
+                "FROM aggregatedorgunitindicatorvalue " +
+                "WHERE indicatorid IN ( " + getCommaDelimitedString( indicatorIds ) + " ) " +
+                "AND periodid IN ( " + getCommaDelimitedString( periodIds ) + " ) " +
+                "AND organisationunitid = " + organisationUnitId + " " +
+                "AND organisationunitgroupid IN ( " + getCommaDelimitedString( organisationUnitGroupIds ) + " )";
+            
+            final ResultSet resultSet = holder.getStatement().executeQuery( sql );
+            
+            return mapper.getCollection( resultSet, new AggregatedOrgUnitIndicatorValueRowMapper() );
+        }
+        catch ( SQLException ex )
+        {
+            throw new RuntimeException( "Failed to get aggregated indicator value", ex );
+        }
+        finally
+        {
+            holder.close();
+        }
+    }
+
     public void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds,
         Collection<Integer> organisationUnitIds )
     {

=== 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 10:55:58 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedIndicatorValueRowMapper.java	2012-02-29 12:26:39 +0000
@@ -35,7 +35,6 @@
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class AggregatedIndicatorValueRowMapper
     implements RowMapper<AggregatedIndicatorValue>, org.springframework.jdbc.core.RowMapper<AggregatedIndicatorValue>

=== added file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedOrgUnitDataValueRowMapper.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedOrgUnitDataValueRowMapper.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedOrgUnitDataValueRowMapper.java	2012-02-29 12:26:39 +0000
@@ -0,0 +1,60 @@
+package org.hisp.dhis.system.objectmapper;
+
+/*
+ * Copyright (c) 2004-2012, 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 java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.amplecode.quick.mapper.RowMapper;
+import org.hisp.dhis.aggregation.AggregatedDataValue;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class AggregatedOrgUnitDataValueRowMapper
+    extends AggregatedDataValueRowMapper
+    implements RowMapper<AggregatedDataValue>, org.springframework.jdbc.core.RowMapper<AggregatedDataValue>
+{
+    @Override
+    public AggregatedDataValue mapRow( ResultSet resultSet )
+        throws SQLException
+    {
+        final AggregatedDataValue value = super.mapRow( resultSet );
+        
+        value.setOrganisationUnitGroupId( resultSet.getInt( "organisationunitgroupid" ) );
+        
+        return value;
+    }
+    
+    @Override
+    public AggregatedDataValue mapRow( ResultSet resultSet, int rowNum )
+        throws SQLException
+    {
+        return this.mapRow( resultSet );
+    }
+}

=== added file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedOrgUnitIndicatorValueRowMapper.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedOrgUnitIndicatorValueRowMapper.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/AggregatedOrgUnitIndicatorValueRowMapper.java	2012-02-29 12:26:39 +0000
@@ -0,0 +1,60 @@
+package org.hisp.dhis.system.objectmapper;
+
+/*
+ * Copyright (c) 2004-2012, 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 java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.amplecode.quick.mapper.RowMapper;
+import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class AggregatedOrgUnitIndicatorValueRowMapper
+    extends AggregatedIndicatorValueRowMapper
+    implements RowMapper<AggregatedIndicatorValue>, org.springframework.jdbc.core.RowMapper<AggregatedIndicatorValue>
+{
+    @Override
+    public AggregatedIndicatorValue mapRow( ResultSet resultSet )
+        throws SQLException
+    {
+        final AggregatedIndicatorValue value = super.mapRow( resultSet );
+        
+        value.setOrganisationUnitGroupId( resultSet.getInt( "organisationunitgroupid" ) );
+        
+        return value;
+    }
+    
+    @Override
+    public AggregatedIndicatorValue mapRow( ResultSet resultSet, int rowNum )
+        throws SQLException
+    {
+        return this.mapRow( resultSet );
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesAction.java	2012-02-27 14:12:54 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesAction.java	2012-02-29 12:26:39 +0000
@@ -33,7 +33,12 @@
 import org.hisp.dhis.aggregation.AggregatedDataValue;
 import org.hisp.dhis.aggregation.AggregatedDataValueService;
 import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
+import org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueService;
 import org.hisp.dhis.completeness.DataSetCompletenessResult;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.system.util.ConversionUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -53,6 +58,20 @@
     {
         this.aggregatedDataValueService = aggregatedDataValueService;
     }
+    
+    private AggregatedOrgUnitDataValueService aggregatedOrgUnitDataValueService;
+
+    public void setAggregatedOrgUnitDataValueService( AggregatedOrgUnitDataValueService aggregatedOrgUnitDataValueService )
+    {
+        this.aggregatedOrgUnitDataValueService = aggregatedOrgUnitDataValueService;
+    }
+    
+    private OrganisationUnitGroupService organisationUnitGroupService;
+
+    public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+    {
+        this.organisationUnitGroupService = organisationUnitGroupService;
+    }
 
     // -------------------------------------------------------------------------
     // Input
@@ -92,6 +111,13 @@
     {
         this.organisationUnitIds = organisationUnitIds;
     }
+    
+    private Integer organisationUnitGroupSetId;
+
+    public void setOrganisationUnitGroupSetId( Integer organisationUnitGroupSetId )
+    {
+        this.organisationUnitGroupSetId = organisationUnitGroupSetId;
+    }
 
     // -------------------------------------------------------------------------
     // Output
@@ -125,18 +151,54 @@
     public String execute()
         throws Exception
     {
-        if ( periodIds != null && organisationUnitIds != null )
-        {
-            if ( indicatorIds != null )
-            {
-                indicatorValues = aggregatedDataValueService.getAggregatedIndicatorValues( indicatorIds, periodIds,
-                    organisationUnitIds );
-            }
-            
-            if ( dataElementIds != null )
-            {
-                dataValues = aggregatedDataValueService.getAggregatedDataValueTotals( dataElementIds, periodIds,
-                    organisationUnitIds );                
+        // ---------------------------------------------------------------------
+        // Org unit group set data
+        // ---------------------------------------------------------------------
+
+        if ( organisationUnitGroupSetId != null && periodIds != null && organisationUnitIds != null && organisationUnitIds.size() > 0 )
+        {
+            Integer organisationUnitId = organisationUnitIds.iterator().next();
+            
+            OrganisationUnitGroupSet groupSet = organisationUnitGroupService.getOrganisationUnitGroupSet( organisationUnitGroupSetId );
+            
+            if ( organisationUnitId == null || groupSet == null )
+            {
+                return SUCCESS;
+            }
+            
+            Collection<Integer> groupSetIds = ConversionUtils.getIdentifiers( OrganisationUnitGroup.class, groupSet.getOrganisationUnitGroups() );
+            
+            if ( indicatorIds != null )
+            {
+                indicatorValues = aggregatedOrgUnitDataValueService.getAggregatedIndicatorValues( indicatorIds, 
+                    periodIds, organisationUnitId, groupSetIds );
+            }
+            
+            if ( dataElementIds != null )
+            {
+                dataValues = aggregatedOrgUnitDataValueService.getAggregatedDataValueTotals( dataElementIds, periodIds, organisationUnitId, groupSetIds );                
+            }
+            
+            if ( dataSetIds != null )
+            {
+                // FIXME will be implemented soon
+            }
+        }
+
+        // ---------------------------------------------------------------------
+        // Regular data
+        // ---------------------------------------------------------------------
+
+        else if ( periodIds != null && organisationUnitIds != null )
+        {
+            if ( indicatorIds != null )
+            {
+                indicatorValues = aggregatedDataValueService.getAggregatedIndicatorValues( indicatorIds, periodIds, organisationUnitIds );
+            }
+            
+            if ( dataElementIds != null )
+            {
+                dataValues = aggregatedDataValueService.getAggregatedDataValueTotals( dataElementIds, periodIds, organisationUnitIds );                
             }
             
             if ( dataSetIds != null )