dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33504
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17108: Display property for geo feature resource
------------------------------------------------------------
revno: 17108
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-10-14 13:20:24 +0200
message:
Display property for geo feature resource
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 2014-10-13 10:23:17 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java 2014-10-14 11:20:24 +0000
@@ -32,6 +32,7 @@
import org.hisp.dhis.analytics.AnalyticsService;
import org.hisp.dhis.analytics.DataQueryParams;
import org.hisp.dhis.common.DimensionalObject;
+import org.hisp.dhis.common.DisplayProperty;
import org.hisp.dhis.common.NameableObjectUtils;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -86,7 +87,10 @@
private OrganisationUnitGroupService organisationUnitGroupService;
@RequestMapping( method = RequestMethod.GET, produces = "application/json" )
- public void getGeoFeatures( @RequestParam String ou, @RequestParam Map<String, String> parameters,
+ public void getGeoFeatures(
+ @RequestParam String ou,
+ @RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam Map<String, String> parameters,
HttpServletRequest request, HttpServletResponse response ) throws IOException
{
WebOptions options = new WebOptions( parameters );
@@ -95,7 +99,7 @@
Set<String> set = new HashSet<>();
set.add( ou );
- DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, false, false, false, false, false, false, null, null );
+ DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, false, false, false, false, false, false, displayProperty, null );
DimensionalObject dim = params.getDimension( DimensionalObject.ORGUNIT_DIM_ID );
@@ -118,7 +122,6 @@
{
GeoFeature feature = new GeoFeature();
feature.setId( unit.getUid() );
- feature.setNa( unit.getDisplayName() ); //TODO short name
feature.setHcd( unit.hasChildrenWithCoordinates() );
feature.setHcu( unit.hasCoordinatesUp() );
feature.setLe( unit.getLevel() );
@@ -127,6 +130,15 @@
feature.setPn( unit.getParent() != null ? unit.getParent().getDisplayName() : null );
feature.setTy( FEATURE_TYPE_MAP.get( unit.getFeatureType() ) );
feature.setCo( unit.getCoordinates() );
+
+ if ( DisplayProperty.SHORTNAME.equals( params.getDisplayProperty() ) )
+ {
+ feature.setNa( unit.getDisplayShortName() );
+ }
+ else
+ {
+ feature.setNa( unit.getDisplayName() );
+ }
if ( includeGroupSets )
{