← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22021: minor fix, make sure to always fully expand User.UserCredentials if no field filter is given

 

------------------------------------------------------------
revno: 22021
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-02-23 11:33:11 +0700
message:
  minor fix, make sure to always fully expand User.UserCredentials if no field filter is given
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fieldfilter/DefaultFieldFilterService.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-core/src/main/java/org/hisp/dhis/fieldfilter/DefaultFieldFilterService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fieldfilter/DefaultFieldFilterService.java	2016-02-12 04:35:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fieldfilter/DefaultFieldFilterService.java	2016-02-23 04:33:11 +0000
@@ -46,6 +46,7 @@
 import org.hisp.dhis.schema.Schema;
 import org.hisp.dhis.schema.SchemaService;
 import org.hisp.dhis.system.util.ReflectionUtils;
+import org.hisp.dhis.user.UserCredentials;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.Assert;
 import org.springframework.util.StringUtils;
@@ -230,7 +231,7 @@
                     child = new CollectionNode( property.getCollectionName() );
                     child.setNamespace( property.getNamespace() );
 
-                    if ( property.isIdentifiableObject() && !DataElementOperand.class.isAssignableFrom( property.getItemKlass() ) )
+                    if ( property.isIdentifiableObject() && isProperIdObject( property.getItemKlass() ) )
                     {
                         for ( Object collectionObject : collection )
                         {
@@ -263,7 +264,7 @@
                         }
                     }
                 }
-                else if ( property.isIdentifiableObject() && !DataElementOperand.class.isAssignableFrom( property.getKlass() ) )
+                else if ( property.isIdentifiableObject() && isProperIdObject( property.getKlass() ) )
                 {
                     child = getProperties( property, returnValue, fields );
                 }
@@ -485,4 +486,9 @@
 
         return complexNode;
     }
+
+    private boolean isProperIdObject( Class<?> klass )
+    {
+        return !(DataElementOperand.class.isAssignableFrom( klass ) || UserCredentials.class.isAssignableFrom( klass ));
+    }
 }