← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12793: GIS, fixed bug with initialize response when there are multiple org unit roots.

 

------------------------------------------------------------
revno: 12793
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-10-22 16:00:46 +0200
message:
  GIS, fixed bug with initialize response when there are multiple org unit roots.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm


--
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/InitializeAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java	2013-09-27 12:55:38 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java	2013-10-22 14:00:46 +0000
@@ -30,6 +30,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.api.utils.ContextUtils;
@@ -125,9 +126,9 @@
         return infrastructuralPeriodType;
     }
 
-    private Collection<OrganisationUnit> rootNodes;
+    private List<OrganisationUnit> rootNodes;
 
-    public Collection<OrganisationUnit> getRootNodes()
+    public List<OrganisationUnit> getRootNodes()
     {
         return rootNodes;
     }
@@ -168,7 +169,7 @@
 
         rootNodes = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( 1 ) );
 
-        if ( rootNodes.size() < 1 )
+        if ( rootNodes.isEmpty() )
         {
             rootNodes.add( new OrganisationUnit() );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm	2013-10-08 17:58:45 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm	2013-10-22 14:00:46 +0000
@@ -12,7 +12,7 @@
   "ou":"$currentUser.getOrganisationUnit().uid",
   "ouc":[#foreach($ou in $currentUser.getOrganisationUnit().getSortedChildren())"$ou.uid"#if($velocityCount < $oucSize),#end#end]
 },
-"rootNodes":[#foreach( $node in $rootNodes ){"id": "$!{node.uid}", "text": "$!encoder.jsonEncode( ${node.name} )", "level": 1, "hasChildrenWithCoordinates": $!{node.hasChildrenWithCoordinates()}, "expanded": true}#if( $velocityCount < $rootNodesSize ),#end#end],
+"rootNodes":[#foreach( $node in $rootNodes ){"id": "$!{node.uid}", "text": "$!encoder.jsonEncode( ${node.name} )", "level": 1, "hasChildrenWithCoordinates": $!{node.hasChildrenWithCoordinates()}, "expanded": true}#if($velocityCount<$rootNodes.size()),#end#end],
 "organisationUnitLevels":[#foreach($level in $levels){"id":"$!{level.uid}","name":"$!encoder.jsonEncode($!{level.name})","level":"$!{level.level}"}#if($velocityCount<$levels.size()),#end#end],
 "indicatorGroups":[#foreach($group in $indicatorGroups){"id":"$!{group.uid}","name":"$!encoder.jsonEncode($!{group.name})"}#if($velocityCount<$indicatorGroups.size()),#end#end],
 "dataElementGroups":[#foreach($group in $dataElementGroups){"id":"$!{group.uid}","name":"$!encoder.jsonEncode($!{group.name})"}#if($velocityCount<$dataElementGroups.size()),#end#end],