← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19768: don't expose dynamic schemas in /api/schemas

 

------------------------------------------------------------
revno: 19768
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-12 12:41:14 +0700
message:
  don't expose dynamic schemas in /api/schemas
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.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/schema/DefaultSchemaService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java	2015-07-13 11:12:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java	2015-08-12 05:41:14 +0000
@@ -50,9 +50,11 @@
  */
 public class DefaultSchemaService implements SchemaService
 {
-    private Map<Class<?>, Schema> classSchemaMap = Maps.newHashMap();
-
-    private Map<String, Schema> singularSchemaMap = Maps.newHashMap();
+    private Map<Class<?>, Schema> classSchemaMap = new HashMap<>();
+
+    private Map<String, Schema> singularSchemaMap = new HashMap<>();
+
+    private Map<Class<?>, Schema> dynamicClassSchemaMap = new HashMap<>();
 
     @Autowired
     private PropertyIntrospectorService propertyIntrospectorService;
@@ -104,6 +106,11 @@
             return classSchemaMap.get( klass );
         }
 
+        if ( dynamicClassSchemaMap.containsKey( klass ) )
+        {
+            return dynamicClassSchemaMap.get( klass );
+        }
+
         return null;
     }
 
@@ -133,7 +140,7 @@
 
         updateSelf( schema );
 
-        classSchemaMap.put( klass, schema );
+        dynamicClassSchemaMap.put( klass, schema );
 
         return schema;
     }