← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10959: Made ReportTable sortOrder and topLimit primitives instead of objects

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 10959 [merge]
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-23 14:01:15 +0200
message:
  Made ReportTable sortOrder and topLimit primitives instead of objects
removed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartValueController.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.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/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2013-05-23 09:23:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2013-05-23 12:00:05 +0000
@@ -211,14 +211,14 @@
     private ReportParams reportParams;
 
     /**
-     * The sort order if any applied to the last column of the table.
+     * The sort order based on the last column of the table, 0 if none. 
      */
-    private Integer sortOrder;
+    private int sortOrder;
 
     /**
-     * Indicates whether the table should be limited from top by this value.
+     * Indicates whether the table should be limited from top, 0 if none.
      */
-    private Integer topLimit;
+    private int topLimit;
 
     /**
      * Indicates rendering of sub-totals for the table.
@@ -383,9 +383,7 @@
             addTransientOrganisationUnit( organisationUnit );
         }
 
-        // Populate grid
-        
-        this.populateGridColumnsAndRows( date, user, format );
+        // Handle special dimension
         
         if ( isDimensional() )
         {
@@ -393,10 +391,9 @@
             verify( nonEmptyLists( categoryOptionCombos ) == 1, "Category option combos size must be larger than 0" );
         }
 
-        // Allow for no columns or rows
+        // Populate grid
         
-        addIfEmpty( gridColumns ); 
-        addIfEmpty( gridRows );
+        this.populateGridColumnsAndRows( date, user, format );
     }
     
     // -------------------------------------------------------------------------
@@ -419,7 +416,10 @@
         }
 
         gridColumns = new CombinationGenerator<NameableObject>( tableColumns.toArray( IRT2D ) ).getCombinations();
-        gridRows = new CombinationGenerator<NameableObject>( tableRows.toArray( IRT2D ) ).getCombinations();        
+        gridRows = new CombinationGenerator<NameableObject>( tableRows.toArray( IRT2D ) ).getCombinations();
+
+        addIfEmpty( gridColumns ); 
+        addIfEmpty( gridRows );
     }
     
     @Override
@@ -440,17 +440,7 @@
             filters.addAll( getDimensionalObjectList( filter ) );
         }
     }
-            
-    private DataElementCategoryCombo getCategoryCombo()
-    {
-        if ( dataElements != null && !dataElements.isEmpty() )
-        {
-            return dataElements.get( 0 ).getCategoryCombo();
-        }
-        
-        return null;
-    }
-
+    
     /**
      * Indicates whether this ReportTable is multi-dimensional.
      */
@@ -542,22 +532,6 @@
     }
     
     /**
-     * Returns null-safe sort order, none if null.
-     */
-    public int sortOrder()
-    {
-        return sortOrder != null ? sortOrder : NONE;
-    }
-
-    /**
-     * Returns null-safe top limit, 0 if null;
-     */
-    public int topLimit()
-    {
-        return topLimit != null ? topLimit : 0;
-    }
-
-    /**
      * Tests whether this report table has report params.
      */
     public boolean hasReportParams()
@@ -624,10 +598,10 @@
      *
      * @param grid the grid, should be empty and not null.
      * @param valueMap the mapping of identifiers to aggregate values.
-     * @param format the I18nFormat.
+     * @param paramColumns whether to include report parameter columns.
      * @return a grid.
      */
