← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16807: Upgraded to quick 1.8. Data value set import, deleting value if update and value is null.

 

------------------------------------------------------------
revno: 16807
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-09-24 19:24:34 +0200
message:
  Upgraded to quick 1.8. Data value set import, deleting value if update and value is null.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
  dhis-2/pom.xml


--
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/datavalue/DataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2014-09-24 14:52:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2014-09-24 17:24:34 +0000
@@ -32,6 +32,7 @@
 import java.util.Date;
 import java.util.regex.Pattern;
 
+import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.common.ImportableObject;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -183,7 +184,7 @@
      */
     public boolean isNullValue()
     {
-        return value == null && comment == null;
+        return StringUtils.trimToNull( value ) == null && StringUtils.trimToNull( comment ) == null;
     }
 
     public boolean isFollowup()

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2014-09-24 14:52:15 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2014-09-24 17:24:34 +0000
@@ -686,7 +686,14 @@
                 {
                     if ( !dryRun )
                     {
-                        batchHandler.updateObject( internalValue );
+                        if ( !internalValue.isNullValue() )
+                        {
+                            batchHandler.updateObject( internalValue );
+                        }
+                        else
+                        {
+                            batchHandler.deleteObject( internalValue );
+                        }
                     }
 
                     updateCount++;

=== modified file 'dhis-2/pom.xml'
--- dhis-2/pom.xml	2014-09-14 18:33:11 +0000
+++ dhis-2/pom.xml	2014-09-24 17:24:34 +0000
@@ -557,7 +557,7 @@
       <dependency>
         <groupId>org.amplecode</groupId>
         <artifactId>quick</artifactId>
-        <version>1.7.1</version>
+        <version>1.8</version>
       </dependency>
       <dependency>
         <groupId>com.lowagie</groupId>