dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23941
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11675: Minor bugfix related to org unit level generation
------------------------------------------------------------
revno: 11675
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-08-15 16:45:40 +0200
message:
Minor bugfix related to org unit level generation
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.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-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2013-08-15 14:09:04 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2013-08-15 14:45:40 +0000
@@ -320,8 +320,6 @@
int rootLevel = 1;
- organisationUnit.setLevel( rootLevel );
-
result.add( organisationUnit );
addOrganisationUnitChildren( organisationUnit, result, rootLevel );
@@ -344,8 +342,6 @@
for ( OrganisationUnit child : childList )
{
- child.setLevel( level );
-
result.add( child );
addOrganisationUnitChildren( child, result, level );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2013-08-15 14:09:04 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2013-08-15 14:45:40 +0000
@@ -247,37 +247,30 @@
public void testGetOrganisationUnitsAtLevel()
throws Exception
{
- OrganisationUnit unit1 = new OrganisationUnit( "orgUnitName1", "shortName1", "organisationUnitCode1",
- new Date(), new Date(), true, "comment" );
+ OrganisationUnit unit1 = createOrganisationUnit( '1' );
organisationUnitService.addOrganisationUnit( unit1 );
- OrganisationUnit unit2 = new OrganisationUnit( "orgUnitName2", unit1, "shortName2", "organisationUnitCode2",
- new Date(), new Date(), true, "comment" );
+ OrganisationUnit unit2 = createOrganisationUnit( '2', unit1 );
unit1.getChildren().add( unit2 );
organisationUnitService.addOrganisationUnit( unit2 );
- OrganisationUnit unit3 = new OrganisationUnit( "orgUnitName3", unit2, "shortName3", "organisationUnitCode3",
- new Date(), new Date(), true, "comment" );
+ OrganisationUnit unit3 = createOrganisationUnit( '3', unit2 );
unit2.getChildren().add( unit3 );
organisationUnitService.addOrganisationUnit( unit3 );
- OrganisationUnit unit4 = new OrganisationUnit( "orgUnitName4", unit2, "shortName4", "organisationUnitCode4",
- new Date(), new Date(), true, "comment" );
+ OrganisationUnit unit4 = createOrganisationUnit( '4', unit2 );
unit2.getChildren().add( unit4 );
organisationUnitService.addOrganisationUnit( unit4 );
- OrganisationUnit unit5 = new OrganisationUnit( "orgUnitName5", unit2, "shortName5", "organisationUnitCode5",
- new Date(), new Date(), true, "comment" );
+ OrganisationUnit unit5 = createOrganisationUnit( '5', unit2 );
unit2.getChildren().add( unit5 );
organisationUnitService.addOrganisationUnit( unit5 );
- OrganisationUnit unit6 = new OrganisationUnit( "orgUnitName6", unit3, "shortName6", "organisationUnitCode6",
- new Date(), new Date(), true, "comment" );
+ OrganisationUnit unit6 = createOrganisationUnit( '6', unit3 );
unit3.getChildren().add( unit6 );
organisationUnitService.addOrganisationUnit( unit6 );
- OrganisationUnit unit7 = new OrganisationUnit( "orgUnitName7", "shortName7", "organisationUnitCode7",
- new Date(), new Date(), true, "comment" );
+ OrganisationUnit unit7 = createOrganisationUnit( '7' );
organisationUnitService.addOrganisationUnit( unit7 );
assertTrue( organisationUnitService.getOrganisationUnitsAtLevel( 1 ).size() == 2 );