← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15249: removed restriction on filters, allow for filtering of non-idobjects with exported properties

 

------------------------------------------------------------
revno: 15249
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-05-13 11:15:36 +0200
message:
  removed restriction on filters, allow for filtering of non-idobjects with exported properties
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFilterService.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-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFilterService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFilterService.java	2014-04-14 06:43:16 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFilterService.java	2014-05-13 09:15:36 +0000
@@ -263,7 +263,7 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    private <T extends IdentifiableObject> boolean evaluateWithFilters( T object, Filters filters )
+    private <T> boolean evaluateWithFilters( T object, Filters filters )
     {
         Map<String, Property> propertiesMap = propertyIntrospectorService.getPropertiesMap( object.getClass() );
 
@@ -309,27 +309,27 @@
                     map.remove( "__self__" );
                 }
 
-                if ( descriptor.isIdentifiableObject() && !descriptor.isCollection() )
+                if ( !descriptor.isCollection() )
                 {
-                    if ( !evaluateWithFilters( (IdentifiableObject) value, f ) )
+                    if ( !evaluateWithFilters( value, f ) )
                     {
                         return false;
                     }
                 }
-                else if ( descriptor.isIdentifiableObject() )
+                else
                 {
-                    Collection<?> idObjectCollection = (Collection<?>) value;
+                    Collection<?> objectCollection = (Collection<?>) value;
 
-                    if ( idObjectCollection.isEmpty() )
+                    if ( objectCollection.isEmpty() )
                     {
                         return false;
                     }
 
                     boolean include = false;
 
-                    for ( Object idObject : idObjectCollection )
+                    for ( Object idObject : objectCollection )
                     {
-                        if ( evaluateWithFilters( (IdentifiableObject) idObject, f ) )
+                        if ( evaluateWithFilters( idObject, f ) )
                         {
                             include = true;
                         }