=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java 2015-03-07 16:16:41 +0000 @@ -295,7 +295,7 @@ * * @param metaDataMap meta-data map of keys and substitutions. */ - Grid substituteMetaData( Map metaDataMap ); + Grid substituteMetaData( Map metaDataMap ); /** * Substitutes the values in the meta columns with the mapped value in the @@ -304,7 +304,7 @@ * @param columnIndex the index of the column to substitute. * @param metaDataMap meta-data map of keys and substitutions. */ - Grid substituteMetaData( int columnIndex, Map metaDataMap ); + Grid substituteMetaData( int columnIndex, Map metaDataMap ); /** * Returns indexes of the meta grid headers. === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java 2015-03-07 16:16:41 +0000 @@ -167,10 +167,10 @@ } /** - * Returns a mapping between the uid and the nameable objects. + * Returns a mapping between the UID and the nameable objects. * * @param objects the nameable objects. - * @return mapping between the uid and the nameable objects. + * @return mapping between the UID and the nameable objects. */ public static Map getUidObjectMap( List objects ) { @@ -188,7 +188,7 @@ } /** - * Returns a mapping between the uid and the short name of the given nameable + * Returns a mapping between the UID and the short name of the given nameable * objects. * * @param objects the v objects. @@ -208,4 +208,36 @@ return map; } + + /** + * Returns a mapping between the UID and the property of the object + * indicated by the given property. + * + * @param objects the collection of objects. + * @param property the property. + * @return a mapping. + */ + public static Map getUidPropertyMap( Collection objects, + IdentifiableProperty property ) + { + Map map = new HashMap<>(); + + for ( NameableObject object : objects ) + { + if ( IdentifiableProperty.UID.equals( property ) ) + { + map.put( object.getUid(), object.getUid() ); + } + else if ( IdentifiableProperty.CODE.equals( property ) ) + { + map.put( object.getUid(), object.getCode() ); + } + else if ( IdentifiableProperty.NAME.equals( property ) ) + { + map.put( object.getUid(), object.getName() ); + } + } + + return map; + } } === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java 2015-03-07 16:16:41 +0000 @@ -37,6 +37,7 @@ import org.hisp.dhis.common.DimensionalObject; import org.hisp.dhis.common.DisplayProperty; import org.hisp.dhis.common.Grid; +import org.hisp.dhis.common.IdentifiableProperty; import org.hisp.dhis.common.IllegalQueryException; import org.hisp.dhis.i18n.I18nFormat; @@ -158,11 +159,13 @@ * @param hideEmptyRows whether to hide rows without data values, applis to table layout. * @param showHierarchy whether to show the org unit hierarchy together with the name. * @param displayProperty the property to display for meta-data. + * @param idScheme the identifier scheme to use. * @param format the i18n format. * @return a data query parameter object created based on the given URL info. */ DataQueryParams getFromUrl( Set dimensionParams, Set filterParams, AggregationType aggregationType, String measureCriteria, - boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, I18nFormat format ); + boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, boolean showHierarchy, + DisplayProperty displayProperty, IdentifiableProperty idScheme, I18nFormat format ); /** * Creates a data query parameter object from the given BaseAnalyticalObject. === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2015-03-06 21:55:51 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2015-03-07 16:16:41 +0000 @@ -63,6 +63,7 @@ import org.hisp.dhis.common.DimensionalObject; import org.hisp.dhis.common.DimensionalObjectUtils; import org.hisp.dhis.common.DisplayProperty; +import org.hisp.dhis.common.IdentifiableProperty; import org.hisp.dhis.common.ListMap; import org.hisp.dhis.common.MapMap; import org.hisp.dhis.common.NameableObject; @@ -153,6 +154,11 @@ */ protected DisplayProperty displayProperty; + /** + * The property to use as identifier in the response. + */ + protected IdentifiableProperty idScheme; + // ------------------------------------------------------------------------- // Transient properties // ------------------------------------------------------------------------- @@ -210,6 +216,7 @@ params.hideEmptyRows = this.hideEmptyRows; params.showHierarchy = this.showHierarchy; params.displayProperty = this.displayProperty; + params.idScheme = this.idScheme; params.partitions = new Partitions( this.partitions ); params.dataType = this.dataType; @@ -498,7 +505,7 @@ } /** - * Indicates whether organisation units are present as dimensio or filter. + * Indicates whether organisation units are present as dimension or filter. */ public boolean hasOrganisationUnits() { @@ -909,7 +916,16 @@ return list; } - + + /** + * Indicates whether this params defines an identifier scheme different from + * UID. + */ + public boolean hasNonUidIdScheme() + { + return idScheme != null && !IdentifiableProperty.UID.equals( idScheme ); + } + /** * Indicates whether this params specifies data approval levels. */ @@ -935,6 +951,21 @@ return !( AggregationType.NONE.equals( aggregationType ) || DataType.TEXT.equals( dataType ) ); } + /** + * Returns all dimension items. + */ + public List getAllDimensionItems() + { + List items = new ArrayList(); + + for ( DimensionalObject dim : ListUtils.union( dimensions, filters ) ) + { + items.addAll( dim.getItems() ); + } + + return items; + } + // ------------------------------------------------------------------------- // Static methods // ------------------------------------------------------------------------- @@ -1167,6 +1198,16 @@ this.displayProperty = displayProperty; } + public IdentifiableProperty getIdScheme() + { + return idScheme; + } + + public void setIdScheme( IdentifiableProperty idScheme ) + { + this.idScheme = idScheme; + } + // ------------------------------------------------------------------------- // Get and set methods for transient properties // ------------------------------------------------------------------------- === 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 2015-03-04 18:36:19 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-03-07 16:16:41 +0000 @@ -101,6 +101,7 @@ import org.hisp.dhis.common.Grid; import org.hisp.dhis.common.GridHeader; import org.hisp.dhis.common.IdentifiableObjectUtils; +import org.hisp.dhis.common.IdentifiableProperty; import org.hisp.dhis.common.IllegalQueryException; import org.hisp.dhis.common.NameableObject; import org.hisp.dhis.common.NameableObjectUtils; @@ -257,6 +258,8 @@ // --------------------------------------------------------------------- addMetaData( params, grid ); + + applyIdScheme( params, grid ); return grid; } @@ -457,7 +460,7 @@ * data query parameters. * * @param params the data query parameters. - * @param grid the grid. + * @param grid the grid. */ private void addDynamicDimensionValues( DataQueryParams params, Grid grid ) { @@ -479,7 +482,7 @@ * parameters. * * @param params the data query parameters. - * @param grid the grid. + * @param grid the grid. */ private void addMetaData( DataQueryParams params, Grid grid ) { @@ -522,14 +525,38 @@ } } + /** + * Substitutes the meta data of the grid with the identifier scheme meta data + * property indicated in the query. + * + * @param params the data query parameters. + * @param grid the grid. + */ + private void applyIdScheme( DataQueryParams params, Grid grid ) + { + if ( params.hasNonUidIdScheme() ) + { + List items = params.getAllDimensionItems(); + + Map map = NameableObjectUtils.getUidPropertyMap( items, params.getIdScheme() ); + + grid.substituteMetaData( map ); + } + } + @Override public Grid getAggregatedDataValues( DataQueryParams params, boolean tableLayout, List columns, List rows ) { - Grid grid = getAggregatedDataValues( params ); + Grid grid = null; if ( !tableLayout ) { - return grid; + return getAggregatedDataValues( params ); + } + else + { + params.setIdScheme( null ); + grid = getAggregatedDataValues( params ); } ListUtils.removeEmptys( columns ); @@ -789,7 +816,7 @@ @Override public DataQueryParams getFromUrl( Set dimensionParams, Set filterParams, AggregationType aggregationType, String measureCriteria, boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, - boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, I18nFormat format ) + boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty idScheme, I18nFormat format ) { DataQueryParams params = new DataQueryParams(); @@ -817,6 +844,7 @@ params.setHideEmptyRows( hideEmptyRows ); params.setShowHierarchy( showHierarchy ); params.setDisplayProperty( displayProperty ); + params.setIdScheme( idScheme ); return params; } === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java 2015-02-19 09:18:17 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java 2015-03-07 16:16:41 +0000 @@ -41,6 +41,7 @@ import org.hisp.dhis.common.DimensionalObject; import org.hisp.dhis.common.DisplayProperty; import org.hisp.dhis.common.Grid; +import org.hisp.dhis.common.IdentifiableProperty; import org.hisp.dhis.i18n.I18nFormat; /** @@ -83,7 +84,7 @@ @Override public DataQueryParams getFromUrl( Set dimensionParams, Set filterParams, AggregationType aggregationType, String measureCriteria, boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, - boolean showHierarchy, DisplayProperty displayProperty, I18nFormat format ) + boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty idScheme, I18nFormat format ) { throw new NotImplementedException(""); } === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java' --- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java 2015-03-04 17:49:02 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java 2015-03-07 16:16:41 +0000 @@ -168,7 +168,7 @@ Set filterParams = new HashSet<>(); filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() + ";" + ouC.getUid() + ";" + ouD.getUid() + ";" + ouE.getUid() ); - DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null ); + DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null ); assertEquals( 4, params.getDataElements().size() ); assertEquals( 3, params.getPeriods().size() ); @@ -185,7 +185,7 @@ Set filterParams = new HashSet<>(); filterParams.add( "ou:" + ouA.getUid() ); - DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null ); + DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null ); assertEquals( 4, params.getDataElements().size() ); assertEquals( 1, params.getFilterOrganisationUnits().size() ); @@ -202,7 +202,7 @@ Set filterParams = new HashSet<>(); filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() + ";" + ouC.getUid() ); - DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null ); + DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null ); assertEquals( 3, params.getDataElements().size() ); assertEquals( 2, params.getPeriods().size() ); @@ -220,7 +220,7 @@ Set filterParams = new HashSet<>(); filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() ); - DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null ); + DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null ); assertEquals( 4, params.getDataElements().size() ); assertEquals( 12, params.getPeriods().size() ); @@ -235,7 +235,7 @@ dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() ); dimensionParams.add( "pe:2011;2012" ); - DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null ); + DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null ); assertEquals( 1, params.getOrganisationUnits().size() ); assertEquals( 2, params.getDataElements().size() ); @@ -250,7 +250,7 @@ dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() ); dimensionParams.add( "pe:2011;2012" ); - DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null ); + DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null ); assertEquals( 3, params.getOrganisationUnits().size() ); assertEquals( 2, params.getDataElements().size() ); @@ -265,7 +265,7 @@ dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() ); dimensionParams.add( "pe:2011;2012" ); - DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null ); + DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null ); assertEquals( 2, params.getOrganisationUnits().size() ); assertEquals( 2, params.getDataElements().size() ); @@ -279,7 +279,7 @@ dimensionParams.add( "dx" ); dimensionParams.add( "pe:2012,2012S1,2012S2" ); - analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null ); + analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null ); } @Test( expected = IllegalQueryException.class ) @@ -289,7 +289,7 @@ dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" ); dimensionParams.add( "pe" ); - analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null ); + analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null ); } @Test( expected = IllegalQueryException.class ) @@ -299,7 +299,7 @@ dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" ); dimensionParams.add( "ou" ); - analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null ); + analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null ); } @Test( expected = IllegalQueryException.class ) @@ -309,7 +309,7 @@ dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" ); dimensionParams.add( "yebo:2012,2012S1,2012S2" ); - analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null ); + analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null ); } @Test === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java 2015-03-07 16:16:41 +0000 @@ -649,7 +649,7 @@ } @Override - public Grid substituteMetaData( Map metaDataMap ) + public Grid substituteMetaData( Map metaDataMap ) { if ( metaDataMap == null || headers == null || headers.isEmpty() ) { @@ -681,7 +681,7 @@ } @Override - public Grid substituteMetaData( int columnIndex, Map metaDataMap ) + public Grid substituteMetaData( int columnIndex, Map metaDataMap ) { if ( metaDataMap == null ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java 2015-03-07 16:16:41 +0000 @@ -28,10 +28,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import static org.hisp.dhis.analytics.AnalyticsService.NAMES_META_KEY; import static org.hisp.dhis.common.DimensionalObjectUtils.getDimensionsFromParam; -import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletResponse; @@ -41,6 +39,7 @@ import org.hisp.dhis.analytics.DataQueryParams; import org.hisp.dhis.common.DisplayProperty; import org.hisp.dhis.common.Grid; +import org.hisp.dhis.common.IdentifiableProperty; import org.hisp.dhis.common.IllegalQueryException; import org.hisp.dhis.i18n.I18nManager; import org.hisp.dhis.system.grid.GridUtils; @@ -89,13 +88,14 @@ @RequestParam( required = false ) boolean hideEmptyRows, @RequestParam( required = false ) boolean showHierarchy, @RequestParam( required = false ) DisplayProperty displayProperty, + @RequestParam( required = false ) IdentifiableProperty idScheme, @RequestParam( required = false ) String columns, @RequestParam( required = false ) String rows, Model model, HttpServletResponse response ) throws Exception { DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, - skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() ); + skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, idScheme, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING ); Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) ); @@ -118,13 +118,14 @@ @RequestParam( required = false ) boolean hideEmptyRows, @RequestParam( required = false ) boolean showHierarchy, @RequestParam( required = false ) DisplayProperty displayProperty, + @RequestParam( required = false ) IdentifiableProperty idScheme, @RequestParam( required = false ) String columns, @RequestParam( required = false ) String rows, Model model, HttpServletResponse response ) throws Exception { DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, - skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() ); + skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, idScheme, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING ); Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) ); @@ -145,17 +146,18 @@ @RequestParam( required = false ) boolean hideEmptyRows, @RequestParam( required = false ) boolean showHierarchy, @RequestParam( required = false ) DisplayProperty displayProperty, + @RequestParam( required = false ) IdentifiableProperty idScheme, @RequestParam( required = false ) String columns, @RequestParam( required = false ) String rows, Model model, HttpServletResponse response ) throws Exception { DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, - skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() ); + skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, idScheme, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING ); Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) ); - GridUtils.toHtml( substituteMetaData( grid ), response.getWriter() ); + GridUtils.toHtml( grid, response.getWriter() ); } @RequestMapping( value = RESOURCE_PATH + ".html+css", method = RequestMethod.GET ) @@ -172,17 +174,18 @@ @RequestParam( required = false ) boolean hideEmptyRows, @RequestParam( required = false ) boolean showHierarchy, @RequestParam( required = false ) DisplayProperty displayProperty, + @RequestParam( required = false ) IdentifiableProperty idScheme, @RequestParam( required = false ) String columns, @RequestParam( required = false ) String rows, Model model, HttpServletResponse response ) throws Exception { DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, - skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() ); + skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, idScheme, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING ); Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) ); - GridUtils.toHtmlCss( substituteMetaData( grid ), response.getWriter() ); + GridUtils.toHtmlCss( grid, response.getWriter() ); } @RequestMapping( value = RESOURCE_PATH + ".csv", method = RequestMethod.GET ) @@ -199,17 +202,18 @@ @RequestParam( required = false ) boolean hideEmptyRows, @RequestParam( required = false ) boolean showHierarchy, @RequestParam( required = false ) DisplayProperty displayProperty, + @RequestParam( required = false ) IdentifiableProperty idScheme, @RequestParam( required = false ) String columns, @RequestParam( required = false ) String rows, Model model, HttpServletResponse response ) throws Exception { DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, - skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() ); + skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, idScheme, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.csv", true ); Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) ); - GridUtils.toCsv( tableLayout ? grid : substituteMetaData( grid ), response.getOutputStream() ); + GridUtils.toCsv( grid, response.getOutputStream() ); } @RequestMapping( value = RESOURCE_PATH + ".xls", method = RequestMethod.GET ) @@ -226,17 +230,18 @@ @RequestParam( required = false ) boolean hideEmptyRows, @RequestParam( required = false ) boolean showHierarchy, @RequestParam( required = false ) DisplayProperty displayProperty, + @RequestParam( required = false ) IdentifiableProperty idScheme, @RequestParam( required = false ) String columns, @RequestParam( required = false ) String rows, Model model, HttpServletResponse response ) throws Exception { DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, - skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() ); + skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, idScheme, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.xls", true ); Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) ); - GridUtils.toXls( substituteMetaData( grid ), response.getOutputStream() ); + GridUtils.toXls( grid, response.getOutputStream() ); } @RequestMapping( value = RESOURCE_PATH + ".jrxml", method = RequestMethod.GET ) @@ -253,33 +258,19 @@ @RequestParam( required = false ) boolean hideEmptyRows, @RequestParam( required = false ) boolean showHierarchy, @RequestParam( required = false ) DisplayProperty displayProperty, + @RequestParam( required = false ) IdentifiableProperty idScheme, @RequestParam( required = false ) String columns, @RequestParam( required = false ) String rows, Model model, HttpServletResponse response ) throws Exception { DataQueryParams params = analyticsService.getFromUrl( dimension, filter, null, null, - true, false, false, false, false, false, null, i18nManager.getI18nFormat() ); + true, false, false, false, false, false, null, null, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.jrxml", false ); Grid grid = analyticsService.getAggregatedDataValues( params ); - GridUtils.toJrxml( substituteMetaData( grid ), null, response.getWriter() ); - } - - // ------------------------------------------------------------------------- - // Supportive methods - // ------------------------------------------------------------------------- - - @SuppressWarnings( "unchecked" ) - private Grid substituteMetaData( Grid grid ) - { - if ( grid.getMetaData() != null && grid.getMetaData().containsKey( NAMES_META_KEY ) ) - { - grid.substituteMetaData( (Map) grid.getMetaData().get( NAMES_META_KEY ) ); - } - - return grid; + GridUtils.toJrxml( grid, null, response.getWriter() ); } // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java 2015-03-07 16:16:41 +0000 @@ -137,7 +137,7 @@ Set set = new HashSet<>(); set.add( ou ); - DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, false, false, false, false, false, false, displayProperty, null ); + DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, false, false, false, false, false, false, displayProperty, null, null ); DimensionalObject dim = params.getDimension( DimensionalObject.ORGUNIT_DIM_ID );