← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15577: minor fix

 

------------------------------------------------------------
revno: 15577
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-06-06 19:38:09 +0200
message:
  minor fix
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-06-06 11:59:40 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFilterService.java	2014-06-06 17:38:09 +0000
@@ -125,7 +125,7 @@
         return collectionNode;
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     private ComplexNode buildObjectOutput( Map<String, Map> fieldMap, Object object )
     {
         if ( object == null )
@@ -238,11 +238,11 @@
     private void updateFields( Map<String, Map> fieldMap, Object object )
     {
         // we need two run this (at least) two times, since some of the presets might contain other presets
-        _updateFields( fieldMap, object );
-        _updateFields( fieldMap, object );
+        _updateFields( fieldMap, object, true );
+        _updateFields( fieldMap, object, false );
     }
 
-    private void _updateFields( Map<String, Map> fieldMap, Object object )
+    private void _updateFields( Map<String, Map> fieldMap, Object object, boolean expandOnly )
     {
         Schema schema = schemaService.getDynamicSchema( object.getClass() );
 
@@ -276,7 +276,7 @@
 
                 cleanupFields.add( fieldKey );
             }
-            else if ( fieldKey.startsWith( "!" ) )
+            else if ( fieldKey.startsWith( "!" ) && !expandOnly )
             {
                 cleanupFields.add( fieldKey );
             }
@@ -285,7 +285,11 @@
         for ( String ignore : cleanupFields )
         {
             fieldMap.remove( ignore );
-            fieldMap.remove( ignore.substring( 1 ) );
+
+            if ( !expandOnly )
+            {
+                fieldMap.remove( ignore.substring( 1 ) );
+            }
         }
     }
 
@@ -363,7 +367,7 @@
         return complexNode;
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     private <T> boolean evaluateWithFilters( T object, Filters filters )
     {
         Schema schema = schemaService.getDynamicSchema( object.getClass() );