dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36888
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18867: Analytics, minor
------------------------------------------------------------
revno: 18867
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-04-09 22:49:51 +0200
message:
Analytics, minor
modified:
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/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/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2015-04-09 19:55:52 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2015-04-09 20:49:51 +0000
@@ -940,7 +940,7 @@
int cocInx = params.getCategoryOptionComboDimensionIndex();
String de = keys.get( deInx );
- String coc = keys.get( cocInx );
+ String coc = cocInx != -1 ? keys.get( cocInx ) : null;
DataElementOperand operand = new DataElementOperand( de, coc );
=== 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-04-09 20:22:28 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-04-09 20:49:51 +0000
@@ -40,7 +40,6 @@
import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_PERIOD;
import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_PROGRAM_INDICATOR;
import static org.hisp.dhis.analytics.DataQueryParams.KEY_DE_GROUP;
-import static org.hisp.dhis.analytics.DataQueryParams.getPermutationOperandValueMap;
import static org.hisp.dhis.common.DimensionalObject.CATEGORYOPTIONCOMBO_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.DATAELEMENT_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.DATASET_DIM_ID;
@@ -299,11 +298,7 @@
List<List<DimensionItem>> dimensionItemPermutations = params.getDimensionItemPermutations();
- DataQueryParams dataSourceParams = getQueryIndicatorsReplacedByDataElements( params, indicatorIndex );
-
- Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( dataSourceParams );
-
- Map<String, Map<DataElementOperand, Double>> permutationOperandValueMap = getPermutationOperandValueMap( aggregatedDataMap, dataSourceParams );
+ Map<String, Map<DataElementOperand, Double>> permutationOperandValueMap = getPermutationOperandValueMap( params, indicatorIndex );
Map<String, Double> constantMap = constantService.getConstantMap();
@@ -1222,6 +1217,23 @@
// -------------------------------------------------------------------------
/**
+ * Returns a mapping of permutation keys and mappings of data element operands
+ * and values, based on the given mapping of dimension option keys and
+ * aggregated values.
+ *
+ * @param params the data query parameters.
+ * @param indicatorIndex the indicator dimension index for the given parameters.
+ */
+ private Map<String, Map<DataElementOperand, Double>> getPermutationOperandValueMap( DataQueryParams params, int indicatorIndex )
+ {
+ DataQueryParams dataSourceParams = getQueryIndicatorsReplacedByDataElements( params, indicatorIndex );
+
+ Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( dataSourceParams );
+
+ return DataQueryParams.getPermutationOperandValueMap( aggregatedDataMap, dataSourceParams );
+ }
+
+ /**
* Returns a new instance of the given query where indicators are replaced
* with the data elements part of the indicator expressions.
*