← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 2498
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-01-09 21:16:36 +0100
message:
  Simplification in datamart
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.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-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2011-01-09 13:02:36 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2011-01-09 20:16:36 +0000
@@ -27,11 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.dataelement.DataElement.AGGREGATION_OPERATOR_AVERAGE;
-import static org.hisp.dhis.dataelement.DataElement.AGGREGATION_OPERATOR_SUM;
-import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_BOOL;
-import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_INT;
-
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
@@ -52,7 +47,6 @@
 import org.hisp.dhis.datamart.crosstab.CrossTabService;
 import org.hisp.dhis.datamart.dataelement.DataElementDataMart;
 import org.hisp.dhis.datamart.indicator.IndicatorDataMart;
-import org.hisp.dhis.datamart.util.ParserUtil;
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -253,15 +247,6 @@
         allOperands.addAll( indicatorOperands );
         allOperands.addAll( calculatedOperands );
 
-        final Collection<DataElementOperand> sumIntDataElementOperands = ParserUtil.filterOperands(
-            nonCalculatedOperands, VALUE_TYPE_INT, AGGREGATION_OPERATOR_SUM );
-        final Collection<DataElementOperand> averageIntDataElementOperands = ParserUtil.filterOperands(
-            nonCalculatedOperands, VALUE_TYPE_INT, AGGREGATION_OPERATOR_AVERAGE );
-        final Collection<DataElementOperand> sumBoolDataElementOperands = ParserUtil.filterOperands(
-            nonCalculatedOperands, VALUE_TYPE_BOOL, AGGREGATION_OPERATOR_SUM );
-        final Collection<DataElementOperand> averageBoolDataElementOperands = ParserUtil.filterOperands(
-            nonCalculatedOperands, VALUE_TYPE_BOOL, AGGREGATION_OPERATOR_AVERAGE );
-
         log.info( "Filtered data elements: " + TimeUtils.getHMS() );
 
         // ---------------------------------------------------------------------
@@ -303,49 +288,27 @@
 
         state.setMessage( "exporting_data_for_data_elements" );
 
-        if ( sumIntDataElementOperands.size() > 0 )
-        {
-            count += dataElementDataMart.exportDataValues( sumIntDataElementOperands, periods, organisationUnits,
-                sumIntAggregator, key );
-
-            log.info( "Exported values for data element operands with sum aggregation operator of type number ("
-                + sumIntDataElementOperands.size() + "): " + TimeUtils.getHMS() );
-        }
-
-        if ( averageIntDataElementOperands.size() > 0 )
-        {
-            count += dataElementDataMart.exportDataValues( averageIntDataElementOperands, periods,
-                organisationUnits, averageIntAggregator, key );
-
-            log.info( "Exported values for data element operands with average aggregation operator of type number ("
-                + averageIntDataElementOperands.size() + "): " + TimeUtils.getHMS() );
-        }
-
-        if ( averageIntDataElementOperands.size() > 0 )
-        {
-            count += dataElementDataMart.exportDataValues( averageIntDataElementOperands, periods,
-                organisationUnits, averageIntSingleValueAggregator, key );
-
-            log.info( "Exported values for data element operands with average aggregation operator with single value of type number ("
-                    + averageIntDataElementOperands.size() + "): " + TimeUtils.getHMS() );
-        }
-
-        if ( sumBoolDataElementOperands.size() > 0 )
-        {
-            count += dataElementDataMart.exportDataValues( sumBoolDataElementOperands, periods, organisationUnits,
-                sumBoolAggregator, key );
-
-            log.info( "Exported values for data element operands with sum aggregation operator of type yes/no ("
-                + sumBoolDataElementOperands.size() + "): " + TimeUtils.getHMS() );
-        }
-
-        if ( averageBoolDataElementOperands.size() > 0 )
-        {
-            count += dataElementDataMart.exportDataValues( averageBoolDataElementOperands, periods,
-                organisationUnits, averageBoolAggregator, key );
-
-            log.info( "Exported values for data element operands with average aggregation operator of type yes/no ("
-                + averageBoolDataElementOperands.size() + "): " + TimeUtils.getHMS() );
+        if ( nonCalculatedOperands.size() > 0 )
+        {
+            count += dataElementDataMart.exportDataValues( nonCalculatedOperands, periods, organisationUnits, sumIntAggregator, key );
+
+            log.info( "Exported values for data element operands with sum aggregation operator of type number: " + TimeUtils.getHMS() );
+            
+            count += dataElementDataMart.exportDataValues( nonCalculatedOperands, periods, organisationUnits, averageIntAggregator, key );
+
+            log.info( "Exported values for data element operands with average aggregation operator of type number: " + TimeUtils.getHMS() );
+            
+            count += dataElementDataMart.exportDataValues( nonCalculatedOperands, periods, organisationUnits, averageIntSingleValueAggregator, key );
+
+            log.info( "Exported values for data element operands with average aggregation operator with single value of type number: " + TimeUtils.getHMS() );
+            
+            count += dataElementDataMart.exportDataValues( nonCalculatedOperands, periods, organisationUnits, sumBoolAggregator, key );
+
+            log.info( "Exported values for data element operands with sum aggregation operator of type yes/no: " + TimeUtils.getHMS() );
+            
+            count += dataElementDataMart.exportDataValues( nonCalculatedOperands, periods, organisationUnits, averageBoolAggregator, key );
+
+            log.info( "Exported values for data element operands with average aggregation operator of type yes/no: " + TimeUtils.getHMS() );
         }
 
         state.setMessage( "exporting_data_for_indicators" );
@@ -358,7 +321,7 @@
         {
             count += indicatorDataMart.exportIndicatorValues( indicators, periods, organisationUnits, indicatorOperands, key );
 
-            log.info( "Exported values for indicators (" + indicators.size() + "): " + TimeUtils.getHMS() );
+            log.info( "Exported values for indicators: " + TimeUtils.getHMS() );
         }
 
         state.setMessage( "exporting_data_for_calculated_data_elements" );
@@ -371,7 +334,7 @@
         {
             count += calculatedDataElementDataMart.exportCalculatedDataElements( calculatedDataElements, periods, organisationUnits, calculatedOperands, key );
 
-            log.info( "Exported values for calculated data elements (" + calculatedDataElements.size() + "): " + TimeUtils.getHMS() );
+            log.info( "Exported values for calculated data elements: " + TimeUtils.getHMS() );
         }
 
         crossTabService.dropCrossTabTable( key );