← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5002: Data mart, filtering invalid values during crosstab

 

------------------------------------------------------------
revno: 5002
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-10-22 15:49:10 +0200
message:
  Data mart, filtering invalid values during crosstab
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.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/crosstab/DefaultCrossTabService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2011-10-22 08:41:00 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2011-10-22 13:49:10 +0000
@@ -27,6 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.datavalue.DataValue.FALSE;
+import static org.hisp.dhis.datavalue.DataValue.TRUE;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -147,6 +150,19 @@
                         log.warn( "Value ignored, too long: '" + value + "'" );                                
                         value = null;
                     }
+                    
+                    if ( value != null && !TRUE.equalsIgnoreCase( value ) && !FALSE.equalsIgnoreCase( value ) )
+                    {
+                        try
+                        {
+                            Double.parseDouble( value );
+                        }
+                        catch ( NumberFormatException ex )
+                        {
+                            log.warn( "Value ignored, not numeric: '" + value + "'" );
+                            value = null;
+                        }
+                    }
 
                     if ( value != null )
                     {