dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36778
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18801: Reversed order of org unit ancestor names
------------------------------------------------------------
revno: 18801
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-03 09:59:52 +0200
message:
Reversed order of org unit ancestor names
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.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-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2015-04-01 12:22:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2015-04-03 07:59:52 +0000
@@ -100,7 +100,7 @@
private static final Pattern JSON_COORDINATE_PATTERN = Pattern.compile( "(\\[{3}.*?\\]{3})" );
private static final Pattern COORDINATE_PATTERN = Pattern.compile( "([\\-0-9.]+,[\\-0-9.]+)" );
- private static final String NAME_SEPARATOR = " - ";
+ private static final String NAME_SEPARATOR = " / ";
private String uuid;
@@ -545,16 +545,15 @@
public String getAncestorNames()
{
- StringBuilder builder = new StringBuilder( name );
-
- OrganisationUnit unit = parent;
-
- while ( unit != null )
+ List<OrganisationUnit> units = getAncestors();
+
+ StringBuilder builder = new StringBuilder();
+
+ for ( OrganisationUnit unit : units )
{
- builder.append( NAME_SEPARATOR ).append( unit.getName() );
- unit = unit.getParent();
+ builder.append( unit.getName() ).append( NAME_SEPARATOR );
}
-
+
return builder.toString();
}