dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31024
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15778: Minor fix, return empty collectionNode if an empty collection was given
------------------------------------------------------------
revno: 15778
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-06-20 11:10:42 +0200
message:
Minor fix, return empty collectionNode if an empty collection was given
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/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-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFieldFilterService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFieldFilterService.java 2014-06-20 09:09:40 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFieldFilterService.java 2014-06-20 09:10:42 +0000
@@ -95,15 +95,18 @@
@Override
public <T extends IdentifiableObject> CollectionNode filter( Class<?> klass, List<T> objects, List<String> fieldList )
{
- if ( objects == null || objects.isEmpty() )
- {
- return null;
- }
-
String fields = fieldList == null ? "" : Joiner.on( "," ).join( fieldList );
Schema rootSchema = schemaService.getDynamicSchema( klass );
+ CollectionNode collectionNode = new CollectionNode( rootSchema.getCollectionName() );
+ collectionNode.setNamespace( rootSchema.getNamespace() );
+
+ if ( objects == null || objects.isEmpty() )
+ {
+ return collectionNode;
+ }
+
FieldMap fieldMap = new FieldMap();
Schema schema = schemaService.getDynamicSchema( objects.get( 0 ).getClass() );
@@ -119,9 +122,6 @@
fieldMap = parserService.parseFieldFilter( fields );
}
- CollectionNode collectionNode = new CollectionNode( rootSchema.getCollectionName() );
- collectionNode.setNamespace( rootSchema.getNamespace() );
-
for ( Object object : objects )
{
collectionNode.addChild( buildComplexNode( fieldMap, klass, object ) );