dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30688
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15601: minor addition to SchemaController, allow to get specific property by /api/schemas/{type}/{proper...
------------------------------------------------------------
revno: 15601
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-06-09 14:34:00 +0200
message:
minor addition to SchemaController, allow to get specific property by /api/schemas/{type}/{property-name}
modified:
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-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 2014-06-02 08:04:38 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java 2014-06-09 12:34:00 +0000
@@ -42,7 +42,7 @@
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@Controller
-@RequestMapping( value = "/schemas", method = RequestMethod.GET )
+@RequestMapping(value = "/schemas", method = RequestMethod.GET)
public class SchemaController
{
@Autowired
@@ -59,4 +59,17 @@
{
return schemaService.getSchemaBySingularName( type );
}
+
+ @RequestMapping(value = "/{type}/{property}")
+ public @ResponseBody Object getSchemaProperty( @PathVariable String type, @PathVariable String property )
+ {
+ Schema schema = schemaService.getSchemaBySingularName( type );
+
+ if ( schema.getPropertyMap().containsKey( property ) )
+ {
+ return schema.getPropertyMap().get( property );
+ }
+
+ return null;
+ }
}