← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13885: support IN operator in person search

 

------------------------------------------------------------
revno: 13885
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-28 19:22:12 +0700
message:
  support IN operator in person search
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2014-01-28 12:12:50 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2014-01-28 12:22:12 +0000
@@ -165,7 +165,7 @@
 
             if ( split.length != 3 )
             {
-                throw new HttpClientErrorException( HttpStatus.BAD_REQUEST, "Filter " + filter + " is not in valid format." +
+                throw new HttpClientErrorException( HttpStatus.BAD_REQUEST, "Filter " + filter + " is not in valid format. " +
                     "Valid syntax is attribute=ATTRIBUTE_UID:OPERATOR:VALUE." );
             }
 
@@ -218,6 +218,15 @@
                     Restrictions.ge( "attributeValue.value", split[2] )
                 ) );
             }
+            else if ( "in".equals( split[1].toLowerCase() ) )
+            {
+                String[] in = split[2].split( ";" );
+
+                and.add( Restrictions.and(
+                    Restrictions.eq( "attribute.uid", split[0] ),
+                    Restrictions.in( "attributeValue.value", in )
+                ) );
+            }
         }
 
         criteria.addOrder( Order.desc( "lastUpdated" ) );