-    public Grid getGrid( Grid grid, Map<String, Double> valueMap )
+    public Grid getGrid( Grid grid, Map<String, Double> valueMap, boolean paramColumns )
     {
         final String subtitle = StringUtils.trimToEmpty( getParentOrganisationUnitName() ) + SPACE
             + StringUtils.trimToEmpty( getReportingPeriodName() );
@@ -638,7 +612,7 @@
         // Headers
         // ---------------------------------------------------------------------
 
-        for ( String row : getRowDimensions() )
+        for ( String row : rowDimensions )
         {
             String name = StringUtils.defaultIfEmpty( DimensionalObject.PRETTY_NAMES.get( row ), row );
             
@@ -648,17 +622,20 @@
             grid.addHeader( new GridHeader( name + " description", row + "_description", String.class.getName(), true, true ) );
         }
         
-        grid.addHeader( new GridHeader( "Reporting month", REPORTING_MONTH_COLUMN_NAME,
-            String.class.getName(), true, true ) );
-        grid.addHeader( new GridHeader( "Organisation unit parameter",
-            PARAM_ORGANISATIONUNIT_COLUMN_NAME, String.class.getName(), true, true ) );
-        grid.addHeader( new GridHeader( "Organisation unit is parent",
-            ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME, String.class.getName(), true, true ) );
+        if ( paramColumns )
+        {
+            grid.addHeader( new GridHeader( "Reporting month", REPORTING_MONTH_COLUMN_NAME,
+                String.class.getName(), true, true ) );
+            grid.addHeader( new GridHeader( "Organisation unit parameter",
+                PARAM_ORGANISATIONUNIT_COLUMN_NAME, String.class.getName(), true, true ) );
+            grid.addHeader( new GridHeader( "Organisation unit is parent",
+                ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME, String.class.getName(), true, true ) );
+        }
 
         final int startColumnIndex = grid.getHeaders().size();
         final int numberOfColumns = getGridColumns().size();
 
-        for ( List<NameableObject> column : getGridColumns() )
+        for ( List<NameableObject> column : gridColumns )
         {
             grid.addHeader( new GridHeader( getPrettyColumnName( column ), getColumnName( column ), Double.class
                 .getName(), false, false ) );
@@ -668,7 +645,7 @@
         // Values
         // ---------------------------------------------------------------------
 
-        for ( List<NameableObject> row : getGridRows() )
+        for ( List<NameableObject> row : gridRows )
         {
             grid.addRow();
 
@@ -684,15 +661,18 @@
                 grid.addValue( object.getDescription() );
             }
             
-            grid.addValue( getReportingPeriodName() );
-            grid.addValue( getParentOrganisationUnitName() );
-            grid.addValue( isCurrentParent( row ) ? "Yes" : "No" );
+            if ( paramColumns )
+            {
+                grid.addValue( reportingPeriodName );
+                grid.addValue( getParentOrganisationUnitName() );
+                grid.addValue( isCurrentParent( row ) ? "Yes" : "No" );
+            }
 
             // -----------------------------------------------------------------
             // Row data values
             // -----------------------------------------------------------------
 
-            for ( List<NameableObject> column : getGridColumns() )
+            for ( List<NameableObject> column : gridColumns )
             {
                 String key = BaseAnalyticalObject.getId( column, row );
                 
@@ -702,12 +682,12 @@
             }
         }
 
-        if ( isRegression() )
+        if ( regression )
         {
             grid.addRegressionToGrid( startColumnIndex, numberOfColumns );
         }
 
-        if ( isCumulative() )
+        if ( cumulative )
         {
             grid.addCumulativesToGrid( startColumnIndex, numberOfColumns );
         }
@@ -716,14 +696,14 @@
         // Sort and limit
         // ---------------------------------------------------------------------
 
-        if ( sortOrder() != ReportTable.NONE )
+        if ( sortOrder != ReportTable.NONE )
         {
-            grid.sortGrid( grid.getWidth(), sortOrder() );
+            grid.sortGrid( grid.getWidth(), sortOrder );
         }
 
-        if ( topLimit() > 0 )
+        if ( topLimit > 0 )
         {
-            grid.limitGrid( topLimit() );
+            grid.limitGrid( topLimit );
         }
 
         return grid;
@@ -772,7 +752,20 @@
             throw new IllegalStateException( falseMessage );
         }
     }
-    
+
+    /**
+     * Returns the category combo of the first data element.
+     */
+    private DataElementCategoryCombo getCategoryCombo()
+    {
+        if ( dataElements != null && !dataElements.isEmpty() )
+        {
+            return dataElements.get( 0 ).getCategoryCombo();
+        }
+        
+        return null;
+    }
+
     /**
      * Gets the real Nameable class in case of a proxy.
      */
@@ -886,12 +879,12 @@
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class, DimensionalView.class} )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
-    public Integer getSortOrder()
+    public int getSortOrder()
     {
         return sortOrder;
     }
 
-    public void setSortOrder( Integer sortOrder )
+    public void setSortOrder( int sortOrder )
     {
         this.sortOrder = sortOrder;
     }
@@ -899,12 +892,12 @@
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class, DimensionalView.class} )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
-    public Integer getTopLimit()
+    public int getTopLimit()
     {
         return topLimit;
     }
 
-    public void setTopLimit( Integer topLimit )
+    public void setTopLimit( int topLimit )
     {
         this.topLimit = topLimit;
     }
@@ -1051,8 +1044,8 @@
             regression = reportTable.isRegression();
             cumulative = reportTable.isCumulative();
             reportParams = reportTable.getReportParams() == null ? reportParams : reportTable.getReportParams();
