← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19137: add parameter to geoFeatureController, includeGroupSets=true/false, can be used instead of viewCl...

 

------------------------------------------------------------
revno: 19137
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-05-12 09:41:38 +0700
message:
  add parameter to geoFeatureController, includeGroupSets=true/false, can be used instead of viewClass=detailed
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.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/mapping/GeoFeatureController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java	2015-03-26 14:25:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java	2015-05-12 02:41:38 +0000
@@ -54,7 +54,6 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -93,7 +92,7 @@
 
     @Autowired
     private RenderService renderService;
-    
+
     @Autowired
     private CurrentUserService currentUserService;
 
@@ -101,11 +100,12 @@
     public void getGeoFeaturesJson(
         @RequestParam String ou,
         @RequestParam( required = false ) DisplayProperty displayProperty,
+        @RequestParam( defaultValue = "false", value = "includeGroupSets" ) boolean rpIncludeGroupSets,
         @RequestParam Map<String, String> parameters,
         HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         WebOptions options = new WebOptions( parameters );
-        boolean includeGroupSets = "detailed".equals( options.getViewClass() );
+        boolean includeGroupSets = "detailed".equals( options.getViewClass() ) || rpIncludeGroupSets;
 
         List<GeoFeature> features = getGeoFeatures( ou, displayProperty, request, response, includeGroupSets );
         if ( features == null ) return;
@@ -119,11 +119,12 @@
         @RequestParam String ou,
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( defaultValue = "callback" ) String callback,
+        @RequestParam( defaultValue = "false", value = "includeGroupSets" ) boolean rpIncludeGroupSets,
         @RequestParam Map<String, String> parameters,
         HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         WebOptions options = new WebOptions( parameters );
-        boolean includeGroupSets = "detailed".equals( options.getViewClass() );
+        boolean includeGroupSets = "detailed".equals( options.getViewClass() ) || rpIncludeGroupSets;
 
         List<GeoFeature> features = getGeoFeatures( ou, displayProperty, request, response, includeGroupSets );
         if ( features == null ) return;
@@ -137,7 +138,7 @@
         Set<String> set = new HashSet<>();
         set.add( ou );
 
-        DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, 
+        DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null,
             false, false, false, false, false, false, displayProperty, null, null, null );
 
         DimensionalObject dim = params.getDimension( DimensionalObject.ORGUNIT_DIM_ID );
@@ -158,7 +159,7 @@
         List<GeoFeature> features = new ArrayList<>();
 
         Set<OrganisationUnit> roots = currentUserService.getCurrentUser().getDataViewOrganisationUnitsWithFallback();
-        
+
         for ( OrganisationUnit organisationUnit : organisationUnits )
         {
             GeoFeature feature = new GeoFeature();