← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9318: Minor fix for resource tables

 

------------------------------------------------------------
revno: 9318
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-12-14 10:25:29 +0100
message:
  Minor fix for resource tables
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.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-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2012-12-13 20:45:26 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2012-12-14 09:25:29 +0000
@@ -153,23 +153,26 @@
 
             for ( OrganisationUnit unit : units )
             {
-                List<Integer> structure = new ArrayList<Integer>();
+                List<String> structure = new ArrayList<String>();
 
-                structure.add( unit.getId() );
-                structure.add( level );
+                structure.add( String.valueOf( unit.getId() ) );
+                structure.add( String.valueOf( level ) );
 
                 Map<Integer, Integer> identifiers = new HashMap<Integer, Integer>();
+                Map<Integer, String> uids = new HashMap<Integer, String>();
 
                 for ( int j = level; j > 0; j-- )
                 {
                     identifiers.put( j, unit.getId() );
+                    uids.put( j, unit.getUid() );
 
                     unit = unit.getParent();
                 }
                
-                for (int k = 1 ; k <= maxLevel ; k ++ )
+                for ( int k = 1 ; k <= maxLevel ; k ++ )
                 {
-                    structure.add( identifiers.get( k ) );
+                    structure.add( identifiers.get( k ) != null ? String.valueOf( identifiers.get( k ) ) : null );
+                    structure.add( uids.get( k ) );
                 }
                 
                 batchHandler.addObject( structure );