← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10642: Applied validation to import of data values through web api

 

------------------------------------------------------------
revno: 10642
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-04-19 18:05:26 +0200
message:
  Applied validation to import of data values through web api
modified:
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.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-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2013-03-15 16:33:34 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2013-04-19 16:05:26 +0000
@@ -78,6 +78,7 @@
 import org.hisp.dhis.system.notification.Notifier;
 import org.hisp.dhis.system.util.DateUtils;
 import org.hisp.dhis.system.util.DebugUtils;
+import org.hisp.dhis.system.util.ValidationUtils;
 import org.hisp.dhis.user.CurrentUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -351,6 +352,14 @@
             {
                 continue;
             }
+            
+            String valueValid = ValidationUtils.dataValueIsValid( dataValue.getValue(), dataElement );
+            
+            if ( valueValid != null )
+            {
+                summary.getConflicts().add( new ImportConflict( DataValue.class.getSimpleName(), valueValid ) );
+                continue;
+            }
 
             if ( periodMap.containsKey( dataValue.getPeriod() ) )
             {