------------------------------------------------------------
revno: 13178
committer: Lars Helge Ă˜verland <[email protected]>
branch nick: dhis2
timestamp: Mon 2013-12-09 15:33:53 +0100
message:
  Convenience method for getting all org units assigned to data set
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.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/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2013-11-28 20:52:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2013-12-09 14:33:53 +0000
@@ -378,6 +378,24 @@
         compulsoryDataElementOperands.remove( dataElementOperand );
     }
 
+    /**
+     * Returns all organisation units assigned to this data set, including 
+     * org units assigned directly and organisation units assigned through groups.
+     */
+    public Set<OrganisationUnit> getAllOrganisationUnits()
+    {
+        Set<OrganisationUnit> units = new HashSet<OrganisationUnit>();
+        
+        units.addAll( sources );
+        
+        for ( OrganisationUnitGroup group : organisationUnitGroups )
+        {
+            units.addAll( group.getMembers() );
+        }
+        
+        return units;
+    }
+    
     public boolean hasDataEntryForm()
     {
         return dataEntryForm != null;

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to