← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1833: Changed return type in AggregationService from -1 / NO_VALUES_REGISTERED (primitive type) to null...

 

------------------------------------------------------------
revno: 1833
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Sat 2010-07-10 16:50:48 +0200
message:
  Changed return type in AggregationService from -1 / NO_VALUES_REGISTERED (primitive type) to null (object type). Return -1 is incorrect since the aggregated value might very well be -1.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregationService.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/DefaultAggregationService.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/cache/AggregationCache.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/cache/MemoryAggregationCache.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AbstractDataElementAggregation.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageBoolDataElementAggregation.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageIntDataElementAggregation.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageIntSingleValueDataElementAggregation.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/SumBoolDataElementAggregation.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/SumIntDataElementAggregation.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/indicator/IndicatorAggregation.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateDataElementChartAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateIndicatorChartAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationDEChartAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationInChartAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GeneratePeriodsDEChartAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GeneratePeriodsInChartAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelUtils.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-api/src/main/java/org/hisp/dhis/aggregation/AggregationService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregationService.java	2010-06-27 15:34:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregationService.java	2010-07-10 14:50:48 +0000
@@ -42,8 +42,6 @@
 {
     String ID = AggregationService.class.getName();
 
-    static final double NO_VALUES_REGISTERED = -1.0;
-
     /**
      * Calculates the aggregated value based on the aggregation operator defined
      * in the given dataelement.
@@ -55,7 +53,7 @@
      * @return the aggregated value.
      * @throws AggregationStoreException
      */
-    double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate,
+    Double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate,
         OrganisationUnit organisationUnit );
 
     /**
@@ -68,7 +66,7 @@
      * @return the aggregated value.
      * @throws AggregationStoreException
      */
