← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7222: TR case-insensitive fix

 

------------------------------------------------------------
revno: 7222
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-06 16:10:19 +0200
message:
  TR case-insensitive fix
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.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-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-06-06 13:44:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-06-06 14:10:19 +0000
@@ -57,6 +57,8 @@
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
 
+import static org.hisp.dhis.system.util.TextUtils.*;
+
 /**
  * @author Abyot Asalefew
  * @version $Id$
@@ -320,19 +322,19 @@
         
         for ( Integer key : identifierKeys.keySet() )
         {
-            sql += operator + "identifier_" + key + identifierKeys.get( key ) + " ";
+            sql += operator + "lower(identifier_" + key + ") " + lower( identifierKeys.get( key ) ) + " ";
             operator = "and ";
         }
         
         for ( Integer key : attributeKeys.keySet() )
         {
-            sql += operator + "attribute_" + key + attributeKeys.get( key ) + " ";
+            sql += operator + "lower(attribute_" + key + ") " + lower( attributeKeys.get( key ) ) + " ";
             operator = "and ";
         }
         
         for ( Integer key : dataElementKeys.keySet() )
         {
-            sql += operator + "element_" + key + dataElementKeys.get( key ) + " ";
+            sql += operator + "lower(element_" + key + ") " + lower( dataElementKeys.get( key ) ) + " ";
             operator = "and ";
         }
 

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java	2012-04-13 22:28:40 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java	2012-06-06 14:10:19 +0000
@@ -192,4 +192,15 @@
     {
         return value != null ? Boolean.valueOf( value ) : null;
     }
+    
+    /**
+     * Null-safe method for converting the given string to lower-case.
+     * 
+     * @param string the string.
+     * @return the string in lower-case.
+     */
+    public static String lower( String string )
+    {
+        return string != null ? string.toLowerCase() : null;
+    }
 }