dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13070
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4133: Web pivot table: Displaying selected orgunit instead of children if selected has no children
------------------------------------------------------------
revno: 4133
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-07-13 20:16:12 +0200
message:
Web pivot table: Displaying selected orgunit instead of children if selected has no children
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pivottable/impl/DefaultPivotTableService.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 2011-06-29 11:04:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-07-13 18:16:12 +0000
@@ -412,6 +412,22 @@
newParent.getChildren().add( this );
}
+ public Set<OrganisationUnit> getChildrenThisIfEmpty()
+ {
+ Set<OrganisationUnit> set = new HashSet<OrganisationUnit>();
+
+ if ( hasChild() )
+ {
+ set = children;
+ }
+ else
+ {
+ set.add( this );
+ }
+
+ return set;
+ }
+
// -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pivottable/impl/DefaultPivotTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pivottable/impl/DefaultPivotTableService.java 2011-04-01 09:57:53 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pivottable/impl/DefaultPivotTableService.java 2011-07-13 18:16:12 +0000
@@ -116,7 +116,7 @@
periodService.getPeriodsBetweenDates( periodType, getMediumDate( startDate ), getMediumDate( endDate ) ) );
List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>(
- organisationUnitService.getOrganisationUnit( organisationUnitId ).getChildren() );
+ organisationUnitService.getOrganisationUnit( organisationUnitId ).getChildrenThisIfEmpty() );
List<? extends AbstractIdentifiableObject> indicators = null;
Collection<? extends AggregatedValue> aggregatedValues = null;