← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12099: Simplified and fixed bug with data set report for default forms.

 

------------------------------------------------------------
revno: 12099
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-16 13:22:02 +0200
message:
  Simplified and fixed bug with data set report for default forms.
removed:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/JdbcDataSetReportStore.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderDefaultDataSetReportForm.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/SectionStoreTest.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/PatientMobileSettingStore.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.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/common/IdentifiableObjectManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java	2013-09-02 09:29:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java	2013-09-16 11:22:02 +0000
@@ -46,6 +46,8 @@
 
     void update( IdentifiableObject object );
 
+    <T extends IdentifiableObject> T get( String uid );
+    
     <T extends IdentifiableObject> T get( Class<T> clazz, int id );
 
     <T extends IdentifiableObject> T get( Class<T> clazz, String uid );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java	2013-09-11 15:26:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java	2013-09-16 11:22:02 +0000
@@ -140,6 +140,11 @@
 
         return null;
     }
+    
+    public boolean isDefault()
+    {
+        return DEFAULT_NAME.equals( name );
+    }
 
     // -------------------------------------------------------------------------
     // Dimensional object

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java	2013-09-16 11:22:02 +0000
@@ -75,7 +75,7 @@
     {
     }
 
-    public Section( String name, String title, DataSet dataSet, List<DataElement> dataElements, Set<DataElementOperand> greyedFields )
+    public Section( String name, DataSet dataSet, List<DataElement> dataElements, Set<DataElementOperand> greyedFields )
     {
         this.name = name;
         this.dataSet = dataSet;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java	2013-09-16 11:22:02 +0000
@@ -65,7 +65,7 @@
      * @param period the period.
      * @param selectedUnitOnly indicates whether to use captured or aggregated data. 
      * @param format the i18n format.
-     * @return
+     * @return a list of Grids.
      */
     List<Grid> getCustomDataSetReportAsGrid( DataSet dataSet, Period period, OrganisationUnit unit, Set<OrganisationUnitGroup> groups,
         boolean selectedUnitOnly, I18nFormat format );
@@ -80,9 +80,9 @@
      * @param selectedUnitOnly indicates whether to use captured or aggregated data. 
      * @param format the i18n format.
      * @param i18n the i18n object.
-     * @return a Grid.
+     * @return a list of Grids.
      */
-    Grid getDefaultDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<OrganisationUnitGroup> groups,  boolean selectedUnitOnly, I18nFormat format, I18n i18n );
+    List<Grid> getDefaultDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<OrganisationUnitGroup> groups,  boolean selectedUnitOnly, I18nFormat format, I18n i18n );
     
     /**
      * Generates a list of Grids representing a data set report. The data elements

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java	2013-09-16 11:22:02 +0000
@@ -30,13 +30,12 @@
 
 import java.util.List;
 
-import org.hisp.dhis.common.BaseIdentifiableObject;
-
 public class PatientMobileSetting
-    extends BaseIdentifiableObject
 {
-    private static final long serialVersionUID = -5947521380646718129L;
+    public static final long serialVersionUID = -5947521380646718129L;
 
+    private int id;
+    
     private Boolean gender;
 
     private Boolean dobtype;
@@ -55,6 +54,16 @@
     {
     }
 
+    public int getId()
+    {
+        return id;
+    }
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
     public List<PatientAttribute> getPatientAttributes()
     {
         return patientAttributes;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2013-09-02 09:29:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2013-09-16 11:22:02 +0000
@@ -127,6 +127,23 @@
 
     @Override
     @SuppressWarnings("unchecked")
+    public <T extends IdentifiableObject> T get( String uid )
+    {
+        for ( GenericIdentifiableObjectStore<IdentifiableObject> store : identifiableObjectStores )
+        {
+            T object = (T) store.getByUid( uid );
+            
+            if ( object != null )
+            {
+                return object;
+            }
+        }
+        
+        return null;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
     public <T extends IdentifiableObject> T get( Class<T> clazz, int id )
     {
         GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/SectionStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/SectionStoreTest.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/SectionStoreTest.java	2013-09-16 11:22:02 +0000
@@ -84,9 +84,9 @@
 
         Set<DataElementOperand> operands = new HashSet<DataElementOperand>( categoryService.getOperands( dataElements ) );
         
-        sectionA = new Section( "SectionA", "TitleA", dataSet, dataElements, operands );
-        sectionB = new Section( "SectionB", "TitleB", dataSet, dataElements, operands );
-        sectionC = new Section( "SectionC", "TitleC", dataSet, dataElements, operands );
+        sectionA = new Section( "SectionA", dataSet, dataElements, operands );
+        sectionB = new Section( "SectionB", dataSet, dataElements, operands );
+        sectionC = new Section( "SectionC", dataSet, dataElements, operands );
         
     }
     

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/PatientMobileSettingStore.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/PatientMobileSettingStore.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/PatientMobileSettingStore.java	2013-09-16 11:22:02 +0000
@@ -33,9 +33,8 @@
 import org.hisp.dhis.common.GenericStore;
 import org.hisp.dhis.patient.PatientMobileSetting;
 
-public interface PatientMobileSettingStore extends GenericStore<PatientMobileSetting>
+public interface PatientMobileSettingStore 
+    extends GenericStore<PatientMobileSetting>
 {
-
-    public Collection<PatientMobileSetting> getCurrentSetting();
-
+    Collection<PatientMobileSetting> getCurrentSetting();
 }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java	2013-09-16 09:31:18 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java	2013-09-16 11:22:02 +0000
@@ -37,7 +37,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -46,7 +45,7 @@
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.common.GridHeader;
 import org.hisp.dhis.common.GridValue;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.common.ListMap;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
@@ -61,7 +60,6 @@
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.period.Period;
@@ -77,7 +75,6 @@
 public class DefaultDataSetReportService
     implements DataSetReportService
 {   
-    private static final String NULL_REPLACEMENT = "";
     private static final String DEFAULT_HEADER = "Value";
     private static final String TOTAL_HEADER = "Total";
     private static final String SPACE = " ";
@@ -145,7 +142,7 @@
         Map<String, Double> totalMap = dataSetReportStore.getAggregatedTotals( dataSet, period, unit, groups );
 
         List<Grid> grids = new ArrayList<Grid>();
-
+System.out.println("value mpa " + valueMap);
         // ---------------------------------------------------------------------
         // Create a grid for each section
         // ---------------------------------------------------------------------
@@ -247,106 +244,33 @@
         return grids;
     }
 
-    // TODO convert to sections and render similarily
+    public List<Grid> getDefaultDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<OrganisationUnitGroup> groups, 
+        boolean selectedUnitOnly, I18nFormat format, I18n i18n )
+    {
+        ListMap<DataElementCategoryCombo, DataElement> map = new ListMap<DataElementCategoryCombo, DataElement>();
+        
+        for ( DataElement dataElement : dataSet.getDataElements() )
+        {
+            map.putValue( dataElement.getCategoryCombo(), dataElement );
+        }
+
+        DataSet temp = new DataSet( dataSet.getName(), dataSet.getShortName(), dataSet.getPeriodType() );
+        temp.setDataElements( dataSet.getDataElements() );
+        
+        for ( DataElementCategoryCombo categoryCombo : map.keySet() )
+        {
+            List<DataElement> dataElements = map.get( categoryCombo );
+            
+            String name = categoryCombo.isDefault() ? dataSet.getName() : categoryCombo.getName();
+            
+            Section section = new Section( name, dataSet, dataElements, null );
+            
+            temp.getSections().add( section );
+        }
+        
+        return getSectionDataSetReport( temp, period, unit, groups, selectedUnitOnly, format, i18n );
+    }
     
-    public Grid getDefaultDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, Set<OrganisationUnitGroup> groups, boolean selectedUnitOnly, I18nFormat format, I18n i18n )
-    {
-        List<DataElement> dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
-
-        Collections.sort( dataElements, IdentifiableObjectNameComparator.INSTANCE );
-        FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
-
-        Map<String, Double> valueMap = dataSetReportStore.getAggregatedValues( dataSet, period, unit, groups, selectedUnitOnly );
-        Map<String, Double> indicatorValueMap = dataSetReportStore.getAggregatedIndicatorValues( dataSet, period, unit, groups );
-        
-        // ---------------------------------------------------------------------
-        // Get category option combos
-        // ---------------------------------------------------------------------
-
-        Set<DataElementCategoryOptionCombo> optionCombos = new HashSet<DataElementCategoryOptionCombo>();
-
-        for ( DataElement dataElement : dataElements )
-        {
-            optionCombos.addAll( dataElement.getCategoryCombo().getOptionCombos() );
-        }
-
-        List<DataElementCategoryOptionCombo> orderedOptionCombos = new ArrayList<DataElementCategoryOptionCombo>(
-            optionCombos );
-
-        Collections.sort( orderedOptionCombos, IdentifiableObjectNameComparator.INSTANCE );
-
-        // ---------------------------------------------------------------------
-        // Create a grid
-        // ---------------------------------------------------------------------
-
-        Grid grid = new ListGrid().setTitle( dataSet.getName() );
-        grid.setSubtitle( unit.getName() + SPACE + format.formatPeriod( period ) );
-
-        // ---------------------------------------------------------------------
-        // Headers
-        // ---------------------------------------------------------------------
-
-        grid.addHeader( new GridHeader( i18n.getString( "name" ), false, true ) );
-         
-        for ( DataElementCategoryOptionCombo optionCombo : orderedOptionCombos )
-        {
-            grid.addHeader( new GridHeader( optionCombo.isDefault() ? DEFAULT_HEADER : optionCombo.getName(), false, false ) );
-        }
-
-        // ---------------------------------------------------------------------
-        // Values
-        // ---------------------------------------------------------------------
-
-        for ( DataElement dataElement : dataElements )
-        {
-            grid.addRow();
-
-            grid.addValue( dataElement.getName() );
-
-            for ( DataElementCategoryOptionCombo optionCombo : orderedOptionCombos )
-            {
-                Double value = null;
-
-                if ( selectedUnitOnly )
-                {
-                    DataValue dataValue = dataValueService.getDataValue( unit, dataElement, period, optionCombo );
-                    value = dataValue != null && dataValue.getValue() != null ? Double.parseDouble( dataValue.getValue() ) : null;
-                }
-                else
-                {
-                    value = valueMap.get( dataElement.getUid() + SEPARATOR + optionCombo.getUid() );
-                }
-
-                grid.addValue( value );
-
-            }
-        }
-        
-        // ---------------------------------------------------------------------
-        // Indicator values
-        // ---------------------------------------------------------------------
-
-        List<Indicator> indicators = new ArrayList<Indicator>( dataSet.getIndicators() );
-        
-        for ( Indicator indicator : indicators )
-        {
-            grid.addRow();
-
-            grid.addValue( indicator.getName() );
-            
-            Double value = indicatorValueMap.get( String.valueOf( indicator.getUid() ) );
-            
-            grid.addValue( value );
-            
-            for ( int i = 0; i < orderedOptionCombos.size() - 1; i++ )
-            {
-                grid.addValue( NULL_REPLACEMENT );
-            }
-        }
-        
-        return grid;
-    }
-
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java	2013-09-16 11:22:02 +0000
@@ -72,9 +72,9 @@
         Set<OrganisationUnitGroup> groups, boolean rawData )
     {
         List<DataElement> dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
-
+System.out.println("de " + dataElements);
         FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
-
+System.out.println("de 2 " + dataElements);
         if ( dataElements.isEmpty() )
         {
             return new HashMap<String, Double>();
@@ -96,7 +96,7 @@
         }
         
         Map<String, Double> map = analyticsService.getAggregatedDataValueMapping( params );
-        
+System.out.println("map " + map);
         Map<String, Double> dataMap = new HashMap<String, Double>();
         
         for ( Entry<String, Double> entry : map.entrySet() )
@@ -127,6 +127,11 @@
             
             for ( DataElementCategory category : categories )
             {
+                if ( category.isDefault() )
+                {
+                    continue;
+                }
+                
                 DataQueryParams params = new DataQueryParams();
                 
                 params.setDataElements( dataElements );

=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/JdbcDataSetReportStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/JdbcDataSetReportStore.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/JdbcDataSetReportStore.java	1970-01-01 00:00:00 +0000
@@ -1,217 +0,0 @@
-package org.hisp.dhis.datasetreport.jdbc;
-
-/*
- * Copyright (c) 2004-2013, 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 static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.Section;
-import org.hisp.dhis.datasetreport.DataSetReportStore;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
-import org.hisp.dhis.system.util.FilterUtils;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.support.rowset.SqlRowSet;
-
-/**
- * @author Lars Helge Overland
- */
-public class JdbcDataSetReportStore
-    implements DataSetReportStore
-{
-    private JdbcTemplate jdbcTemplate;
-    
-    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
-    {
-        this.jdbcTemplate = jdbcTemplate;
-    }
-    
-    // -------------------------------------------------------------------------
-    // DataSetReportStore implementation
-    // -------------------------------------------------------------------------
-
-    public Map<String, Double> getAggregatedValues( DataSet dataSet, Period period, OrganisationUnit unit, 
-        Set<OrganisationUnitGroup> groups, boolean rawData )
-    {
-        Map<String, Double> map = new HashMap<String, Double>();
-        
-        Set<DataElement> dataElements = new HashSet<DataElement>( dataSet.getDataElements() );
-
-        FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
-
-        if ( !dataElements.isEmpty() )
-        {
-            final String sql = rawData ?
-                "select de.uid, coc.uid, dv.value " +
-                "from datavalue dv " +
-                "left join dataelement de on dv.dataelementid = de.dataelementid " +
-                "left join categoryoptioncombo coc on dv.categoryoptioncomboid = coc.categoryoptioncomboid " +
-                "where dv.dataelementid in (" + getCommaDelimitedString( getIdentifiers( DataElement.class, dataElements ) ) + ") " +
-                "and dv.periodid = " + period.getId() + " " +
-                "and dv.sourceid = " + unit.getId()
-                :
-                "select de.uid, coc.uid, dv.value " +
-                "from aggregateddatavalue dv " +
-                "left join dataelement de on dv.dataelementid = de.dataelementid " +
-                "left join categoryoptioncombo coc on dv.categoryoptioncomboid = coc.categoryoptioncomboid " +
-                "where dv.dataelementid in (" + getCommaDelimitedString( getIdentifiers( DataElement.class, dataElements ) ) + ") " +
-                "and dv.periodid = " + period.getId() + " " +
-                "and dv.organisationunitid = " + unit.getId();            
-            
-            SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-            
-            while ( rowSet.next() )
-            {
-                String dataElementId = rowSet.getString( 1 );
-                String categoryOptionComboId = rowSet.getString( 2 );
-                Double value = rowSet.getDouble( 3 );
-                
-                map.put( dataElementId + SEPARATOR + categoryOptionComboId, value );
-            }
-        }
-        
-        return map;
-    }
-    
-    public Map<String, Double> getAggregatedSubTotals( DataSet dataSet, Period period, OrganisationUnit unit, Set<OrganisationUnitGroup> groups )
-    {
-        Map<String, Double> map = new HashMap<String, Double>();
-        
-        for ( Section section : dataSet.getSections() )
-        {
-            DataElementCategoryCombo categoryCombo = section.getCategoryCombo();
-            Set<DataElement> dataElements = new HashSet<DataElement>( section.getDataElements() );
-            
-            if ( !dataElements.isEmpty() )
-            {
-                for ( DataElementCategoryOption categoryOption : categoryCombo.getCategoryOptions() )
-                {
-                    final String sql = 
-                        "select de.uid, sum(dv.value) as total " +
-                        "from aggregateddatavalue dv " +
-                        "left join dataelement de on dv.dataelementid = de.dataelementid " +
-                        "where dv.dataelementid in (" + getCommaDelimitedString( getIdentifiers( DataElement.class, dataElements ) ) + ") " +
-                        "and dv.categoryoptioncomboid in (" + getCommaDelimitedString( getIdentifiers( DataElementCategoryOptionCombo.class, categoryOption.getCategoryOptionCombos() ) ) + ") " +
-                        "and dv.periodid = " + period.getId() + " " +
-                        "and dv.organisationunitid = " + unit.getId() + " " +
-                        "group by de.uid";
-                    
-                    SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-                    
-                    while ( rowSet.next() )
-                    {
-                        String dataElementId = rowSet.getString( 1 );
-                        Double value = rowSet.getDouble( 2 );
-                        
-                        map.put( dataElementId + SEPARATOR + categoryOption.getUid(), value );
-                    }
-                }
-            }
-        }
-        
-        return map;
-    }
-    
-    public Map<String, Double> getAggregatedTotals( DataSet dataSet, Period period, OrganisationUnit unit, Set<OrganisationUnitGroup> groups )
-    {
-        Map<String, Double> map = new HashMap<String, Double>();
-        
-        Set<DataElement> dataElements = new HashSet<DataElement>( dataSet.getDataElements() );
-
-        FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
-
-        if ( !dataElements.isEmpty() )
-        {
-            final String sql = 
-                "select de.uid, sum(dv.value) as total " +
-                "from aggregateddatavalue dv " +
-                "left join dataelement de on dv.dataelementid = de.dataelementid " +
-                "where dv.dataelementid in (" + getCommaDelimitedString( getIdentifiers( DataElement.class, dataElements ) ) + ") " +
-                "and dv.periodid = " + period.getId() + " " +
-                "and dv.organisationunitid = " + unit.getId() + " " +
-                "group by de.uid";
-    
-            SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-            
-            while ( rowSet.next() )
-            {
-                String dataElementId = rowSet.getString( 1 );
-                Double value = rowSet.getDouble( 2 );
-                
-                map.put( String.valueOf( dataElementId ), value );
-            }
-        }
-        
-        return map;
-    }
-    
-    public Map<String, Double> getAggregatedIndicatorValues( DataSet dataSet, Period period, OrganisationUnit unit, Set<OrganisationUnitGroup> groups )
-    {
-        Map<String, Double> map = new HashMap<String, Double>();
-        
-        Set<Indicator> indicators = new HashSet<Indicator>( dataSet.getIndicators() );
-        
-        if ( !indicators.isEmpty() )
-        {
-            final String sql =
-                "select ind.uid, sum(dv.value) as total " +
-                "from aggregatedindicatorvalue dv " +
-                "left join indicator ind on dv.indicatorid = ind.indicatorid " +
-                "where dv.indicatorid in (" + getCommaDelimitedString( getIdentifiers( Indicator.class, indicators ) ) + ") " +
-                "and dv.periodid = " + period.getId() + " " +
-                "and dv.organisationunitid = " + unit.getId() + " " +
-                "group by ind.uid";
-    
-            SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-            
-            while ( rowSet.next() )
-            {
-                String indicatorid = rowSet.getString( 1 );
-                Double value = rowSet.getDouble( 2 );
-                
-                map.put( String.valueOf( indicatorid ), value );
-            }
-        }
-        
-        return map;
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2013-09-13 13:00:37 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2013-09-16 11:22:02 +0000
@@ -112,14 +112,10 @@
 
   <bean id="org.hisp.dhis.datasetreport.DataSetReportService" class="org.hisp.dhis.datasetreport.impl.DefaultDataSetReportService">
     <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
-	<property name="dataSetReportStore" ref="org.hisp.dhis.datasetreport.AnalyticsDataSetReportStore" />
+	<property name="dataSetReportStore" ref="org.hisp.dhis.datasetreport.DataSetReportStore" />
   </bean>
   
-  <bean id="org.hisp.dhis.datasetreport.DataSetReportStore" class="org.hisp.dhis.datasetreport.jdbc.JdbcDataSetReportStore">
-	<property name="jdbcTemplate" ref="jdbcTemplate" />
-  </bean>
-
-  <bean id="org.hisp.dhis.datasetreport.AnalyticsDataSetReportStore" class="org.hisp.dhis.datasetreport.jdbc.AnalyticsDataSetReportStore">
+  <bean id="org.hisp.dhis.datasetreport.DataSetReportStore" class="org.hisp.dhis.datasetreport.jdbc.AnalyticsDataSetReportStore">
     <property name="analyticsService" ref="org.hisp.dhis.analytics.AnalyticsService" />
   </bean>
   

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java	2013-09-16 11:22:02 +0000
@@ -46,12 +46,14 @@
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.QuarterlyPeriodType;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  * @author Lars Helge Overland
  * @version $Id$
  */
+@Ignore //TODO this test takes too long to run, reimplement
 public class DataSetCompletenessServiceExportTest
     extends DhisTest
 {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java	2013-09-02 17:38:21 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java	2013-09-16 11:22:02 +0000
@@ -48,6 +48,9 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
+/**
+ * @author Lars Helge Overland
+ */
 @Controller
 public class EventAnalyticsController
 {

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java	2013-09-16 11:22:02 +0000
@@ -229,13 +229,6 @@
         return grids;
     }
 
-    private Grid grid;
-
-    public Grid getGrid()
-    {
-        return grid;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -304,7 +297,7 @@
         }
         else
         {
-            grid = dataSetReportService.getDefaultDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, ouGroups, selectedUnitOnly, format, i18n );
+            grids = dataSetReportService.getDefaultDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, ouGroups, selectedUnitOnly, format, i18n );
         }
         
         return type != null ? type : dataSetType;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2013-05-29 20:10:38 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2013-09-16 11:22:02 +0000
@@ -180,7 +180,7 @@
     </action>
 
     <action name="generateDataSetReport" class="org.hisp.dhis.reporting.dataset.action.GenerateDataSetReportAction">
-      <result name="default" type="velocity">/dhis-web-reporting/renderDefaultDataSetReportForm.vm</result>
+      <result name="default" type="velocity">/dhis-web-reporting/renderSectionDataSetReportForm.vm</result>
       <result name="section" type="velocity">/dhis-web-reporting/renderSectionDataSetReportForm.vm</result>
       <result name="custom" type="velocity">/dhis-web-reporting/renderCustomDataSetReportForm.vm</result>
       <result name="xls" type="gridXlsResult" />

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderDefaultDataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderDefaultDataSetReportForm.vm	2012-09-03 19:48:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderDefaultDataSetReportForm.vm	1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-
-#parse( "dhis-web-reporting/renderDataSetReportHeader.vm" )
-
-<div>
-#parse( "dhis-web-commons/ajax/htmlGrid.vm" )
-</div>