dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07744
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2270: Missing updated
------------------------------------------------------------
revno: 2270
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-09-29 14:23:30 +0700
message:
Missing updated
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.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/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2010-08-27 10:58:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2010-09-29 07:23:30 +0000
@@ -32,6 +32,7 @@
import java.util.Set;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
+import org.hisp.dhis.source.Source;
/**
* Defines methods for working with OrganisationUnits.
@@ -215,6 +216,23 @@
*/
Collection<OrganisationUnit> getOrganisationUnitsWithoutGroups();
+
+ /**
+ * Convert the OrganisationUnit collection to the set of Source
+ *
+ * @return a Set with Source entries.
+ */
+ Set<Source> convert( Collection<OrganisationUnit> organisationUnits );
+
+ /**
+ * Get the units in tree by the collection of given roots
+ *
+ * @param rootUnits the collection of given roots.
+ * @param unitsInTheTree the units in tree.
+ */
+ void getUnitsInTheTree( Collection<OrganisationUnit> rootUnits, Set<OrganisationUnit> unitsInTheTree );
+
+
// -------------------------------------------------------------------------
// OrganisationUnitHierarchy
// -------------------------------------------------------------------------
@@ -233,7 +251,7 @@
* @param parentId the parent organisation unit identifier.
*/
void updateOrganisationUnitParent( int organisationUnitId, int parentId );
-
+
// -------------------------------------------------------------------------
// OrganisationUnitLevel
// -------------------------------------------------------------------------
=== 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 2010-08-27 10:58:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2010-09-29 07:23:30 +0000
@@ -40,6 +40,7 @@
import org.apache.log4j.Logger;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitLevelComparator;
+import org.hisp.dhis.source.Source;
import org.hisp.dhis.source.SourceStore;
import org.hisp.dhis.system.util.AuditLogLevel;
import org.hisp.dhis.system.util.AuditLogUtil;
@@ -541,4 +542,24 @@
{
return organisationUnitStore.getNumberOfOrganisationUnits();
}
+
+ @Override
+ public Set<Source> convert( Collection<OrganisationUnit> organisationUnits )
+ {
+ Set<Source> sources = new HashSet<Source>();
+
+ sources.addAll( organisationUnits );
+
+ return sources;
+ }
+
+ @Override
+ public void getUnitsInTheTree( Collection<OrganisationUnit> rootUnits, Set<OrganisationUnit> unitsInTheTree )
+ {
+ for ( OrganisationUnit root : rootUnits )
+ {
+ unitsInTheTree.add( root );
+ getUnitsInTheTree( root.getChildren(), unitsInTheTree );
+ }
+ }
}