← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13879: added operators ge, ne, gt, lt in person search

 

------------------------------------------------------------
revno: 13879
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-28 18:17:59 +0700
message:
  added operators ge, ne, gt, lt 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 11:08:31 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2014-01-28 11:17:59 +0000
@@ -189,6 +189,34 @@
                     Restrictions.eq( "attributeValue.value", split[2] )
                 ) );
             }
+            else if ( "ne".equals( split[1].toLowerCase() ) )
+            {
+                and.add( Restrictions.and(
+                    Restrictions.eq( "attribute.uid", split[0] ),
+                    Restrictions.ne( "attributeValue.value", split[2] )
+                ) );
+            }
+            else if ( "gt".equals( split[1].toLowerCase() ) )
+            {
+                and.add( Restrictions.and(
+                    Restrictions.eq( "attribute.uid", split[0] ),
+                    Restrictions.gt( "attributeValue.value", split[2] )
+                ) );
+            }
+            else if ( "lt".equals( split[1].toLowerCase() ) )
+            {
+                and.add( Restrictions.and(
+                    Restrictions.eq( "attribute.uid", split[0] ),
+                    Restrictions.gt( "attributeValue.value", split[2] )
+                ) );
+            }
+            else if ( "ge".equals( split[1].toLowerCase() ) )
+            {
+                and.add( Restrictions.and(
+                    Restrictions.eq( "attribute.uid", split[0] ),
+                    Restrictions.ge( "attributeValue.value", split[2] )
+                ) );
+            }
         }
 
         return personService.getPersons( criteria.list() );