dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30646
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15571: minor fixes
------------------------------------------------------------
revno: 15571
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-06-06 13:09:36 +0200
message:
minor fixes
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFilterService.java
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-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 07:40:49 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFilterService.java 2014-06-06 11:09:36 +0000
@@ -85,6 +85,11 @@
public <T extends IdentifiableObject> CollectionNode fieldFilter( Class<?> klass, List<T> objects,
List<String> fieldList )
{
+ if ( objects.isEmpty() )
+ {
+ return null;
+ }
+
String fields = fieldList == null ? "" : Joiner.on( "," ).join( fieldList );
Schema rootSchema = schemaService.getDynamicSchema( klass );
@@ -154,7 +159,22 @@
if ( fieldValue.isEmpty() )
{
- if ( !property.isIdentifiableObject() )
+ if ( property.isCollection() )
+ {
+ if ( property.isIdentifiableObject() )
+ {
+ complexNode.addChild( getCollectionProperties( returnValue, FilterService.FIELD_PRESETS.get( "identifiable" ), property ) );
+ }
+ else
+ {
+ complexNode.addChild( getCollectionProperties( returnValue, Lists.newArrayList( propertySchema.getPropertyMap().keySet() ), property ) );
+ }
+ }
+ else if ( property.isIdentifiableObject() )
+ {
+ complexNode.addChild( getProperties( returnValue, FilterService.FIELD_PRESETS.get( "identifiable" ) ) );
+ }
+ else
{
if ( propertySchema.getProperties().isEmpty() )
{
@@ -169,14 +189,6 @@
complexNode.addChild( buildObjectOutput( getFullFieldMap( propertySchema ), returnValue ) );
}
}
- else if ( !property.isCollection() )
- {
- complexNode.addChild( getProperties( returnValue, FilterService.FIELD_PRESETS.get( "identifiable" ) ) );
- }
- else
- {
- complexNode.addChild( getCollectionProperties( returnValue, FilterService.FIELD_PRESETS.get( "identifiable" ), property ) );
- }
}
else
{
=== 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-06 07:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2014-06-06 11:09:36 +0000
@@ -129,7 +129,7 @@
if ( fields.isEmpty() )
{
- fields = FilterService.FIELD_PRESETS.get( "identifiable" );
+ fields.add( ":identifiable" );
}
boolean hasPaging = options.hasPaging();
@@ -164,7 +164,7 @@
postProcessEntities( entityList );
postProcessEntities( entityList, options, parameters );
- if ( fields != null && fields.contains( "access" ) )
+ if ( fields.contains( "access" ) )
{
options.getOptions().put( "viewClass", "sharing" );
}
@@ -199,7 +199,7 @@
if ( fields.isEmpty() )
{
- fields.add( "*" );
+ fields.add( ":all" );
}
WebOptions options = new WebOptions( parameters );