← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2503: Simplification in datamart

 

------------------------------------------------------------
revno: 2503
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-01-10 11:06:18 +0100
message:
  Simplification in datamart
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntSingleValueAggregator.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/DataElementAggregator.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/DefaultCalculatedDataElementDataMart.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/JDBCCrossTabStore.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/indicator/DefaultIndicatorDataMart.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabStoreTest.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm


--
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-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java	2010-06-26 19:48:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java	2011-01-10 10:06:18 +0000
@@ -34,6 +34,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -75,15 +76,15 @@
     // DataElementAggregator implementation
     // -------------------------------------------------------------------------
 
-    public Map<DataElementOperand, Double> getAggregatedValues( final Map<DataElementOperand, Integer> operandIndexMap, 
+    public Map<DataElementOperand, Double> getAggregatedValues( final Collection<DataElementOperand> operands, 
         final Period period, final OrganisationUnit unit, int unitLevel, final OrganisationUnitHierarchy hierarchy, String key )
     {
-        if ( operandIndexMap == null || operandIndexMap.size() == 0 )
+        if ( operands == null || operands.size() == 0 )
         {
             return new HashMap<DataElementOperand, Double>();
         }
         
-        final Collection<CrossTabDataValue> crossTabValues = crossTabService.getCrossTabDataValues( operandIndexMap, 
+        final Collection<CrossTabDataValue> crossTabValues = crossTabService.getCrossTabDataValues( operands, 
             aggregationCache.getIntersectingPeriods( period.getStartDate(), period.getEndDate() ), hierarchy.getChildren( unit.getId() ), key );
         
         final Map<DataElementOperand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(), 
@@ -181,18 +182,18 @@
         return totalSums;
     }
 
-    public Map<DataElementOperand, Integer> getOperandIndexMap( Collection<DataElementOperand> operands, PeriodType periodType, Map<DataElementOperand, Integer> operandIndexMap )
+    public Collection<DataElementOperand> filterOperands( Collection<DataElementOperand> operands, PeriodType periodType )
     {
-        Map<DataElementOperand, Integer> avgOperandIndexMap = new HashMap<DataElementOperand, Integer>();
+        Collection<DataElementOperand> filteredOperands = new HashSet<DataElementOperand>();
         
         for ( final DataElementOperand operand : operands )
         {
             if ( operand.getValueType().equals( VALUE_TYPE_BOOL ) && operand.getAggregationOperator().equals( AGGREGATION_OPERATOR_AVERAGE ) )
             {
-                avgOperandIndexMap.put( operand, operandIndexMap.get( operand ) );
+                filteredOperands.add( operand );
             }
         }
         
-        return avgOperandIndexMap;
+        return filteredOperands;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java	2010-12-02 21:52:11 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java	2011-01-10 10:06:18 +0000
@@ -34,6 +34,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -79,10 +80,10 @@
     // DataElementAggregator implementation
     // -------------------------------------------------------------------------
 
-    public Map<DataElementOperand, Double> getAggregatedValues( final Map<DataElementOperand, Integer> operandIndexMap, 
+    public Map<DataElementOperand, Double> getAggregatedValues( final Collection<DataElementOperand> operands, 
         final Period period, final OrganisationUnit unit, int unitLevel, OrganisationUnitHierarchy hierarchy, String key )
     {
-        if ( operandIndexMap == null || operandIndexMap.size() == 0 )
+        if ( operands == null || operands.size() == 0 )
         {
             return new HashMap<DataElementOperand, Double>();
         }
@@ -97,7 +98,7 @@
         for ( final Integer unitId : unitIds )
         {
             final Collection<CrossTabDataValue> crossTabValues = 
-                crossTabService.getCrossTabDataValues( operandIndexMap, aggregationCache.getIntersectingPeriods( period.getStartDate(), period.getEndDate() ), unitId, key );
+                crossTabService.getCrossTabDataValues( operands, aggregationCache.getIntersectingPeriods( period.getStartDate(), period.getEndDate() ), unitId, key );
             
             final Map<DataElementOperand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(), 
                 period.getEndDate(), period.getStartDate(), period.getEndDate(), unitLevel ); // <Operand, [total value, total relevant days]>
@@ -203,19 +204,19 @@
         return totalSums;
     }
 
-    public Map<DataElementOperand, Integer> getOperandIndexMap( Collection<DataElementOperand> operands, PeriodType periodType, Map<DataElementOperand, Integer> operandIndexMap )
+    public Collection<DataElementOperand> filterOperands( Collection<DataElementOperand> operands, PeriodType periodType )
     {
-        Map<DataElementOperand, Integer> avgOperandIndexMap = new HashMap<DataElementOperand, Integer>();
+        Collection<DataElementOperand> filteredOperands = new HashSet<DataElementOperand>();
         
         for ( final DataElementOperand operand : operands )
         {
             if ( operand.getValueType().equals( VALUE_TYPE_INT ) && operand.getAggregationOperator().equals( AGGREGATION_OPERATOR_AVERAGE ) &&
                 operand.getFrequencyOrder() < periodType.getFrequencyOrder() )
             {
-                avgOperandIndexMap.put( operand, operandIndexMap.get( operand ) );
+                filteredOperands.add( operand );
             }
         }
         
-        return avgOperandIndexMap;
+        return filteredOperands;
     }    
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntSingleValueAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntSingleValueAggregator.java	2010-12-02 21:52:11 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntSingleValueAggregator.java	2011-01-10 10:06:18 +0000
@@ -34,6 +34,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -79,15 +80,15 @@
     // DataElementAggregator implementation
     // -------------------------------------------------------------------------
 
-    public Map<DataElementOperand, Double> getAggregatedValues( final Map<DataElementOperand, Integer> operandIndexMap, 
+    public Map<DataElementOperand, Double> getAggregatedValues( final Collection<DataElementOperand> operands, 
         final Period period, final OrganisationUnit unit, int unitLevel, OrganisationUnitHierarchy hierarchy, String key )
     {
-        if ( operandIndexMap == null || operandIndexMap.size() == 0 )
+        if ( operands == null || operands.size() == 0 )
         {
             return new HashMap<DataElementOperand, Double>();
         }
         
-        final Collection<CrossTabDataValue> crossTabValues = crossTabService.getCrossTabDataValues( operandIndexMap, 
+        final Collection<CrossTabDataValue> crossTabValues = crossTabService.getCrossTabDataValues( operands, 
             aggregationCache.getIntersectingPeriods( period.getStartDate(), period.getEndDate() ), hierarchy.getChildren( unit.getId() ), key );
         
         final Map<DataElementOperand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(), 
@@ -175,19 +176,19 @@
         return totalSums;
     }
 
-    public Map<DataElementOperand, Integer> getOperandIndexMap( Collection<DataElementOperand> operands, PeriodType periodType, Map<DataElementOperand, Integer> operandIndexMap )
+    public Collection<DataElementOperand> filterOperands( Collection<DataElementOperand> operands, PeriodType periodType )
     {
-        Map<DataElementOperand, Integer> avgOperandIndexMap = new HashMap<DataElementOperand, Integer>();
+        Collection<DataElementOperand> filteredOperands = new HashSet<DataElementOperand>();
         
         for ( final DataElementOperand operand : operands )
         {
             if ( operand.getValueType().equals( VALUE_TYPE_INT ) && operand.getAggregationOperator().equals( AGGREGATION_OPERATOR_AVERAGE ) &&
                 operand.getFrequencyOrder() >= periodType.getFrequencyOrder() )
             {
-                avgOperandIndexMap.put( operand, operandIndexMap.get( operand ) );
+                filteredOperands.add( operand );
             }
         }
         
-        return avgOperandIndexMap;
+        return filteredOperands;
     }    
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/DataElementAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/DataElementAggregator.java	2010-06-26 19:48:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/DataElementAggregator.java	2011-01-10 10:06:18 +0000
@@ -46,11 +46,11 @@
 {
     final String TRUE = "true";
 
-    Map<DataElementOperand, Double> getAggregatedValues( final Map<DataElementOperand, Integer> operandIndexMap, 
+    Map<DataElementOperand, Double> getAggregatedValues( final Collection<DataElementOperand> operands, 
         final Period period, final OrganisationUnit unit, int unitLevel, final OrganisationUnitHierarchy hierarchy, String key );
     
     Map<DataElementOperand, double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues, 
         final Date startDate, final Date endDate, final Date aggregationStartDate, final Date aggregationEndDate, int unitLevel );
     
-    Map<DataElementOperand, Integer> getOperandIndexMap( Collection<DataElementOperand> operands, PeriodType periodType, Map<DataElementOperand, Integer> operandIndexMap );
+    Collection<DataElementOperand> filterOperands( Collection<DataElementOperand> operands, PeriodType periodType );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java	2011-01-08 16:49:17 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java	2011-01-10 10:06:18 +0000
@@ -35,6 +35,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -76,15 +77,15 @@
     // DataElementAggregator implementation
     // -------------------------------------------------------------------------
 
-    public Map<DataElementOperand, Double> getAggregatedValues( final Map<DataElementOperand, Integer> operandIndexMap, 
+    public Map<DataElementOperand, Double> getAggregatedValues( final Collection<DataElementOperand> operands, 
         final Period period, final OrganisationUnit unit, int unitLevel, OrganisationUnitHierarchy hierarchy, String key )
     {
-        if ( operandIndexMap == null || operandIndexMap.size() == 0 )
+        if ( operands == null || operands.size() == 0 )
         {
             return new HashMap<DataElementOperand, Double>();
         }
         
-        final Collection<CrossTabDataValue> crossTabValues = crossTabService.getCrossTabDataValues( operandIndexMap, 
+        final Collection<CrossTabDataValue> crossTabValues = crossTabService.getCrossTabDataValues( operands, 
             aggregationCache.getIntersectingPeriods( period.getStartDate(), period.getEndDate() ), hierarchy.getChildren( unit.getId() ), key );
         
         final Map<DataElementOperand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(), 
@@ -186,19 +187,19 @@
         return totalSums;
     }
 
-    public Map<DataElementOperand, Integer> getOperandIndexMap( Collection<DataElementOperand> operands, PeriodType periodType, Map<DataElementOperand, Integer> operandIndexMap )
+    public Collection<DataElementOperand> filterOperands( Collection<DataElementOperand> operands, PeriodType periodType )
     {
-        Map<DataElementOperand, Integer> sumOperandIndexMap = new HashMap<DataElementOperand, Integer>();
+        Collection<DataElementOperand> filteredOperands = new HashSet<DataElementOperand>();
         
         for ( final DataElementOperand operand : operands )
         {
             if ( operand.getValueType().equals( VALUE_TYPE_BOOL ) && operand.getAggregationOperator().equals( AGGREGATION_OPERATOR_SUM ) &&
                 operand.getFrequencyOrder() <= periodType.getFrequencyOrder() ) // Ignore disaggregation
             {
-                sumOperandIndexMap.put( operand, operandIndexMap.get( operand ) );
+                filteredOperands.add( operand );
             }
         }
         
-        return sumOperandIndexMap;
+        return filteredOperands;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java	2011-01-08 16:49:17 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java	2011-01-10 10:06:18 +0000
@@ -34,6 +34,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -79,15 +80,15 @@
     // DataElementAggregator implementation
     // -------------------------------------------------------------------------
 
-    public Map<DataElementOperand, Double> getAggregatedValues( final Map<DataElementOperand, Integer> operandIndexMap, 
+    public Map<DataElementOperand, Double> getAggregatedValues( final Collection<DataElementOperand> operands, 
         final Period period, final OrganisationUnit unit, int unitLevel, OrganisationUnitHierarchy hierarchy, String key )
     {
-        if ( operandIndexMap == null || operandIndexMap.size() == 0 )
+        if ( operands == null || operands.size() == 0 )
         {
             return new HashMap<DataElementOperand, Double>();
         }
         
-        final Collection<CrossTabDataValue> crossTabValues = crossTabService.getCrossTabDataValues( operandIndexMap, 
+        final Collection<CrossTabDataValue> crossTabValues = crossTabService.getCrossTabDataValues( operands, 
             aggregationCache.getIntersectingPeriods( period.getStartDate(), period.getEndDate() ), hierarchy.getChildren( unit.getId() ), key );
         
         final Map<DataElementOperand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(), 
@@ -197,19 +198,19 @@
         return totalSums;
     }
 
-    public Map<DataElementOperand, Integer> getOperandIndexMap( Collection<DataElementOperand> operands, PeriodType periodType, Map<DataElementOperand, Integer> operandIndexMap )
+    public Collection<DataElementOperand> filterOperands( Collection<DataElementOperand> operands, PeriodType periodType )
     {
-        Map<DataElementOperand, Integer> sumOperandIndexMap = new HashMap<DataElementOperand, Integer>();
+        Collection<DataElementOperand> filteredOperands = new HashSet<DataElementOperand>();
         
         for ( final DataElementOperand operand : operands )
         {
             if ( operand.getValueType().equals( VALUE_TYPE_INT ) && operand.getAggregationOperator().equals( AGGREGATION_OPERATOR_SUM ) &&
                  operand.getFrequencyOrder() <= periodType.getFrequencyOrder() ) // Ignore disaggregation
             {
-                sumOperandIndexMap.put( operand, operandIndexMap.get( operand ) );
+                filteredOperands.add( operand );
             }
         }
         
-        return sumOperandIndexMap;
+        return filteredOperands;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/DefaultCalculatedDataElementDataMart.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/DefaultCalculatedDataElementDataMart.java	2010-12-02 22:32:52 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/DefaultCalculatedDataElementDataMart.java	2011-01-10 10:06:18 +0000
@@ -45,7 +45,6 @@
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datamart.aggregation.cache.AggregationCache;
 import org.hisp.dhis.datamart.aggregation.dataelement.DataElementAggregator;
-import org.hisp.dhis.datamart.crosstab.CrossTabService;
 import org.hisp.dhis.jdbc.batchhandler.AggregatedDataValueBatchHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitHierarchy;
@@ -93,13 +92,6 @@
     {
         this.averageIntSingleValueAggregator = averageIntSingleValueAggregator;
     }
-
-    private CrossTabService crossTabService;
-
-    public void setCrossTabService( CrossTabService crossTabService )
-    {
-        this.crossTabService = crossTabService;
-    }    
     
     private DataElementCategoryService categoryService;
 
@@ -129,8 +121,6 @@
     public int exportCalculatedDataElements( final Collection<CalculatedDataElement> calculatedDataElements, final Collection<Period> periods,
         final Collection<OrganisationUnit> organisationUnits, final Collection<DataElementOperand> operands, String key )
     {
-        final Map<DataElementOperand, Integer> operandIndexMap = crossTabService.getOperandIndexMap( operands, key );
-        
         final DataElementCategoryOptionCombo categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
         
         final BatchHandler<AggregatedDataValue> batchHandler = batchHandlerFactory.createBatchHandler( AggregatedDataValueBatchHandler.class ).init();
@@ -149,17 +139,17 @@
         {
             final PeriodType periodType = period.getPeriodType();
 
-            final Map<DataElementOperand, Integer> sumOperandIndexMap = sumIntAggregator.getOperandIndexMap( operands, periodType, operandIndexMap );
-            final Map<DataElementOperand, Integer> averageOperandIndexMap = averageIntAggregator.getOperandIndexMap( operands, periodType, operandIndexMap );
-            final Map<DataElementOperand, Integer> averageSingleValueOperandIndexMap = averageIntSingleValueAggregator.getOperandIndexMap( operands, periodType, operandIndexMap );
+            final Collection<DataElementOperand> sumOperands = sumIntAggregator.filterOperands( operands, periodType );
+            final Collection<DataElementOperand> averageOperands = averageIntAggregator.filterOperands( operands, periodType );
+            final Collection<DataElementOperand> averageSingleValueOperands = averageIntSingleValueAggregator.filterOperands( operands, periodType );
 
             for ( final OrganisationUnit unit : organisationUnits )
             {
                 final int level = aggregationCache.getLevelOfOrganisationUnit( unit.getId() );
                 
-                final Map<DataElementOperand, Double> sumIntValueMap = sumIntAggregator.getAggregatedValues( sumOperandIndexMap, period, unit, level, hierarchy, key );                
-                final Map<DataElementOperand, Double> averageIntValueMap = averageIntAggregator.getAggregatedValues( averageOperandIndexMap, period, unit, level, hierarchy, key );
-                final Map<DataElementOperand, Double> averageIntSingleValueMap = averageIntSingleValueAggregator.getAggregatedValues( averageSingleValueOperandIndexMap, period, unit, level, hierarchy, key );
+                final Map<DataElementOperand, Double> sumIntValueMap = sumIntAggregator.getAggregatedValues( sumOperands, period, unit, level, hierarchy, key );                
+                final Map<DataElementOperand, Double> averageIntValueMap = averageIntAggregator.getAggregatedValues( averageOperands, period, unit, level, hierarchy, key );
+                final Map<DataElementOperand, Double> averageIntSingleValueMap = averageIntSingleValueAggregator.getAggregatedValues( averageSingleValueOperands, period, unit, level, hierarchy, key );
                 
                 final Map<DataElementOperand, Double> valueMap = new HashMap<DataElementOperand, Double>( sumIntValueMap );
                 valueMap.putAll( averageIntValueMap );

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java	2011-01-09 21:24:40 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/CrossTabService.java	2011-01-10 10:06:18 +0000
@@ -28,7 +28,6 @@
  */
 
 import java.util.Collection;
-import java.util.Map;
 
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datamart.CrossTabDataValue;
@@ -76,15 +75,6 @@
     void trimCrossTabTable( Collection<DataElementOperand> operands, String key );
 
     /**
-     * Provides a Map with information about the crosstab table where the key is
-     * the DataElementOperand and the value is the column index.
-     * 
-     * @param operands the collection of DataElementOperands.
-     * @return a Map with information about the crosstab table.
-     */
-    Map<DataElementOperand, Integer> getOperandIndexMap( Collection<DataElementOperand> operands, String key );
-    
-    /**
      * Validates whether the number of columns in the crosstab table will be valid
      * for the current DBMS.
      * 
@@ -101,7 +91,7 @@
      * @param sourceIds the source identifiers.
      * @return collection of CrossTabDataValues.
      */
-    Collection<CrossTabDataValue> getCrossTabDataValues( Map<DataElementOperand, Integer> operandIndexMap, Collection<Integer> periodIds, 
+    Collection<CrossTabDataValue> getCrossTabDataValues( Collection<DataElementOperand> operands, Collection<Integer> periodIds, 
         Collection<Integer> sourceIds, String key );
 
     /**
@@ -112,6 +102,6 @@
      * @param sourceId the source identifier.
      * @return collection of CrossTabDataValues.
      */
-    Collection<CrossTabDataValue> getCrossTabDataValues( Map<DataElementOperand, Integer> operandIndexMap, Collection<Integer> periodIds, 
+    Collection<CrossTabDataValue> getCrossTabDataValues( Collection<DataElementOperand> operands, Collection<Integer> periodIds, 
         int sourceId, String key );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2011-01-09 21:24:40 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2011-01-10 10:06:18 +0000
@@ -30,7 +30,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -120,30 +119,22 @@
             batchHandler.setTableName( CrossTabStore.TABLE_NAME + key );
             batchHandler.init();
 
-            Map<DataElementOperand, String> map = null;
-
-            List<String> valueList = null;
-
-            boolean hasValues = false;
-
-            String value = null;
-
             for ( final Integer periodId : periodIds )
             {
                 for ( final Integer sourceId : organisationUnitIds )
                 {
-                    map = aggregatedDataValueService.getDataValueMap( periodId, sourceId );
+                    final Map<DataElementOperand, String> map = aggregatedDataValueService.getDataValueMap( periodId, sourceId );
 
-                    valueList = new ArrayList<String>( operandList.size() + 2 );
+                    final List<String> valueList = new ArrayList<String>( operandList.size() + 2 );
 
                     valueList.add( String.valueOf( periodId ) );
                     valueList.add( String.valueOf( sourceId ) );
 
-                    hasValues = false;
+                    boolean hasValues = false;
 
                     for ( DataElementOperand operand : operandList )
                     {
-                        value = map.get( operand );
+                        String value = map.get( operand );
 
                         if ( value != null && value.length() > MAX_LENGTH )
                         {
@@ -201,40 +192,21 @@
         }
     }
 
-    public Map<DataElementOperand, Integer> getOperandIndexMap( Collection<DataElementOperand> operands, String key )
-    {
-        final Map<String, Integer> columnNameIndexMap = crossTabStore.getCrossTabTableColumns( key );
-
-        final Map<DataElementOperand, Integer> operandMap = new HashMap<DataElementOperand, Integer>();
-
-        for ( DataElementOperand operand : operands )
-        {
-            final String col = operand.getColumnName();
-
-            if ( columnNameIndexMap.containsKey( col ) )
-            {
-                operandMap.put( operand, columnNameIndexMap.get( col ) );
-            }
-        }
-
-        return operandMap;
-    }
-
     public int validateCrossTabTable( Collection<DataElementOperand> operands )
     {
         return crossTabStore.validateCrossTabTable( operands );
     }
 
-    public Collection<CrossTabDataValue> getCrossTabDataValues( Map<DataElementOperand, Integer> operandIndexMap,
+    public Collection<CrossTabDataValue> getCrossTabDataValues( Collection<DataElementOperand> operands,
         Collection<Integer> periodIds, Collection<Integer> sourceIds, String key )
     {
-        return crossTabStore.getCrossTabDataValues( operandIndexMap, periodIds, sourceIds, key );
+        return crossTabStore.getCrossTabDataValues( operands, periodIds, sourceIds, key );
     }
 
-    public Collection<CrossTabDataValue> getCrossTabDataValues( Map<DataElementOperand, Integer> operandIndexMap,
+    public Collection<CrossTabDataValue> getCrossTabDataValues( Collection<DataElementOperand> operands,
         Collection<Integer> periodIds, int sourceId, String key )
     {
-        return crossTabStore.getCrossTabDataValues( operandIndexMap, periodIds, sourceId, key );
+        return crossTabStore.getCrossTabDataValues( operands, periodIds, sourceId, key );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java	2011-01-08 16:27:43 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java	2011-01-10 10:06:18 +0000
@@ -29,7 +29,6 @@
 
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datamart.CrossTabDataValue;
@@ -54,24 +53,11 @@
     void createCrossTabTable( List<DataElementOperand> operands, String key );
 
     /**
-     * Retrieves a Map with information about the column names in the crosstab
-     * table where they key is the column name and the value is the column index.
-     * 
-     * @return a Map with information about the columns in the crosstab table.
-     */
-    Map<String, Integer> getCrossTabTableColumns( String key );
-    
-    /**
      * Drops the crosstab table.
      */
     void dropCrossTabTable( String key );
     
     /**
-     * Drops the trimmed crosstab table.
-     */
-    void dropTrimmedCrossTabTable( String key );
-    
-    /**
      * Renames the trimmed crosstab table to the regular crosstab table.
      */
     void renameTrimmedCrossTabTable( String key );
@@ -101,7 +87,7 @@
      * @param sourceIds the source identifiers.
      * @return collection of CrossTabDataValues.
      */
-    Collection<CrossTabDataValue> getCrossTabDataValues( Map<DataElementOperand, Integer> operandIndexMap, Collection<Integer> periodIds, 
+    Collection<CrossTabDataValue> getCrossTabDataValues( Collection<DataElementOperand> operands, Collection<Integer> periodIds, 
         Collection<Integer> sourceIds, String key );
 
     /**
@@ -112,6 +98,6 @@
      * @param sourceId the source identifier.
      * @return collection of CrossTabDataValues.
      */
-    Collection<CrossTabDataValue> getCrossTabDataValues( Map<DataElementOperand, Integer> operandIndexMap, Collection<Integer> periodIds, 
+    Collection<CrossTabDataValue> getCrossTabDataValues( Collection<DataElementOperand> operands, Collection<Integer> periodIds, 
         int sourceId, String key );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/JDBCCrossTabStore.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/JDBCCrossTabStore.java	2010-12-05 19:34:52 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/JDBCCrossTabStore.java	2011-01-10 10:06:18 +0000
@@ -30,13 +30,10 @@
 import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
 
 import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.amplecode.quick.StatementHolder;
 import org.amplecode.quick.StatementManager;
@@ -102,39 +99,6 @@
             holder.close();
         }
     }
-
-    public Map<String, Integer> getCrossTabTableColumns( String key )
-    {
-        final StatementHolder holder = statementManager.getHolder();
-        
-        try
-        {
-            final String sql = "SELECT * FROM " + TABLE_NAME + key + " LIMIT 0";
-            
-            final ResultSetMetaData metaData = holder.getStatement().executeQuery( sql ).getMetaData();
-            
-            final Map<String, Integer> columnIndexMap = new HashMap<String, Integer>();
-            
-            for ( int i = 0; i < metaData.getColumnCount(); i++ )
-            {
-                final int index = i + 1;
-                
-                final String columnName = metaData.getColumnName( index ).toLowerCase();
-                
-                columnIndexMap.put( columnName, index );
-            }
-            
-            return columnIndexMap;
-        }
-        catch ( SQLException ex )
-        {
-            throw new RuntimeException( "Failed to get crosstab table columns", ex );
-        }
-        finally
-        {
-            holder.close();
-        }
-    }
     
     public void dropCrossTabTable( String key )
     {
@@ -156,26 +120,6 @@
         }
     }
 
-    public void dropTrimmedCrossTabTable( String key )
-    {
-        final StatementHolder holder = statementManager.getHolder();
-        
-        try
-        {
-            final String sql = "DROP TABLE IF EXISTS " + TABLE_NAME_TRIMMED + key;
-            
-            holder.getStatement().executeUpdate( sql );
-        }
-        catch ( SQLException ex )
-        {
-            throw new RuntimeException( "Failed to drop trimmed datavalue crosstab table", ex );
-        }
-        finally
-        {
-            holder.close();
-        }
-    }
-
     public void renameTrimmedCrossTabTable( String key )
     {
         final StatementHolder holder = statementManager.getHolder();
@@ -240,7 +184,7 @@
     // CrossTabDataValue
     // -------------------------------------------------------------------------
 
-    public Collection<CrossTabDataValue> getCrossTabDataValues( Map<DataElementOperand, Integer> operandIndexMap, 
+    public Collection<CrossTabDataValue> getCrossTabDataValues( Collection<DataElementOperand> operands, 
         Collection<Integer> periodIds, Collection<Integer> sourceIds, String key )
     {
         final StatementHolder holder = statementManager.getHolder();
@@ -255,7 +199,7 @@
             
             final ResultSet resultSet = holder.getStatement().executeQuery( sql );
             
-            return getCrossTabDataValues( resultSet, operandIndexMap );
+            return getCrossTabDataValues( resultSet, operands );
         }
         catch ( SQLException ex )
         {
@@ -267,7 +211,8 @@
         }
     }
     
-    public Collection<CrossTabDataValue> getCrossTabDataValues( Map<DataElementOperand, Integer> operandIndexMap, Collection<Integer> periodIds, int sourceId, String key )
+    public Collection<CrossTabDataValue> getCrossTabDataValues( Collection<DataElementOperand> operands, 
+        Collection<Integer> periodIds, int sourceId, String key )
     {
         final StatementHolder holder = statementManager.getHolder();
         
@@ -281,7 +226,7 @@
             
             final ResultSet resultSet = holder.getStatement().executeQuery( sql );
             
-            return getCrossTabDataValues( resultSet, operandIndexMap );
+            return getCrossTabDataValues( resultSet, operands );
         }
         catch ( SQLException ex )
         {
@@ -297,7 +242,7 @@
     // Supportive methods
     // -------------------------------------------------------------------------
 
-    private Collection<CrossTabDataValue> getCrossTabDataValues( ResultSet resultSet, Map<DataElementOperand, Integer> operandIndexMap )
+    private Collection<CrossTabDataValue> getCrossTabDataValues( ResultSet resultSet, Collection<DataElementOperand> operands )
         throws SQLException
     {
         final Collection<CrossTabDataValue> values = new ArrayList<CrossTabDataValue>();
@@ -309,13 +254,15 @@
             value.setPeriodId( resultSet.getInt( 1 ) );
             value.setSourceId( resultSet.getInt( 2 ) );
             
-            for ( Map.Entry<DataElementOperand, Integer> entry : operandIndexMap.entrySet() )
+            for ( DataElementOperand operand : operands )
             {
-                String columnValue = resultSet.getString( entry.getValue() );
+                final String columnName = operand.getColumnName();
+                
+                final String columnValue = resultSet.getString( columnName );
                 
                 if ( columnValue != null )
                 {
-                    value.getValueMap().put( entry.getKey(), columnValue );
+                    value.getValueMap().put( operand, columnValue );
                 }
             }
             

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java	2011-01-09 13:02:36 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java	2011-01-10 10:06:18 +0000
@@ -39,7 +39,6 @@
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datamart.aggregation.cache.AggregationCache;
 import org.hisp.dhis.datamart.aggregation.dataelement.DataElementAggregator;
-import org.hisp.dhis.datamart.crosstab.CrossTabService;
 import org.hisp.dhis.jdbc.batchhandler.AggregatedDataValueBatchHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitHierarchy;
@@ -72,14 +71,7 @@
     {
         this.batchHandlerFactory = batchHandlerFactory;
     }
-    
-    private CrossTabService crossTabService;
-
-    public void setCrossTabService( CrossTabService crossTabService )
-    {
-        this.crossTabService = crossTabService;
-    }
-    
+        
     private AggregationCache aggregationCache;
 
     public void setAggregationCache( AggregationCache aggregationCache )
@@ -94,8 +86,6 @@
     public int exportDataValues( final Collection<DataElementOperand> operands, final Collection<Period> periods, 
         final Collection<OrganisationUnit> organisationUnits, final DataElementAggregator dataElementAggregator, String key )
     {
-        final Map<DataElementOperand, Integer> operandIndexMap = crossTabService.getOperandIndexMap( operands, key );
-        
         final BatchHandler<AggregatedDataValue> batchHandler = batchHandlerFactory.createBatchHandler( AggregatedDataValueBatchHandler.class ).init();
         
         final OrganisationUnitHierarchy hierarchy = organisationUnitService.getOrganisationUnitHierarchy().prepareChildren( organisationUnits );
@@ -106,15 +96,15 @@
         
         for ( final Period period : periods )
         {
-            final Map<DataElementOperand, Integer> currentOperandIndexMap = dataElementAggregator.getOperandIndexMap( operands, period.getPeriodType(), operandIndexMap );
+            final Collection<DataElementOperand> currentOperands = dataElementAggregator.filterOperands( operands, period.getPeriodType() );
             
-            if ( currentOperandIndexMap != null && currentOperandIndexMap.size() > 0 )
+            if ( currentOperands != null && currentOperands.size() > 0 )
             {
                 for ( final OrganisationUnit unit : organisationUnits )
                 {
                     final int level = aggregationCache.getLevelOfOrganisationUnit( unit.getId() );
                     
-                    final Map<DataElementOperand, Double> valueMap = dataElementAggregator.getAggregatedValues( currentOperandIndexMap, period, unit, level, hierarchy, key );
+                    final Map<DataElementOperand, Double> valueMap = dataElementAggregator.getAggregatedValues( currentOperands, period, unit, level, hierarchy, key );
                     
                     for ( Entry<DataElementOperand, Double> entry : valueMap.entrySet() )
                     {

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/indicator/DefaultIndicatorDataMart.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/indicator/DefaultIndicatorDataMart.java	2010-12-06 09:27:07 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/indicator/DefaultIndicatorDataMart.java	2011-01-10 10:06:18 +0000
@@ -43,7 +43,6 @@
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datamart.aggregation.cache.AggregationCache;
 import org.hisp.dhis.datamart.aggregation.dataelement.DataElementAggregator;
-import org.hisp.dhis.datamart.crosstab.CrossTabService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.jdbc.batchhandler.AggregatedIndicatorValueBatchHandler;
 import org.hisp.dhis.options.SystemSettingManager;
@@ -97,13 +96,6 @@
     {
         this.averageIntSingleValueAggregator = averageIntSingleValueAggregator;
     }
-
-    private CrossTabService crossTabService;
-
-    public void setCrossTabService( CrossTabService crossTabService )
-    {
-        this.crossTabService = crossTabService;
-    }    
     
     private AggregationCache aggregationCache;
 
@@ -133,8 +125,6 @@
     public int exportIndicatorValues( final Collection<Indicator> indicators, final Collection<Period> periods, 
         final Collection<OrganisationUnit> organisationUnits, final Collection<DataElementOperand> operands, String key )
     {
-        final Map<DataElementOperand, Integer> operandIndexMap = crossTabService.getOperandIndexMap( operands, key );
-        
         final BatchHandler<AggregatedIndicatorValue> batchHandler = batchHandlerFactory.createBatchHandler( AggregatedIndicatorValueBatchHandler.class ).init();
 
         final OrganisationUnitHierarchy hierarchy = organisationUnitService.getOrganisationUnitHierarchy().prepareChildren( organisationUnits );
@@ -154,17 +144,17 @@
         {
             final PeriodType periodType = period.getPeriodType();
             
-            final Map<DataElementOperand, Integer> sumOperandIndexMap = sumIntAggregator.getOperandIndexMap( operands, periodType, operandIndexMap );
-            final Map<DataElementOperand, Integer> averageOperandIndexMap = averageIntAggregator.getOperandIndexMap( operands, periodType, operandIndexMap );
-            final Map<DataElementOperand, Integer> averageSingleValueOperandIndexMap = averageIntSingleValueAggregator.getOperandIndexMap( operands, periodType, operandIndexMap );
+            final Collection<DataElementOperand> sumOperands = sumIntAggregator.filterOperands( operands, periodType );
+            final Collection<DataElementOperand> averageOperands = averageIntAggregator.filterOperands( operands, periodType );
+            final Collection<DataElementOperand> averageSingleValueOperands = averageIntSingleValueAggregator.filterOperands( operands, periodType );
 
             for ( final OrganisationUnit unit : organisationUnits )
             {
                 final int level = aggregationCache.getLevelOfOrganisationUnit( unit.getId() );
                 
-                final Map<DataElementOperand, Double> sumIntValueMap = sumIntAggregator.getAggregatedValues( sumOperandIndexMap, period, unit, level, hierarchy, key );                
-                final Map<DataElementOperand, Double> averageIntValueMap = averageIntAggregator.getAggregatedValues( averageOperandIndexMap, period, unit, level, hierarchy, key );
-                final Map<DataElementOperand, Double> averageIntSingleValueMap = averageIntSingleValueAggregator.getAggregatedValues( averageSingleValueOperandIndexMap, period, unit, level, hierarchy, key );
+                final Map<DataElementOperand, Double> sumIntValueMap = sumIntAggregator.getAggregatedValues( sumOperands, period, unit, level, hierarchy, key );                
+                final Map<DataElementOperand, Double> averageIntValueMap = averageIntAggregator.getAggregatedValues( averageOperands, period, unit, level, hierarchy, key );
+                final Map<DataElementOperand, Double> averageIntSingleValueMap = averageIntSingleValueAggregator.getAggregatedValues( averageSingleValueOperands, period, unit, level, hierarchy, key );
                 
                 final Map<DataElementOperand, Double> valueMap = new HashMap<DataElementOperand, Double>( sumIntValueMap );
                 valueMap.putAll( averageIntValueMap );

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml	2011-01-07 16:43:23 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml	2011-01-10 10:06:18 +0000
@@ -150,8 +150,6 @@
     <property name="organisationUnitService"
       ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
     <property name="batchHandlerFactory" ref="batchHandlerFactory"/>
-    <property name="crossTabService"
-      ref="org.hisp.dhis.datamart.crosstab.CrossTabService"/>
     <property name="aggregationCache"
       ref="org.hisp.dhis.datamart.aggregation.cache.AggregationCache"/>
   </bean>
@@ -168,8 +166,6 @@
       ref="org.hisp.dhis.datamart.aggregation.dataelement.AverageIntAggregator"/>
 	<property name="averageIntSingleValueAggregator"
       ref="org.hisp.dhis.datamart.aggregation.dataelement.AverageIntSingleValueAggregator"/>
-    <property name="crossTabService"
-      ref="org.hisp.dhis.datamart.crosstab.CrossTabService"/>
     <property name="aggregationCache"
       ref="org.hisp.dhis.datamart.aggregation.cache.AggregationCache"/>
     <property name="systemSettingManager"
@@ -189,8 +185,6 @@
       ref="org.hisp.dhis.datamart.aggregation.dataelement.AverageIntAggregator"/>
 	<property name="averageIntSingleValueAggregator"
       ref="org.hisp.dhis.datamart.aggregation.dataelement.AverageIntSingleValueAggregator"/>
-    <property name="crossTabService"
-      ref="org.hisp.dhis.datamart.crosstab.CrossTabService"/>
     <property name="categoryService"
       ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
     <property name="aggregationCache"

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java	2010-06-26 19:48:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java	2011-01-10 10:06:18 +0000
@@ -35,7 +35,6 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Map;
 
 import org.apache.commons.lang.RandomStringUtils;
 import org.hisp.dhis.DhisTest;
@@ -183,10 +182,8 @@
     public void testPopulateCrossTabValue()
     {
         crossTabService.populateCrossTabTable( operands, periodIds, organisationUnitIds, key );
-
-        Map<DataElementOperand, Integer> operandIndexMap = crossTabService.getOperandIndexMap( operands, key );
-
-        Collection<CrossTabDataValue> values = crossTabService.getCrossTabDataValues( operandIndexMap, periodIds, organisationUnitIds, key );
+        
+        Collection<CrossTabDataValue> values = crossTabService.getCrossTabDataValues( operands, periodIds, organisationUnitIds, key );
         
         assertNotNull( values );
         
@@ -215,29 +212,4 @@
         
         crossTabService.trimCrossTabTable( operandsWithData, key );
     }
-    
-    @Test
-    public void testGetOperandIndexMap()
-    {
-        crossTabService.populateCrossTabTable( operands, periodIds, organisationUnitIds, key );
-
-        Map<DataElementOperand, Integer> operandIndexMap = crossTabService.getOperandIndexMap( operands, key );
-        
-        assertEquals( operands.size(), operandIndexMap.size() );
-        
-        Iterator<DataElementOperand> iterator = operands.iterator();
-        
-        int minIndex = 3;
-        int maxIndex = operands.size() + 2;
-        
-        while ( iterator.hasNext() )
-        {
-            DataElementOperand operand = iterator.next();
-            Integer index = operandIndexMap.get( operand );
-            
-            assertNotNull( index );
-            assertTrue( index >= minIndex );
-            assertTrue( index <= maxIndex );
-        }            
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabStoreTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabStoreTest.java	2010-06-26 19:48:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabStoreTest.java	2011-01-10 10:06:18 +0000
@@ -1,10 +1,7 @@
 package org.hisp.dhis.datamart.crosstab;
 
-import static junit.framework.Assert.assertEquals;
-
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.lang.RandomStringUtils;
 import org.hisp.dhis.DhisTest;
@@ -46,22 +43,6 @@
     // -------------------------------------------------------------------------
     // Tests
     // -------------------------------------------------------------------------
-
-    @Test
-    public void testCreateGetCrossTabTable()
-    {
-        crossTabStore.createCrossTabTable( operands, key );
-        
-        Map<String, Integer> columnNames = crossTabStore.getCrossTabTableColumns( key );
-        
-        assertEquals( 6, columnNames.size() );
-        assertEquals( new Integer( 1 ), columnNames.get( "periodid" ) );
-        assertEquals( new Integer( 2 ), columnNames.get( "sourceid" ) );
-        assertEquals( new Integer( 3 ), columnNames.get( "de1_1" ) );
-        assertEquals( new Integer( 4 ), columnNames.get( "de1_2" ) );
-        assertEquals( new Integer( 5 ), columnNames.get( "de2_1" ) );
-        assertEquals( new Integer( 6 ), columnNames.get( "de2_2" ) );        
-    }
     
     @Test
     public void testDropCrossTabTable()

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm	2011-01-10 09:32:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm	2011-01-10 10:06:18 +0000
@@ -80,7 +80,7 @@
         	#if ( $mode == "table" )
             <input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='displayManageTableForm.action'" style="width:140px">
         	#elseif ( $mode == "report" )
-            <input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href=''" style="width:140px">
+            <input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='displayViewReportForm.action'" style="width:140px">
         	#end
         </td>
     </tr>