-            sortOrder = reportTable.getSortOrder() == null ? sortOrder : reportTable.getSortOrder();
-            topLimit = reportTable.getTopLimit() == null ? topLimit : reportTable.getTopLimit();
+            sortOrder = reportTable.getSortOrder();
+            topLimit = reportTable.getTopLimit();
             totals = reportTable.isTotals();
             subtotals = reportTable.isSubtotals();
             hideEmptyRows = reportTable.isHideEmptyRows();

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2013-05-23 10:06:41 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2013-05-23 12:01:15 +0000
@@ -104,6 +104,7 @@
 import org.hisp.dhis.period.RelativePeriodEnum;
 import org.hisp.dhis.period.RelativePeriods;
 import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
+import org.hisp.dhis.reporttable.ReportTable;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.system.util.ConversionUtils;
 import org.hisp.dhis.system.util.DebugUtils;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-05-23 12:00:05 +0000
@@ -438,6 +438,8 @@
         executeSql( "update reporttable set displaydensity = 'normal' where displaydensity is null" );
         executeSql( "update reporttable set fontsize = 'normal' where fontsize is null" );
         executeSql( "update reporttable set digitgroupseparator = 'space' where digitgroupseparator is null" );
+        executeSql( "update reporttable set sortorder = 0 where sortorder is null" );
+        executeSql( "update reporttable set toplimit = 0 where toplimit is null" );
 
         executeSql( "update chart set reportingmonth = false where reportingmonth is null" );
         executeSql( "update chart set reportingbimonth = false where reportingbimonth is null" );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2013-05-23 09:23:19 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2013-05-23 11:45:52 +0000
@@ -114,7 +114,7 @@
 
         Map<String, Double> valueMap = analyticsService.getAggregatedDataValueMapping( reportTable, format );
 
