dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21707
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10353: Analytics, including category option combos in meta-data part of response
------------------------------------------------------------
revno: 10353
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-03-20 14:27:21 +0100
message:
Analytics, including category option combos in meta-data part of response
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.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-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-03-20 13:04:15 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-03-20 13:27:21 +0000
@@ -116,7 +116,6 @@
private static final Log log = LogFactory.getLog( DefaultAnalyticsService.class );
private static final String VALUE_HEADER_NAME = "Value";
- private static final String PERIODS_META_KEY = "periods";
private static final String NAMES_META_KEY = "names";
private static final int PERCENT = 100;
private static final int MAX_QUERIES = 8;
@@ -332,8 +331,18 @@
Map<Object, Object> metaData = new HashMap<Object, Object>();
- metaData.put( NAMES_META_KEY, getUidNameMap( params, grid, cocIndex ) );
- metaData.put( PERIODS_META_KEY, getUids( params.getDimensionOrFilter( PERIOD_DIM_ID ) ) );
+ Map<String, String> uidNameMap = getUidNameMap( params );
+ Map<String, String> cocNameMap = getCocNameMap( grid, cocIndex );
+
+ uidNameMap.putAll( cocNameMap );
+
+ metaData.put( NAMES_META_KEY, uidNameMap );
+ metaData.put( PERIOD_DIM_ID, getUids( params.getDimensionOrFilter( PERIOD_DIM_ID ) ) );
+
+ if ( cocIndex != null )
+ {
+ metaData.put( CATEGORYOPTIONCOMBO_DIM_ID, cocNameMap.keySet() );
+ }
grid.setMetaData( metaData );
@@ -633,13 +642,12 @@
return params;
}
- private Map<String, String> getUidNameMap( DataQueryParams params, Grid grid, Integer cocIndex )
+ private Map<String, String> getUidNameMap( DataQueryParams params )
{
Map<String, String> map = new HashMap<String, String>();
map.putAll( getUidNameMap( params.getDimensions() ) );
map.putAll( getUidNameMap( params.getFilters() ) );
map.put( DATA_X_DIM_ID, DISPLAY_NAME_DATA_X );
- map.putAll( getCocMetaData( grid, cocIndex ) );
return map;
}
@@ -686,7 +694,7 @@
return map;
}
- private Map<String, String> getCocMetaData( Grid grid, Integer cocIndex )
+ private Map<String, String> getCocNameMap( Grid grid, Integer cocIndex )
{
Map<String, String> metaData = new HashMap<String, String>();