dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41932
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21399: Analytics. Generalized method from operands to dimensional item object.
------------------------------------------------------------
revno: 21399
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-12-10 10:51:53 +0100
message:
Analytics. Generalized method from operands to dimensional item object.
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsUtils.java
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
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/AnalyticsUtilsTest.java
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java
dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.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/AnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java 2015-12-10 07:40:24 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java 2015-12-10 09:51:53 +0000
@@ -62,5 +62,6 @@
* @param dataPeriodAggregationPeriodMap the mapping between data periods and
* aggregation periods for this query.
*/
- void replaceDataPeriodsWithAggregationPeriods( Map<String, Object> dataValueMap, DataQueryParams params, ListMap<DimensionalItemObject, DimensionalItemObject> dataPeriodAggregationPeriodMap );
+ void replaceDataPeriodsWithAggregationPeriods( Map<String, Object> dataValueMap,
+ DataQueryParams params, ListMap<DimensionalItemObject, DimensionalItemObject> dataPeriodAggregationPeriodMap );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsUtils.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsUtils.java 2015-11-20 15:20:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsUtils.java 2015-12-10 09:51:53 +0000
@@ -33,10 +33,14 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.common.DataDimensionItemType;
import org.hisp.dhis.common.DimensionalItemObject;
+import org.hisp.dhis.common.DimensionalObject;
+import org.hisp.dhis.common.DimensionalObjectUtils;
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.common.IllegalQueryException;
import org.hisp.dhis.common.NameableObjectUtils;
@@ -152,5 +156,18 @@
{
return MathUtils.getRounded( value );
}
- }
+ }
+
+ /**
+ * Converts the data and option combo identifiers to an operand identifier,
+ * i.e. "deuid-cocuid" to "deuid.cocuid".
+ *
+ * @param valueMap the value map to convert.
+ * @return a value map.
+ */
+ public static <T> Map<String, T> convertDxToOperand( Map<String, T> valueMap )
+ {
+ return valueMap.entrySet().stream().collect( Collectors.toMap( e -> e.getKey().replaceFirst(
+ DimensionalObject.DIMENSION_SEP, DimensionalObjectUtils.COMPOSITE_DIM_OBJECT_PLAIN_SEP ), e -> e.getValue() ) );
+ }
}
=== 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-12-09 17:59:01 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2015-12-10 09:51:53 +0000
@@ -54,6 +54,7 @@
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.common.BaseDimensionalItemObject;
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.CombinationGenerator;
import org.hisp.dhis.common.DataDimensionItemType;
@@ -73,7 +74,6 @@
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementGroupSet;
-import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -494,14 +494,6 @@
}
/**
- * Returns the index of the category option combo dimension in the dimension map.
- */
- public int getCategoryOptionComboDimensionIndex()
- {
- return getDimensionIdentifiersAsList().indexOf( CATEGORYOPTIONCOMBO_DIM_ID );
- }
-
- /**
* Returns the index of the period dimension in the dimension map.
*/
public int getPeriodDimensionIndex()
@@ -1022,25 +1014,24 @@
* @param cocEnabled indicates whether the given aggregated data map includes
* a category option combination dimension.
*/
- public static void putPermutationOperandValueMap( MapMap<String, DimensionalItemObject, Double> permutationMap,
+ public static void putPermutationDimensionalItemValueMap( MapMap<String, DimensionalItemObject, Double> permutationMap,
Map<String, Double> aggregatedDataMap, boolean cocEnabled )
{
for ( String key : aggregatedDataMap.keySet() )
{
List<String> keys = Lists.newArrayList( key.split( DIMENSION_SEP ) );
- String de = keys.get( DX_INDEX );
- String coc = cocEnabled ? keys.get( CO_INDEX ) : null;
-
- DataElementOperand operand = new DataElementOperand( de, coc );
+ String dimItem = keys.get( DX_INDEX );
+
+ keys.remove( DX_INDEX );
- ListUtils.removeAll( keys, DX_INDEX, ( cocEnabled ? CO_INDEX : -1 ) );
+ BaseDimensionalItemObject dimItemObject = new BaseDimensionalItemObject( dimItem );
String permKey = StringUtils.join( keys, DIMENSION_SEP );
Double value = aggregatedDataMap.get( key );
- permutationMap.putEntry( permKey, operand, value );
+ permutationMap.putEntry( permKey, dimItemObject, value );
}
}
@@ -1748,12 +1739,7 @@
{
setDimensionOptions( CATEGORYOPTIONCOMBO_DIM_ID, DimensionType.CATEGORY_OPTION_COMBO, null, asList( categoryOptionCombos ) );
}
-
- public boolean isCategoryOptionCombosEnabled()
- {
- return !getDimensionOrFilterItems( CATEGORYOPTIONCOMBO_DIM_ID ).isEmpty();
- }
-
+
// -------------------------------------------------------------------------
// Get and set helpers for filters
// -------------------------------------------------------------------------
=== 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-12-09 17:59:01 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-12-10 09:51:53 +0000
@@ -33,7 +33,6 @@
import static org.hisp.dhis.analytics.AnalyticsTableManager.COMPLETENESS_TARGET_TABLE_NAME;
import static org.hisp.dhis.analytics.AnalyticsTableManager.ORGUNIT_TARGET_TABLE_NAME;
import static org.hisp.dhis.analytics.DataQueryParams.COMPLETENESS_DIMENSION_TYPES;
-import static org.hisp.dhis.analytics.DataQueryParams.CO_INDEX;
import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_DATA_X;
import static org.hisp.dhis.analytics.DataQueryParams.DX_INDEX;
import static org.hisp.dhis.common.DimensionalObject.CATEGORYOPTIONCOMBO_DIM_ID;
@@ -262,7 +261,7 @@
List<List<DimensionItem>> dimensionItemPermutations = dataSourceParams.getDimensionItemPermutations();
- Map<String, Map<DimensionalItemObject, Double>> permutationOperandValueMap = getPermutationOperandValueMap( dataSourceParams );
+ Map<String, Map<DimensionalItemObject, Double>> permutationDimensionalItemValueMap = getPermutationDimensionalItemValueMap( dataSourceParams );
for ( Indicator indicator : indicators )
{
@@ -270,7 +269,7 @@
{
String permKey = DimensionItem.asItemKey( dimensionItems );
- Map<? extends DimensionalItemObject, Double> valueMap = permutationOperandValueMap.get( permKey );
+ Map<DimensionalItemObject, Double> valueMap = permutationDimensionalItemValueMap.get( permKey );
if ( valueMap == null )
{
@@ -356,20 +355,13 @@
dataSourceParams.addDimension( new BaseDimensionalObject( CATEGORYOPTIONCOMBO_DIM_ID, DimensionType.CATEGORY_OPTION_COMBO, categoryOptionCombos ) );
Map<String, Object> aggregatedDataMap = getAggregatedDataValueMapObjectTyped( dataSourceParams );
+
+ aggregatedDataMap = AnalyticsUtils.convertDxToOperand( aggregatedDataMap );
for ( Map.Entry<String, Object> entry : aggregatedDataMap.entrySet() )
{
- // -------------------------------------------------------------
- // Merge data element and option combo into operand column
- // -------------------------------------------------------------
-
- List<String> values = Lists.newArrayList( entry.getKey().split( DIMENSION_SEP ) );
- String operand = values.get( DX_INDEX ) + DataElementOperand.SEPARATOR + values.get( CO_INDEX );
- values.remove( CO_INDEX );
- values.set( DX_INDEX, operand );
-
grid.addRow();
- grid.addValues( values.toArray() );
+ grid.addValues( entry.getKey().split( DIMENSION_SEP ) );
grid.addValue( dataSourceParams.isSkipRounding() ? entry.getValue() : getRounded( entry.getValue() ) );
}
}
@@ -867,15 +859,15 @@
*
* @param params the data query parameters.
*/
- private Map<String, Map<DimensionalItemObject, Double>> getPermutationOperandValueMap( DataQueryParams params )
+ private Map<String, Map<DimensionalItemObject, Double>> getPermutationDimensionalItemValueMap( DataQueryParams params )
{
Map<String, Double> aggregatedDataTotalsMap = getAggregatedDataValueMapTotals( params );
Map<String, Double> aggregatedDataOptionCombosMap = getAggregatedDataValueMapOptionCombos( params );
-
+
MapMap<String, DimensionalItemObject, Double> permOperandValueMap = new MapMap<>();
- DataQueryParams.putPermutationOperandValueMap( permOperandValueMap, aggregatedDataTotalsMap, false );
- DataQueryParams.putPermutationOperandValueMap( permOperandValueMap, aggregatedDataOptionCombosMap, true );
+ DataQueryParams.putPermutationDimensionalItemValueMap( permOperandValueMap, aggregatedDataTotalsMap, false );
+ DataQueryParams.putPermutationDimensionalItemValueMap( permOperandValueMap, aggregatedDataOptionCombosMap, true );
return permOperandValueMap;
}
@@ -926,8 +918,10 @@
DATA_X_DIM_ID, DimensionType.DATA_X, dataElements ) );
dataSourceParams.getDimensions().add( DataQueryParams.CO_INDEX, new BaseDimensionalObject(
CATEGORYOPTIONCOMBO_DIM_ID, DimensionType.CATEGORY_OPTION_COMBO, new ArrayList<>() ) );
-
- return getAggregatedDataValueMap( dataSourceParams );
+
+ Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( dataSourceParams );
+
+ return AnalyticsUtils.convertDxToOperand( aggregatedDataMap );
}
return new HashMap<>();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/AnalyticsUtilsTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/AnalyticsUtilsTest.java 2015-12-10 09:19:07 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/AnalyticsUtilsTest.java 2015-12-10 09:51:53 +0000
@@ -41,7 +41,9 @@
import static org.junit.Assert.*;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import static org.hisp.dhis.DhisConvenienceTest.*;
@@ -68,4 +70,19 @@
assertEquals( Lists.newArrayList( piA ), AnalyticsUtils.getByDataDimensionType( DataDimensionItemType.PROGRAM_INDICATOR, list ) );
assertEquals( Lists.newArrayList(), AnalyticsUtils.getByDataDimensionType( DataDimensionItemType.PROGRAM_ATTRIBUTE, list ) );
}
+
+ @Test
+ public void testConvertDxToOperand()
+ {
+ Map<String, Double> map = new HashMap<>();
+ map.put( "GauDLAiXPKT-kC1OT9Q1n1j-R9U8q7X1aJG", 10d );
+ map.put( "YkRvCLedQa4-h1dJ9W4dWor-Zrd4DAf8M99", 11d );
+ map.put( "PcfRp1HETO8-zqXKIEycBck-KBJBZopYMPV", 12d );
+
+ Map<String, Double> convertedMap = AnalyticsUtils.convertDxToOperand( map );
+
+ assertTrue( convertedMap.containsKey( "GauDLAiXPKT.kC1OT9Q1n1j-R9U8q7X1aJG" ) );
+ assertTrue( convertedMap.containsKey( "YkRvCLedQa4.h1dJ9W4dWor-Zrd4DAf8M99" ) );
+ assertTrue( convertedMap.containsKey( "PcfRp1HETO8.zqXKIEycBck-KBJBZopYMPV" ) );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java 2015-12-09 17:59:01 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java 2015-12-10 09:51:53 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.analytics.DataQueryParams;
import org.hisp.dhis.analytics.DimensionItem;
import org.hisp.dhis.analytics.QueryPlanner;
+import org.hisp.dhis.common.BaseDimensionalItemObject;
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.DimensionType;
import org.hisp.dhis.common.DimensionalItemObject;
@@ -46,7 +47,6 @@
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
@@ -63,6 +63,7 @@
import org.hisp.dhis.program.ProgramDataElement;
import org.joda.time.DateTime;
import org.junit.Test;
+
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
@@ -75,6 +76,7 @@
import static org.hisp.dhis.common.DimensionalObject.*;
import static org.hisp.dhis.common.DimensionalObjectUtils.getList;
import static org.junit.Assert.*;
+import static org.hisp.dhis.common.DimensionalObjectUtils.COMPOSITE_DIM_OBJECT_PLAIN_SEP;
/**
* @author Lars Helge Overland
@@ -240,21 +242,21 @@
}
@Test
- public void testGetPermutationOperandValueMapCocEnabled()
+ public void testGetPermutationDimensionalItemValueMapCocEnabled()
{
Map<String, Double> aggregatedDataMap = new HashMap<>();
- aggregatedDataMap.put( deA.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q1", 1d );
- aggregatedDataMap.put( deA.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q2", 2d );
- aggregatedDataMap.put( deA.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q1", 3d );
- aggregatedDataMap.put( deA.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q2", 4d );
- aggregatedDataMap.put( deB.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q1", 5d );
- aggregatedDataMap.put( deB.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q2", 6d );
- aggregatedDataMap.put( deB.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q1", 7d );
- aggregatedDataMap.put( deB.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q2", 8d );
+ aggregatedDataMap.put( deA.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q1", 1d );
+ aggregatedDataMap.put( deA.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q2", 2d );
+ aggregatedDataMap.put( deA.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q1", 3d );
+ aggregatedDataMap.put( deA.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q2", 4d );
+ aggregatedDataMap.put( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q1", 5d );
+ aggregatedDataMap.put( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q2", 6d );
+ aggregatedDataMap.put( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q1", 7d );
+ aggregatedDataMap.put( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q2", 8d );
MapMap<String, DimensionalItemObject, Double> permutationMap = new MapMap<>();
- DataQueryParams.putPermutationOperandValueMap( permutationMap, aggregatedDataMap, true );
+ DataQueryParams.putPermutationDimensionalItemValueMap( permutationMap, aggregatedDataMap, true );
assertNotNull( permutationMap );
@@ -273,22 +275,22 @@
assertEquals( 2, ouBQ1.size() );
assertEquals( 2, ouBQ2.size() );
- DataElementOperand deACoc = new DataElementOperand( deA.getUid(), coc.getUid() );
- DataElementOperand deBCoc = new DataElementOperand( deB.getUid(), coc.getUid() );
+ BaseDimensionalItemObject deACoc = new BaseDimensionalItemObject( deA.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() );
+ BaseDimensionalItemObject deBCoc = new BaseDimensionalItemObject( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() );
- Map<DataElementOperand, Double> ouAQ1Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouAQ1Expected = new HashMap<>();
ouAQ1Expected.put( deACoc, 1d );
ouAQ1Expected.put( deBCoc, 5d );
- Map<DataElementOperand, Double> ouAQ2Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouAQ2Expected = new HashMap<>();
ouAQ2Expected.put( deACoc, 2d );
ouAQ2Expected.put( deBCoc, 6d );
- Map<DataElementOperand, Double> ouBQ1Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouBQ1Expected = new HashMap<>();
ouBQ1Expected.put( deACoc, 3d );
ouBQ1Expected.put( deBCoc, 7d );
- Map<DataElementOperand, Double> ouBQ2Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouBQ2Expected = new HashMap<>();
ouBQ2Expected.put( deACoc, 4d );
ouBQ2Expected.put( deBCoc, 8d );
@@ -299,7 +301,7 @@
}
@Test
- public void testGetPermutationOperandValueMapCocDisabled()
+ public void testGetPermutationDimensionalItemValueMapCocDisabled()
{
Map<String, Double> aggregatedDataMap = new HashMap<>();
aggregatedDataMap.put( deA.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "200101", 1d );
@@ -313,7 +315,7 @@
MapMap<String, DimensionalItemObject, Double> permutationMap = new MapMap<>();
- DataQueryParams.putPermutationOperandValueMap( permutationMap, aggregatedDataMap, false );
+ DataQueryParams.putPermutationDimensionalItemValueMap( permutationMap, aggregatedDataMap, false );
assertNotNull( permutationMap );
@@ -332,22 +334,22 @@
assertEquals( 2, ouBM1.size() );
assertEquals( 2, ouBM2.size() );
- DataElementOperand deACoc = new DataElementOperand( deA.getUid(), null );
- DataElementOperand deBCoc = new DataElementOperand( deB.getUid(), null );
+ BaseDimensionalItemObject deACoc = new BaseDimensionalItemObject( deA.getUid() );
+ BaseDimensionalItemObject deBCoc = new BaseDimensionalItemObject( deB.getUid() );
- Map<DataElementOperand, Double> ouAM1Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouAM1Expected = new HashMap<>();
ouAM1Expected.put( deACoc, 1d );
ouAM1Expected.put( deBCoc, 5d );
- Map<DataElementOperand, Double> ouAM2Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouAM2Expected = new HashMap<>();
ouAM2Expected.put( deACoc, 2d );
ouAM2Expected.put( deBCoc, 6d );
- Map<DataElementOperand, Double> ouBM1Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouBM1Expected = new HashMap<>();
ouBM1Expected.put( deACoc, 3d );
ouBM1Expected.put( deBCoc, 7d );
- Map<DataElementOperand, Double> ouBM2Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouBM2Expected = new HashMap<>();
ouBM2Expected.put( deACoc, 4d );
ouBM2Expected.put( deBCoc, 8d );
@@ -358,7 +360,7 @@
}
@Test
- public void testGetPermutationOperandValueMap()
+ public void testGetPermutationDimensionalItemValueMap()
{
Map<String, Double> aggregatedTotalsDataMap = new HashMap<>();
aggregatedTotalsDataMap.put( deA.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q1", 1d );
@@ -367,15 +369,15 @@
aggregatedTotalsDataMap.put( deA.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q2", 4d );
Map<String, Double> aggregatedCocDataMap = new HashMap<>();
- aggregatedCocDataMap.put( deB.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q1", 5d );
- aggregatedCocDataMap.put( deB.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q2", 6d );
- aggregatedCocDataMap.put( deB.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q1", 7d );
- aggregatedCocDataMap.put( deB.getUid() + DIMENSION_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q2", 8d );
+ aggregatedCocDataMap.put( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q1", 5d );
+ aggregatedCocDataMap.put( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouA.getUid() + DIMENSION_SEP + "2000Q2", 6d );
+ aggregatedCocDataMap.put( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q1", 7d );
+ aggregatedCocDataMap.put( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() + DIMENSION_SEP + ouB.getUid() + DIMENSION_SEP + "2000Q2", 8d );
MapMap<String, DimensionalItemObject, Double> permutationMap = new MapMap<>();
- DataQueryParams.putPermutationOperandValueMap( permutationMap, aggregatedTotalsDataMap, false );
- DataQueryParams.putPermutationOperandValueMap( permutationMap, aggregatedCocDataMap, true );
+ DataQueryParams.putPermutationDimensionalItemValueMap( permutationMap, aggregatedTotalsDataMap, false );
+ DataQueryParams.putPermutationDimensionalItemValueMap( permutationMap, aggregatedCocDataMap, true );
assertNotNull( permutationMap );
@@ -394,22 +396,22 @@
assertEquals( 2, ouBQ1.size() );
assertEquals( 2, ouBQ2.size() );
- DataElementOperand deACoc = new DataElementOperand( deA.getUid(), null );
- DataElementOperand deBCoc = new DataElementOperand( deB.getUid(), coc.getUid() );
+ BaseDimensionalItemObject deACoc = new BaseDimensionalItemObject( deA.getUid() );
+ BaseDimensionalItemObject deBCoc = new BaseDimensionalItemObject( deB.getUid() + COMPOSITE_DIM_OBJECT_PLAIN_SEP + coc.getUid() );
- Map<DataElementOperand, Double> ouAQ1Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouAQ1Expected = new HashMap<>();
ouAQ1Expected.put( deACoc, 1d );
ouAQ1Expected.put( deBCoc, 5d );
- Map<DataElementOperand, Double> ouAQ2Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouAQ2Expected = new HashMap<>();
ouAQ2Expected.put( deACoc, 2d );
ouAQ2Expected.put( deBCoc, 6d );
- Map<DataElementOperand, Double> ouBQ1Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouBQ1Expected = new HashMap<>();
ouBQ1Expected.put( deACoc, 3d );
ouBQ1Expected.put( deBCoc, 7d );
- Map<DataElementOperand, Double> ouBQ2Expected = new HashMap<>();
+ Map<DimensionalItemObject, Double> ouBQ2Expected = new HashMap<>();
ouBQ2Expected.put( deACoc, 4d );
ouBQ2Expected.put( deBCoc, 8d );
=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2015-11-19 22:18:35 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2015-12-10 09:51:53 +0000
@@ -127,7 +127,6 @@
/**
* @author Lars Helge Overland
- * @version $Id$
*/
public abstract class DhisConvenienceTest
{