-        return reportTable.getGrid( new ListGrid(), valueMap );
+        return reportTable.getGrid( new ListGrid(), valueMap, true );
     }
 
     @Override

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartValueController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartValueController.java	2013-04-16 17:43:48 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartValueController.java	1970-01-01 00:00:00 +0000
@@ -1,374 +0,0 @@
-package org.hisp.dhis.api.controller;
-
-/*
- * 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 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.api.utils.ContextUtils;
-import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
-import org.hisp.dhis.api.webdomain.ChartValue;
-import org.hisp.dhis.completeness.DataSetCompletenessResult;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.i18n.I18nManager;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.comparator.AscendingPeriodEndDateComparator;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.user.CurrentUserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import static org.hisp.dhis.api.utils.ContextUtils.CONTENT_TYPE_JSON;
-import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-import static org.hisp.dhis.system.util.DateUtils.setNames;
-
-@Controller
-@RequestMapping( value = ChartValueController.RESOURCE_PATH )
-public class ChartValueController
-{
-    public static final String RESOURCE_PATH = "/chartValues";
-
-    @Autowired
-    private AggregatedDataValueService aggregatedDataValueService;
-
-    @Autowired
-    private AggregatedOrgUnitDataValueService aggregatedOrgUnitDataValueService;
-    
-    @Autowired
-    private IndicatorService indicatorService;
-
-    @Autowired
-    private DataElementService dataElementService;
-
-    @Autowired
-    private DataSetService dataSetService;
-    
-    @Autowired
-    private PeriodService periodService;
-
-    @Autowired
-    private OrganisationUnitService organisationUnitService;
-    
-    @Autowired
-    private OrganisationUnitGroupService organisationUnitGroupService;
-
-    @Autowired
-    private CurrentUserService currentUserService;
-
-    @Autowired
-    private I18nManager i18nManager;
-
-    @Autowired
-    private ContextUtils contextUtils;
-
-    @RequestMapping( method = RequestMethod.GET )
-    public String getChartValues( @RequestParam( required = false ) Set<String> in,
-        @RequestParam( required = false ) Set<String> de,
-        @RequestParam( required = false ) Set<String> ds,
-        @RequestParam( required = false ) Set<String> p,
-        @RequestParam Set<String> ou,
-        @RequestParam( required = false ) boolean orgUnitIsParent,
-        @RequestParam( required = false ) String organisationUnitGroupSetId,
-        @RequestParam( required = false ) boolean userOrganisationUnit,
-        @RequestParam( required = false ) boolean userOrganisationUnitChildren,
-        @RequestParam( required = false ) boolean periodIsFilter,
-        @RequestParam( required = false ) boolean rewind,
-        RelativePeriods relativePeriods, Model model, HttpServletResponse response ) throws Exception
-    {
-        ChartValue chartValue = new ChartValue();
-
-        I18nFormat format = i18nManager.getI18nFormat();
-
-        // ---------------------------------------------------------------------
-        // Periods
-        // ---------------------------------------------------------------------
-        
-        List<Period> periods = rewind ? relativePeriods.getRewindedRelativePeriods() :
-            relativePeriods.getRelativePeriods();
-        
-        if ( p != null && p.size() > 0 )
-        {
-            for ( String iso : p )
-            {
-                Period period = PeriodType.getPeriodFromIsoString( iso );
-                
-                if ( !periods.contains( period ) )
-                {
-                    periods.add( period );
-                }
-            }
-        }
-
-        periods = periodService.reloadPeriods( setNames( periods, format ) );
-        
-        if ( periodIsFilter )
-        {
-            periods = Arrays.asList( periods.get( 0 ) );
-        }
-
-        if ( periods.isEmpty() )
-        {
-            ContextUtils.conflictResponse( response, "No valid periods specified" );
-            return null;
-        }
-        
-        Collections.sort( periods, new AscendingPeriodEndDateComparator() );
-
-        for ( Period period : periods )
-        {
-            chartValue.getPeriods().add( period.getName() );
-        }
-
-        // ---------------------------------------------------------------------
-        // Organisation units
-        // ---------------------------------------------------------------------
-
-        List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
-
-        if ( userOrganisationUnit || userOrganisationUnitChildren )
-        {
-            if ( userOrganisationUnit )
-            {
-                organisationUnits.add( currentUserService.getCurrentUser().getOrganisationUnit() );
-            }
-
-            if ( userOrganisationUnitChildren )
-            {
-                organisationUnits.addAll( new ArrayList<OrganisationUnit>( currentUserService.getCurrentUser()
-                    .getOrganisationUnit().getSortedChildren() ) );
-            }
-        }
-        else
-        {
-            organisationUnits = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsByUid( ou ) );
-        }
-
-        if ( orgUnitIsParent )
-        {
-            List<OrganisationUnit> childOrganisationUnits = new ArrayList<OrganisationUnit>();
-
-            for ( OrganisationUnit unit : organisationUnits )
-            {
-                childOrganisationUnits.addAll( unit.getChildren() );
-            }
-
-            organisationUnits = childOrganisationUnits;
-        }
-
-        if ( organisationUnits.isEmpty() )
-        {
-            ContextUtils.conflictResponse( response, "No valid organisation units specified" );
-            return null;
-        }
-
-        // ---------------------------------------------------------------------
-        // Organisation unit groups
-        // ---------------------------------------------------------------------
-
-        boolean useGroupSets = organisationUnitGroupSetId != null;
-        OrganisationUnit firstOrgUnit = organisationUnits.get( 0 );
-        
-        List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>();        
-        
-        if ( useGroupSets )
-        {
-            OrganisationUnitGroupSet groupSet = organisationUnitGroupService.getOrganisationUnitGroupSet( organisationUnitGroupSetId );
-            organisationUnitGroups.addAll( groupSet.getOrganisationUnitGroups() );
-        }
-
-        if ( useGroupSets )
-        {
-            for ( OrganisationUnitGroup groupSet : organisationUnitGroups )
-            {
-                chartValue.getOrgUnits().add( groupSet.getName() );
-            }
-        }
-        else
-        {
-            for ( OrganisationUnit unit : organisationUnits )
-            {
-                chartValue.getOrgUnits().add( unit.getName() );
-            }
-        }
-
-        // ---------------------------------------------------------------------
-        // Indicators
-        // ---------------------------------------------------------------------
-
-        if ( in != null )
-        {
-            List<Indicator> indicators = indicatorService.getIndicatorsByUid( in );
-
-            if ( indicators.isEmpty() )
-            {
-                ContextUtils.conflictResponse( response, "No valid indicators specified" );
-                return null;
-            }
-
-            for ( Indicator indicator : indicators )
-            {
-                chartValue.getData().add( indicator.getName() );
-            }
-
-            Collection<AggregatedIndicatorValue> indicatorValues = useGroupSets ?
-                aggregatedOrgUnitDataValueService.getAggregatedIndicatorValues( getIdentifiers( Indicator.class, indicators ),
-                    getIdentifiers( Period.class, periods ), firstOrgUnit.getId(), getIdentifiers( OrganisationUnitGroup.class, organisationUnitGroups ) ) :
-                aggregatedDataValueService.getAggregatedIndicatorValues( getIdentifiers( Indicator.class, indicators ),
-                    getIdentifiers( Period.class, periods ), getIdentifiers( OrganisationUnit.class, organisationUnits ) );
-
-            for ( AggregatedIndicatorValue value : indicatorValues )
-            {
-                String[] record = new String[4];
-
-                record[0] = String.valueOf( value.getValue() );
-                record[1] = indicatorService.getIndicator( value.getIndicatorId() ).getName();
-                record[2] = format.formatPeriod( periodService.getPeriod( value.getPeriodId() ) );
-                record[3] = useGroupSets ?
-                    organisationUnitGroupService.getOrganisationUnitGroup( value.getOrganisationUnitGroupId() ).getName() :
-                    organisationUnitService.getOrganisationUnit( value.getOrganisationUnitId() ).getName();
-
-                chartValue.getValues().add( record );
-            }
-        }
-
-        // ---------------------------------------------------------------------
-        // Data elements
-        // ---------------------------------------------------------------------
-
-        if ( de != null )
-        {
-            List<DataElement> dataElements = dataElementService.getDataElementsByUid( de );
-
-            if ( dataElements.isEmpty() )
-            {
-                ContextUtils.conflictResponse( response, "No valid data elements specified" );
-                return null;
-            }
-
-            for ( DataElement element : dataElements )
-            {
-                chartValue.getData().add( element.getName() );
-            }
-
-            Collection<AggregatedDataValue> dataValues = useGroupSets ?
-                aggregatedOrgUnitDataValueService.getAggregatedDataValueTotals( getIdentifiers( DataElement.class, dataElements ), 
-                    getIdentifiers( Period.class, periods ), firstOrgUnit.getId(), getIdentifiers( OrganisationUnitGroup.class, organisationUnitGroups ) ) :
-                aggregatedDataValueService.getAggregatedDataValueTotals( getIdentifiers( DataElement.class, dataElements ), 
-                    getIdentifiers( Period.class, periods ), getIdentifiers( OrganisationUnit.class, organisationUnits ) );
-
-            for ( AggregatedDataValue value : dataValues )
-            {
-                String[] record = new String[4];
-
-                record[0] = String.valueOf( value.getValue() );
-                record[1] = dataElementService.getDataElement( value.getDataElementId() ).getName();
-                record[2] = format.formatPeriod( periodService.getPeriod( value.getPeriodId() ) );
-                record[3] = useGroupSets ?
-                    organisationUnitGroupService.getOrganisationUnitGroup( value.getOrganisationUnitGroupId() ).getName() :
-                    organisationUnitService.getOrganisationUnit( value.getOrganisationUnitId() ).getName();
-
-                chartValue.getValues().add( record );
-            }
-        }
-
-        // ---------------------------------------------------------------------
-        // Data set completeness
-        // ---------------------------------------------------------------------
-
-        if ( ds != null )
-        {
-            Set<DataSet> dataSets = new HashSet<DataSet>();
-            
-            for ( String id : ds )
-            {
-                dataSets.add( dataSetService.getDataSet( id ) );
-            }
-            
-            if ( dataSets.isEmpty() )
-            {
-                ContextUtils.conflictResponse( response, "No valid data sets specified" );
-                return null;
-            }
-            
-            for ( DataSet dataSet : dataSets )
-            {
-                chartValue.getData().add( dataSet.getName() );
-            }
-            
-            Collection<DataSetCompletenessResult> dataSetValues = useGroupSets ?
-                new ArrayList<DataSetCompletenessResult>() : // not yet implemented
-                aggregatedDataValueService.getAggregatedDataSetCompleteness( getIdentifiers( DataSet.class, dataSets ), 
-                    getIdentifiers( Period.class, periods ), getIdentifiers( OrganisationUnit.class, organisationUnits ) ); 
-            
-            for ( DataSetCompletenessResult value : dataSetValues )
-            {
-                String[] record = new String[4];
-                
-                record[0] = String.valueOf( value.getValue() );
-                record[1] = dataSetService.getDataSet( value.getDataSetId() ).getName();
-                record[2] = format.formatPeriod( periodService.getPeriod( value.getPeriodId() ) );
-                record[3] = organisationUnitService.getOrganisationUnit( value.getOrganisationUnitId() ).getName();
-                
-                chartValue.getValues().add( record );                
-            }
-        }
-        
-        contextUtils.configureResponse( response, CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING, null, false );
-
-        model.addAttribute( "model", chartValue );
-
-        return "chartValues";
-    }
-}