dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38973
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19786: support fields filtering in /api/dimensions/constraints
------------------------------------------------------------
revno: 19786
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-19 12:48:15 +0700
message:
support fields filtering in /api/dimensions/constraints
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.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/DimensionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java 2015-07-13 09:52:25 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java 2015-08-19 05:48:15 +0000
@@ -130,21 +130,20 @@
}
@RequestMapping( value = "/constraints", method = RequestMethod.GET )
- public String getDimensionConstraints( @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links,
- Model model )
+ public @ResponseBody RootNode getDimensionConstraints( @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links )
{
- WebMetaData metaData = new WebMetaData();
-
- metaData.setDimensions( dimensionService.getDimensionConstraints() );
-
- model.addAttribute( "model", metaData );
+ List<String> fields = Lists.newArrayList( contextService.getParameterValues( "fields" ) );
+ List<DimensionalObject> dimensionConstraints = dimensionService.getDimensionConstraints();
if ( links )
{
- linkService.generateLinks( metaData, false );
+ linkService.generateLinks( dimensionConstraints, false );
}
- return "dimensions";
+ RootNode rootNode = NodeUtils.createMetadata();
+ rootNode.addChild( fieldFilterService.filter( getEntityClass(), dimensionConstraints, fields ) );
+
+ return rootNode;
}
@RequestMapping( value = "/dataSet/{uid}", method = RequestMethod.GET )