← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22064: minor adjustment to default field filters, if schema is -not- persisted default to show all, if s...

 

------------------------------------------------------------
revno: 22064
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2016-02-27 18:03:16 +0700
message:
  minor adjustment to default field filters, if schema is -not- persisted default to show all, if schema is persisted, default to :owner
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fieldfilter/DefaultFieldFilterService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.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-24 04:40:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fieldfilter/DefaultFieldFilterService.java	2016-02-27 11:03:16 +0000
@@ -433,7 +433,18 @@
     private FieldMap getFullFieldMap( Schema schema )
     {
         FieldMap fieldMap = new FieldMap();
-        fieldMap.put( ":owner", new FieldMap() );
+
+        if ( schema.isPersisted() )
+        {
+            fieldMap.put( ":owner", new FieldMap() );
+        }
+        else
+        {
+            for ( String mapKey : schema.getPropertyMap().keySet() )
+            {
+                fieldMap.put( mapKey, new FieldMap() );
+            }
+        }
 
         return fieldMap;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java	2016-02-27 03:14:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java	2016-02-27 11:03:16 +0000
@@ -96,7 +96,7 @@
 
         if ( fields.isEmpty() )
         {
-            fields.add( "*,authorities[*],properties[*,constants[*]]" );
+            fields.add( "*" );
         }
 
         Schemas schemas = new Schemas( schemaService.getSortedSchemas() );
@@ -117,7 +117,7 @@
 
         if ( fields.isEmpty() )
         {
-            fields.add( "*,authorities[*],properties[*,constants[*]]" );
+            fields.add( "*" );
         }
 
         Schema schema = getSchemaFromType( type );