dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37064
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18953: Org unit resource, added includeAncestors param
------------------------------------------------------------
revno: 18953
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-04-20 18:03:40 +0200
message:
Org unit resource, added includeAncestors param
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java 2015-02-25 07:31:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java 2015-04-20 16:03:40 +0000
@@ -199,6 +199,14 @@
options.getOptions().put( "useWrapper", "true" );
organisationUnits.addAll( organisationUnitService.getOrganisationUnitWithChildren( uid ) );
}
+ else if ( options.contains( "includeAncestors" ) )
+ {
+ options.getOptions().put( "useWrapper", "true" );
+ organisationUnits.add( organisationUnit );
+ List<OrganisationUnit> ancestors = organisationUnit.getAncestors();
+ Collections.reverse( ancestors );
+ organisationUnits.addAll( ancestors );
+ }
else if ( options.contains( "level" ) )
{
options.getOptions().put( "useWrapper", "true" );