← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20874: minor geojson update, use geojson compatible feature types

 

------------------------------------------------------------
revno: 20874
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-26 08:15:36 +0800
message:
  minor geojson update, use geojson compatible feature types
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/FeatureType.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.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/organisationunit/FeatureType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/FeatureType.java	2015-10-19 10:28:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/FeatureType.java	2015-10-26 00:15:36 +0000
@@ -37,11 +37,23 @@
 @JacksonXmlRootElement( localName = "featureType", namespace = DxfNamespaces.DXF_2_0 )
 public enum FeatureType
 {
-    NONE,
-    MULTI_POLYGON,
-    POLYGON,
-    POINT,
-    SYMBOL;
+    NONE( "None" ),
+    MULTI_POLYGON( "MultiPolygon" ),
+    POLYGON( "Polygon" ),
+    POINT( "Point" ),
+    SYMBOL( "Symbol" );
+
+    String value;
+
+    FeatureType( String value )
+    {
+        this.value = value;
+    }
+
+    public String value()
+    {
+        return value;
+    }
 
     public boolean isPolygon()
     {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java	2015-10-23 11:16:46 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java	2015-10-26 00:15:36 +0000
@@ -28,16 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.google.common.collect.Lists;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.dxf2.common.TranslateParams;
 import org.hisp.dhis.organisationunit.FeatureType;
@@ -62,9 +55,14 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.google.common.collect.Lists;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -119,7 +117,7 @@
             OrganisationUnitQueryParams params = new OrganisationUnitQueryParams();
             params.setLevel( level );
             params.setMaxLevels( maxLevel );
-                        
+
             entityList = organisationUnitService.getOrganisationUnitsByQuery( params );
         }
         else if ( levelSorted )
@@ -288,7 +286,7 @@
         generator.writeStringField( "id", organisationUnit.getUid() );
 
         generator.writeObjectFieldStart( "geometry" );
-        generator.writeObjectField( "featureType", featureType.toString() );
+        generator.writeObjectField( "type", featureType.value() );
 
         generator.writeFieldName( "coordinates" );
         generator.writeRawValue( organisationUnit.getCoordinates() );