dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30163
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15307: Added new web api method at api/dimensions/constraints for potential dimensional constraints
------------------------------------------------------------
revno: 15307
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-05-19 19:59:03 +0200
message:
Added new web api method at api/dimensions/constraints for potential dimensional constraints
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/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-api/src/main/java/org/hisp/dhis/common/DimensionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionService.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionService.java 2014-05-19 17:59:03 +0000
@@ -43,5 +43,7 @@
List<DimensionalObject> getAllDimensions();
+ List<DimensionalObject> getDimensionConstraints();
+
void mergeAnalyticalObject( BaseAnalyticalObject object );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java 2014-04-21 11:05:22 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java 2014-05-19 17:59:03 +0000
@@ -257,6 +257,19 @@
return dimensions;
}
+
+ public List<DimensionalObject> getDimensionConstraints()
+ {
+ Collection<CategoryOptionGroupSet> cogs = categoryService.getDataDimensionCategoryOptionGroupSets();
+ Collection<DataElementCategory> cs = categoryService.getAttributeCategories();
+
+ final List<DimensionalObject> dimensions = new ArrayList<DimensionalObject>();
+
+ dimensions.addAll( cogs );
+ dimensions.addAll( cs );
+
+ return dimensions;
+ }
@Override
public void mergeAnalyticalObject( BaseAnalyticalObject object )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DimensionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DimensionController.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DimensionController.java 2014-05-19 17:59:03 +0000
@@ -67,7 +67,7 @@
// Controller
// -------------------------------------------------------------------------
- @RequestMapping(value = "/{uid}", method = RequestMethod.GET)
+ @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
public String getDimension( @PathVariable("uid") String uid,
@RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links,
Model model )
@@ -85,7 +85,7 @@
return "dimension";
}
- @RequestMapping(value = "/{uid}/items", method = RequestMethod.GET)
+ @RequestMapping( value = "/{uid}/items", method = RequestMethod.GET )
public String getItems( @PathVariable String uid, @RequestParam Map<String, String> parameters,
Model model, HttpServletRequest request, HttpServletResponse response )
{
@@ -128,4 +128,23 @@
return "dimensions";
}
+
+ @RequestMapping( value = "/constraints", method = RequestMethod.GET )
+ public String getDimensionConstraints(
+ @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links,
+ Model model )
+ {
+ WebMetaData metaData = new WebMetaData();
+
+ metaData.setDimensions( dimensionService.getDimensionConstraints() );
+
+ model.addAttribute( "model", metaData );
+
+ if ( links )
+ {
+ WebUtils.generateLinks( metaData );
+ }
+
+ return "dimensions";
+ }
}