-    double getAggregatedIndicatorValue( Indicator indicator, Date startDate, Date endDate,
+    Double getAggregatedIndicatorValue( Indicator indicator, Date startDate, Date endDate,
         OrganisationUnit organisationUnit );
 
     /**
@@ -81,7 +79,7 @@
      * @return the aggregated value.
      * @throws AggregationStoreException
      */
-    double getAggregatedNumeratorValue( Indicator indicator, Date startDate, Date endDate,
+    Double getAggregatedNumeratorValue( Indicator indicator, Date startDate, Date endDate,
         OrganisationUnit organisationUnit );
 
     /**
@@ -95,7 +93,7 @@
      * @return the aggregated value.
      * @throws AggregationStoreException
      */
-    double getAggregatedDenominatorValue( Indicator indicator, Date startDate, Date endDate,
+    Double getAggregatedDenominatorValue( Indicator indicator, Date startDate, Date endDate,
         OrganisationUnit organisationUnit );
     
     void clearCache();

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/DefaultAggregationService.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/DefaultAggregationService.java	2010-07-04 11:50:16 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/DefaultAggregationService.java	2010-07-10 14:50:48 +0000
@@ -105,7 +105,7 @@
     // DataElement
     // -------------------------------------------------------------------------
 
-    public double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate,
+    public Double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate,
         OrganisationUnit organisationUnit )
     {
         AbstractDataElementAggregation dataElementAggregation = 
@@ -118,19 +118,19 @@
     // Indicator
     // -------------------------------------------------------------------------
 
-    public double getAggregatedIndicatorValue( Indicator indicator, Date startDate, Date endDate,
+    public Double getAggregatedIndicatorValue( Indicator indicator, Date startDate, Date endDate,
         OrganisationUnit organisationUnit )
     {
         return indicatorAggregation.getAggregatedIndicatorValue( indicator, startDate, endDate, organisationUnit );
     }
 
-    public double getAggregatedNumeratorValue( Indicator indicator, Date startDate, Date endDate,
+    public Double getAggregatedNumeratorValue( Indicator indicator, Date startDate, Date endDate,
         OrganisationUnit organisationUnit )
     {
         return indicatorAggregation.getAggregatedNumeratorValue( indicator, startDate, endDate, organisationUnit );
     }
 
-    public double getAggregatedDenominatorValue( Indicator indicator, Date startDate, Date endDate,
+    public Double getAggregatedDenominatorValue( Indicator indicator, Date startDate, Date endDate,
         OrganisationUnit organisationUnit )
     {
         return indicatorAggregation.getAggregatedDenominatorValue( indicator, startDate, endDate, organisationUnit );

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/cache/AggregationCache.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/cache/AggregationCache.java	2010-07-04 11:50:16 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/cache/AggregationCache.java	2010-07-10 14:50:48 +0000
@@ -48,7 +48,7 @@
     
     Collection<Integer> getIntersectingPeriodIds( Date startDate, Date endDate );
     
-    double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate, OrganisationUnit organisationUnit );
+    Double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate, OrganisationUnit organisationUnit );
     
     void clearCache();
 }

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/cache/MemoryAggregationCache.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/cache/MemoryAggregationCache.java	2010-07-04 11:50:16 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/cache/MemoryAggregationCache.java	2010-07-10 14:50:48 +0000
@@ -139,7 +139,7 @@
         return periodIds;
     }    
     
-    public double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate, OrganisationUnit organisationUnit )
+    public Double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate, OrganisationUnit organisationUnit )
     {
         return aggregationService.getAggregatedDataValue( dataElement, optionCombo, startDate, endDate, organisationUnit );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AbstractDataElementAggregation.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AbstractDataElementAggregation.java	2010-06-27 15:34:05 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AbstractDataElementAggregation.java	2010-07-10 14:50:48 +0000
@@ -80,7 +80,7 @@
      * @param aggregationEndDate End date
      * @param organisationUnit The organisationUnit
      */
-    public abstract double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate,
+    public abstract Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date startDate, Date endDate,
         OrganisationUnit organisationUnit );
     
     /**

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageBoolDataElementAggregation.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageBoolDataElementAggregation.java	2010-07-04 11:50:16 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageBoolDataElementAggregation.java	2010-07-10 14:50:48 +0000
@@ -32,7 +32,6 @@
 import java.util.Collection;
 import java.util.Date;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.datavalue.DataValue;
@@ -47,7 +46,7 @@
 public class AverageBoolDataElementAggregation
     extends AbstractDataElementAggregation
 {
-    public double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
+    public Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
         OrganisationUnit organisationUnit )
     {
         double[] sums = getSumAndRelevantDays( dataElement.getId(), optionCombo.getId(), aggregationStartDate, aggregationEndDate, 
@@ -61,7 +60,7 @@
         }
         else
         {
-            return AggregationService.NO_VALUES_REGISTERED;
+            return null;
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageIntDataElementAggregation.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageIntDataElementAggregation.java	2010-07-04 11:50:16 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageIntDataElementAggregation.java	2010-07-10 14:50:48 +0000
@@ -32,7 +32,6 @@
 import java.util.Collection;
 import java.util.Date;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.datavalue.DataValue;
@@ -47,7 +46,7 @@
 public class AverageIntDataElementAggregation
     extends AbstractDataElementAggregation
 {
-    public double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
+    public Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
         OrganisationUnit organisationUnit )
     {
         double totalSum = 0;
@@ -72,14 +71,7 @@
             }
         }
 
-        if ( valuesRegistered )
-        {
-            return totalSum;
-        }
-        else
-        {
-            return AggregationService.NO_VALUES_REGISTERED;
-        }
+        return valuesRegistered ? totalSum : null;
     }
 
     /**

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageIntSingleValueDataElementAggregation.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageIntSingleValueDataElementAggregation.java	2010-07-04 11:50:16 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageIntSingleValueDataElementAggregation.java	2010-07-10 14:50:48 +0000
@@ -32,7 +32,6 @@
 import java.util.Collection;
 import java.util.Date;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.datavalue.DataValue;
@@ -47,20 +46,13 @@
 public class AverageIntSingleValueDataElementAggregation
     extends AbstractDataElementAggregation
 {
-    public double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
+    public Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
         OrganisationUnit organisationUnit )
     {
         double[] sums = getSumAndRelevantDays( dataElement.getId(), optionCombo.getId(), aggregationStartDate, aggregationEndDate, 
             organisationUnit.getId() );
 
-        if ( sums[1] > 0 )
-        {
-            return sums[0];
-        }
-        else
-        {
-            return AggregationService.NO_VALUES_REGISTERED;
-        }
+        return sums[1] > 0 ? sums[0] : null;
     }
     
     protected Collection<DataValue> getDataValues( int dataElementId, int optionComboId, int organisationUnitId,

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/SumBoolDataElementAggregation.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/SumBoolDataElementAggregation.java	2010-07-04 11:50:16 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/SumBoolDataElementAggregation.java	2010-07-10 14:50:48 +0000
@@ -27,10 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.system.util.DateUtils.getDays;
+import static org.hisp.dhis.system.util.MathUtils.getFloor;
+
 import java.util.Collection;
 import java.util.Date;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.datavalue.DataValue;
@@ -38,9 +40,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitHierarchy;
 import org.hisp.dhis.period.Period;
 
-import static org.hisp.dhis.system.util.MathUtils.getFloor;
-import static org.hisp.dhis.system.util.DateUtils.getDays;
-
 /**
  * @author Lars Helge Overland
  * @version $Id: SumBoolDataElementAggregation.java 4753 2008-03-14 12:48:50Z larshelg $
@@ -48,20 +47,13 @@
 public class SumBoolDataElementAggregation
     extends AbstractDataElementAggregation
 {
-    public double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
+    public Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
         OrganisationUnit organisationUnit )
     {
         double[] sums = getSumAndRelevantDays( dataElement.getId(), optionCombo.getId(), aggregationStartDate, aggregationEndDate, 
             organisationUnit.getId() );
 
-        if ( sums[1] > 0 )
-        {
-            return getFloor( sums[0] );
-        }
-        else
-        {
-            return AggregationService.NO_VALUES_REGISTERED;
-        }
+        return sums[1] > 0 ? getFloor( sums[0] ) : null;
     }
 
     protected Collection<DataValue> getDataValues( int dataElementId, int optionComboId, int organisationUnitId,

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/SumIntDataElementAggregation.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/SumIntDataElementAggregation.java	2010-07-04 11:50:16 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/SumIntDataElementAggregation.java	2010-07-10 14:50:48 +0000
@@ -32,7 +32,6 @@
 import java.util.Collection;
 import java.util.Date;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.datavalue.DataValue;
@@ -47,20 +46,13 @@
 public class SumIntDataElementAggregation
     extends AbstractDataElementAggregation
 {
-    public double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
+    public Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, Date aggregationStartDate, Date aggregationEndDate,
         OrganisationUnit organisationUnit )
     {
         double[] sums = getSumAndRelevantDays( dataElement.getId(), optionCombo.getId(), aggregationStartDate, aggregationEndDate, 
             organisationUnit.getId() );
 
-        if ( sums[1] > 0 )
-        {
-            return sums[0];
-        }
-        else
-        {
-            return AggregationService.NO_VALUES_REGISTERED;
-        }
+        return sums[1] > 0 ? sums[0] : null;
     }
     
     protected Collection<DataValue> getDataValues( int dataElementId, int optionComboId, int organisationUnitId,

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/indicator/IndicatorAggregation.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/indicator/IndicatorAggregation.java	2010-07-04 11:02:28 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/indicator/IndicatorAggregation.java	2010-07-10 14:50:48 +0000
@@ -37,7 +37,6 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.aggregation.impl.cache.AggregationCache;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -85,7 +84,7 @@
     // Indicator aggregation
     // -------------------------------------------------------------------------
     
-    public double getAggregatedIndicatorValue( Indicator indicator, Date startDate, Date endDate,
+    public Double getAggregatedIndicatorValue( Indicator indicator, Date startDate, Date endDate,
         OrganisationUnit organisationUnit )
     {
         double numeratorValue = calculateExpression( generateExpression( indicator.getNumerator(), startDate,
@@ -96,7 +95,7 @@
         
         if ( numeratorValue == INVALID || denominatorValue == INVALID || denominatorValue == 0.0 )
         {
-            return AggregationService.NO_VALUES_REGISTERED;
+            return null;
         }
         else
         {
@@ -175,9 +174,9 @@
                 
                 DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
 
-                double aggregatedValue = aggregationCache.getAggregatedDataValue( dataElement, optionCombo, startDate, endDate, organisationUnit );                
+                Double aggregatedValue = aggregationCache.getAggregatedDataValue( dataElement, optionCombo, startDate, endDate, organisationUnit );                
                 
-                if ( aggregatedValue == AggregationService.NO_VALUES_REGISTERED )
+                if ( aggregatedValue == null )
                 {
                     replaceString = NULL_REPLACEMENT;
                 }

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateDataElementChartAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateDataElementChartAction.java	2010-05-28 09:47:41 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateDataElementChartAction.java	2010-07-10 14:50:48 +0000
@@ -86,20 +86,20 @@
 
             keys.add( dataElement.getName() );
 
-            double value = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
+            Double value = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
                 period.getEndDate(), organisationUnit );
             
-            double total = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
+            Double total = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
                 period.getEndDate(), organisationUnit.getParent() );
 
-            if ( value == AggregationService.NO_VALUES_REGISTERED )
+            if ( value == null )
             {
-                value = 0;
+                value = 0.0;
             }
             
-            if ( total == AggregationService.NO_VALUES_REGISTERED )
+            if ( total == null )
             {
-                total = 0;
+                total = 0.0;
             }
             
             

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateIndicatorChartAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateIndicatorChartAction.java	2010-05-28 09:47:41 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateIndicatorChartAction.java	2010-07-10 14:50:48 +0000
@@ -31,7 +31,6 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -76,20 +75,20 @@
 
             keys.add( indicator.getName() );
 
-            double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period
+            Double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period
                 .getEndDate(), organisationUnit );
             
-            double total = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period
+            Double total = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period
                 .getEndDate(), organisationUnit.getParent() );
 
-            if ( value == AggregationService.NO_VALUES_REGISTERED )
+            if ( value == null )
             {
-                value = 0;
+                value = 0.0;
             }
 
-            if ( total == AggregationService.NO_VALUES_REGISTERED )
+            if ( total == null )
             {
-                total = 0;
+                total = 0.0;
             }
 
             List<Double> values_ = new ArrayList<Double>();

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationDEChartAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationDEChartAction.java	2010-06-22 08:04:26 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationDEChartAction.java	2010-07-10 14:50:48 +0000
@@ -31,7 +31,6 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -106,14 +105,14 @@
             
             keys.add( organisationUnit.getName() );
 
-            double value = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
+            Double value = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
                 period.getEndDate(), organisationUnit );
 
-            double total = AggregationService.NO_VALUES_REGISTERED;
+            Double total = 0.0; //TODO review...
 
-            if ( value == AggregationService.NO_VALUES_REGISTERED )
+            if ( value == null )
             {
-                value = 0;
+                value = 0.0;
             }
 
             List<Double> values_ = new ArrayList<Double>();

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationInChartAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationInChartAction.java	2010-06-22 08:04:26 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationInChartAction.java	2010-07-10 14:50:48 +0000
@@ -94,14 +94,14 @@
             
             keys.add( organisationUnit.getName() );
 
-            double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(),
+            Double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(),
                 period.getEndDate(), organisationUnit);
 
-            double total = AggregationService.NO_VALUES_REGISTERED;
+            Double total = null; //TODO review...
 
-            if ( value == AggregationService.NO_VALUES_REGISTERED )
+            if ( value == null )
             {
-                value = 0;
+                value = 0.0;
             }
 
             List<Double> values_ = new ArrayList<Double>();

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GeneratePeriodsDEChartAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GeneratePeriodsDEChartAction.java	2010-05-28 09:47:41 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GeneratePeriodsDEChartAction.java	2010-07-10 14:50:48 +0000
@@ -31,7 +31,6 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -96,20 +95,20 @@
 
             keys.add( name );
 
-            double value = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
+            Double value = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
                 period.getEndDate(), organisationUnit );
 
-            double total = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
+            Double total = aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(),
                 period.getEndDate(), organisationUnit.getParent() );
 
-            if ( value == AggregationService.NO_VALUES_REGISTERED )
+            if ( value == null )
             {
-                value = 0;
+                value = 0.0;
             }
 
-            if ( total == AggregationService.NO_VALUES_REGISTERED )
+            if ( total == null )
             {
-                total = 0;
+                total = 0.0;
             }
 
             List<Double> values_ = new ArrayList<Double>();

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GeneratePeriodsInChartAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GeneratePeriodsInChartAction.java	2010-06-15 03:12:16 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GeneratePeriodsInChartAction.java	2010-07-10 14:50:48 +0000
@@ -31,7 +31,6 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -89,20 +88,20 @@
             System.out.println("Period:" + period);
             System.out.println("Organisation Unit:" + organisationUnit.getName());
 
-            double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period
+            Double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period
                 .getEndDate(), organisationUnit );
             
-            double total = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period
+            Double total = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period
                 .getEndDate(), organisationUnit.getParent() );
 
-            if ( value == AggregationService.NO_VALUES_REGISTERED )
+            if ( value == null )
             {
-                value = 0;
+                value = 0.0;
             }
 
-            if ( total == AggregationService.NO_VALUES_REGISTERED )
+            if ( total == null )
             {
-                total = 0;
+                total = 0.0;
             }
 
             List<Double> values_ = new ArrayList<Double>();

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java	2010-07-02 10:12:52 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java	2010-07-10 14:50:48 +0000
@@ -539,10 +539,10 @@
 
                 Indicator indicator = indicatorService.getIndicator( indicatorId );
 
-                double aggregatedValue = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate,
+                Double aggregatedValue = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate,
                     organisationUnit );
 
-                if ( aggregatedValue == AggregationService.NO_VALUES_REGISTERED )
+                if ( aggregatedValue == null )
                 {
                     replaceString = NULL_REPLACEMENT;
                 }
@@ -706,12 +706,12 @@
     private double getValue( DataElement dataElement, DataElementCategoryOptionCombo optionCombo,
         OrganisationUnit organisationUnit, Date startDate, Date endDate )
     {
-        double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo, startDate,
+        Double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo, startDate,
             endDate, organisationUnit );
 
-        if ( dataElement.isZeroIsSignificant() && aggregatedValue == AggregationService.NO_VALUES_REGISTERED )
+        if ( dataElement.isZeroIsSignificant() && aggregatedValue == null )
         {
-            aggregatedValue = 0;
+            aggregatedValue = 0.0;
         }
 
         return aggregatedValue;

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelUtils.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelUtils.java	2010-07-02 10:12:52 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelUtils.java	2010-07-10 14:50:48 +0000
@@ -40,7 +40,6 @@
 import jxl.write.WritableSheet;
 import jxl.write.WriteException;
 import jxl.write.biff.RowsExceededException;
-import org.hisp.dhis.aggregation.AggregationService;
 
 /**
  * @author Tran Thanh Tri
@@ -57,8 +56,6 @@
 
     public static final String ZERO = "0.0";
     
-    private static final String  NO_VALUES_REGISTERED = String.valueOf( AggregationService.NO_VALUES_REGISTERED );
-
     public static final String TEXT = "TEXT";
 
     public static final String NUMBER = "NUMBER";
@@ -242,7 +239,7 @@
             }
             else if ( type.equalsIgnoreCase( ExcelUtils.NUMBER ) )
             {
-                if ( value.equals( NO_VALUES_REGISTERED  ) )
+                if ( value == null )
                 {
                     cellPOI.setCellType( POI_CELLSTYLE_BLANK );
                 }
@@ -285,7 +282,7 @@
             }
             else if ( type.equalsIgnoreCase( ExcelUtils.NUMBER ) )
             {
-                if ( value.equals( NO_VALUES_REGISTERED  ) )
+                if ( value == null  )
                 {
                     cellPOI.setCellType( POI_CELLSTYLE_BLANK );
                 }