← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8532: getGeoJson request accepts and returns both internal id and uid.

 

------------------------------------------------------------
revno: 8532
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-10-15 13:21:06 +0200
message:
  getGeoJson request accepts and returns both internal id and uid.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonmin.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js


--
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-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java	2012-04-22 19:36:58 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java	2012-10-15 11:21:06 +0000
@@ -61,11 +61,11 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private Integer parentId;
+    private String parentId;
 
-    public void setParentId( Integer id )
+    public void setParentId( String parentId )
     {
-        this.parentId = id;
+        this.parentId = parentId;
     }
 
     private Integer level;
@@ -95,6 +95,17 @@
     {
         OrganisationUnit parent = organisationUnitService.getOrganisationUnit( parentId );
 
+        if ( parent == null )
+        {
+            try
+            {                
+                parent = organisationUnitService.getOrganisationUnit( Integer.parseInt( parentId ) );
+            }
+            catch ( NumberFormatException e )
+            {
+            }
+        }
+
         level = level == null ? organisationUnitService.getLevelOfOrganisationUnit( parent.getId() ) : level;
 
         Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitsAtLevel( level, parent );
@@ -124,4 +135,4 @@
 
         return SUCCESS;
     }
-}
\ No newline at end of file
+}

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonmin.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonmin.vm	2012-04-19 16:30:39 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonmin.vm	2012-10-15 11:21:06 +0000
@@ -1,1 +1,1 @@
-#set($size=$object.size())[#foreach($unit in $object){"t":#if(${unit.featureType}=="Point")"2"#else"1"#end,"c":$!encoder.jsonEncode($!{unit.validCoordinates}),"i":"$!{unit.id}","n":"$!encoder.jsonEncode(${unit.name})","h":$!{unit.hasChildrenWithCoordinates()}}#if($velocityCount<$size),#end#end]
\ No newline at end of file
+#set($size=$object.size())[#foreach($unit in $object){"t":#if(${unit.featureType}=="Point")"2"#else"1"#end,"c":$!encoder.jsonEncode($!{unit.validCoordinates}),"uid":"$!{unit.uid}","iid":$!{unit.id},"n":"$!encoder.jsonEncode(${unit.name})","h":$!{unit.hasChildrenWithCoordinates()}}#if($velocityCount<$size),#end#end]

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2012-03-26 13:00:42 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2012-10-15 11:21:06 +0000
@@ -602,7 +602,7 @@
                     coordinates: doc[i].c
                 },
                 properties: {
-                    id: doc[i].i,
+                    id: doc[i].iid,
                     name: doc[i].n,
                     value: doc[i].v,
                     hcwc: doc[i].h