← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15621: allow filter on /api/type/uid endpoint, only really useful in cases where the endpoint returns mo...

 

------------------------------------------------------------
revno: 15621
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-06-11 13:18:03 +0200
message:
  allow filter on /api/type/uid endpoint, only really useful in cases where the endpoint returns more than one result, and you want additional filtering
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.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/webapi/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java	2014-06-11 11:13:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java	2014-06-11 11:18:03 +0000
@@ -196,6 +196,7 @@
         Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
         List<String> fields = Lists.newArrayList( contextService.getParameterValues( "fields" ) );
+        List<String> filters = Lists.newArrayList( contextService.getParameterValues( "filter" ) );
 
         if ( fields.isEmpty() )
         {
@@ -210,6 +211,8 @@
             throw new NotFoundException( uid );
         }
 
+        entities = filterService.objectFilter( entities, filters );
+
         if ( options.hasLinks() )
         {
             linkService.generateLinks( entities );