← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2337: Inserting null in reporting tables rather than 0 where there are no data

 

------------------------------------------------------------
revno: 2337
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-12-10 23:00:25 +0100
message:
  Inserting null in reporting tables rather than 0 where there are no data
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.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-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2010-12-10 19:33:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2010-12-10 22:00:25 +0000
@@ -75,7 +75,6 @@
 {
     private static final Log log = LogFactory.getLog( DefaultReportTableService.class );
     
-    private static final String NULL_REPLACEMENT = "0.0";
     private static final String MODE_REPORT = "report";
     private static final String MODE_REPORT_TABLE = "table";
 
@@ -499,7 +498,7 @@
                         
                         for ( String identifier : reportTable.getCrossTabIdentifiers() )
                         {
-                            grid.addValue( parseAndReplaceNull( map.get( identifier ) ) );
+                            grid.addValue( valueOf( map.get( identifier ) ) );
                         }
                         
                         // -----------------------------------------------------
@@ -510,11 +509,11 @@
                         {
                             for ( DimensionOption dimensionOption : reportTable.getDimensionOptions() )
                             {
-                                grid.addValue( String.valueOf( aggregatedDataValueService.
+                                grid.addValue( valueOf( aggregatedDataValueService.
                                     getAggregatedValue( (DataElement) metaObject, dimensionOption, period, unit ) ) );
                             }
                             
-                            grid.addValue( String.valueOf( aggregatedDataValueService.getAggregatedValue( (DataElement) metaObject, period, unit ) ) );
+                            grid.addValue( valueOf( aggregatedDataValueService.getAggregatedValue( (DataElement) metaObject, period, unit ) ) );
                         }
                     }
                 }
@@ -525,14 +524,14 @@
     }
     
     /**
-     * Converts the given Double to String or replaces with default value if null.
+     * Converts the given Double to String.
      * 
      * @param value the Double.
      * @return the String.
      */
-    private String parseAndReplaceNull( Double value )
+    private String valueOf( Double value )
     {
-        return value != null ? String.valueOf( value ) : NULL_REPLACEMENT;
+        return value != null ? String.valueOf( value ) : null;
     }
     
     /**