← Back to team overview

dhis2-devs team mailing list archive

[Bug 676817] Re: orgunitstructure nulls are zeros

 

This gives me what I would expect would be generated..

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/jav
a/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis
/resourcetable/DefaultResourceTableService.java 2011-03-17 19:31:16 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis
/resourcetable/DefaultResourceTableService.java 2011-11-07 15:50:08 +0000
@@ -33,6 +33,10 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;


 import org.amplecode.quick.BatchHandler;
 import org.amplecode.quick.BatchHandlerFactory;
@@ -147,10 +151,10 @@

            for ( OrganisationUnit unit : units )
            {
-                List<String> structure = new ArrayList<String>();
+                List<Integer> structure = new ArrayList<Integer>();

-                structure.add( String.valueOf( unit.getId() ) );
-                structure.add( String.valueOf( level ) );
+                structure.add( unit.getId() );
+                structure.add( level  );

                Map<Integer, Integer> identifiers = new HashMap<Integer, Intege
r>();

@@ -161,14 +165,14 @@
                    unit = unit.getParent();
                }

-                structure.add( String.valueOf( identifiers.get( 1 ) != null ? i
dentifiers.get( 1 ) : "0" ) ); //TODO improve
-                structure.add( String.valueOf( identifiers.get( 2 ) != null ? i
dentifiers.get( 2 ) : "0" ) );
-                structure.add( String.valueOf( identifiers.get( 3 ) != null ? i
dentifiers.get( 3 ) : "0" ) );
-                structure.add( String.valueOf( identifiers.get( 4 ) != null ? i
dentifiers.get( 4 ) : "0" ) );
-                structure.add( String.valueOf( identifiers.get( 5 ) != null ? i
dentifiers.get( 5 ) : "0" ) );
-                structure.add( String.valueOf( identifiers.get( 6 ) != null ? i
dentifiers.get( 6 ) : "0" ) );
-                structure.add( String.valueOf( identifiers.get( 7 ) != null ? i
dentifiers.get( 7 ) : "0" ) );
-                structure.add( String.valueOf( identifiers.get( 8 ) != null ? i
dentifiers.get( 8 ) : "0" ) );
+                structure.add(  identifiers.get( 1 )  ); //TODO improve
+                structure.add(  identifiers.get( 2 )  );
+                structure.add(  identifiers.get( 3 )  );
+                structure.add(  identifiers.get( 4 )  );
+                structure.add( identifiers.get( 5 )  );
+                structure.add(  identifiers.get( 6 ) );
+                structure.add(  identifiers.get( 7 )  );
+                structure.add(  identifiers.get( 8 )  );

                batchHandler.addObject( structure );
            }

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/676817

Title:
  orgunitstructure nulls are zeros

Status in DHIS 2 - District Health Information Software:
  New

Bug description:
  The orgunitstructure table contains a large number of zeros, that should actually be NULLS. 
  orgunitid, level, idlevel1, idlevel2, idlevel3,idlevel4,idlevel5, idlevel6,idlevel6,idlevel8
  ..
  3839;1;3839;0;0;0;0;0;0;0
  3840;3;3839;3832;3840;0;0;0;0;0
  3841;3;3839;3832;3841;0;0;0;0;0
  ..

  These zeroes do not refer to any particular orgunit and should be
  NULL. I believe prior to 2.0.5 the values were null.

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/676817/+subscriptions


References