dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02304
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 773: Fixed bug related to auto assignments of orgunits to compulsory group sets.
------------------------------------------------------------
revno: 773
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Sat 2009-09-26 09:35:21 +0200
message:
Fixed bug related to auto assignments of orgunits to compulsory group sets.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.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/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2009-09-26 07:35:21 +0000
@@ -69,6 +69,28 @@
}
// -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
+ public boolean hasOrganisationUnitGroups()
+ {
+ return organisationUnitGroups != null && organisationUnitGroups.size() > 0;
+ }
+
+ public boolean isMemberOfOrganisationUnitGroups( OrganisationUnit organisationUnit )
+ {
+ for ( OrganisationUnitGroup group : organisationUnitGroups )
+ {
+ if ( group.getMembers().contains( organisationUnit ) )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // -------------------------------------------------------------------------
// hashCode and equals
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java'
--- dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java 2009-09-07 15:53:27 +0000
+++ dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java 2009-09-26 07:35:21 +0000
@@ -234,17 +234,12 @@
{
Collection<OrganisationUnitGroupSet> groupSets = new ArrayList<OrganisationUnitGroupSet>();
- groupSetLoop : for ( OrganisationUnitGroupSet groupSet : getCompulsoryOrganisationUnitGroupSets() )
+ for ( OrganisationUnitGroupSet groupSet : getCompulsoryOrganisationUnitGroupSets() )
{
- for ( OrganisationUnitGroup group : groupSet.getOrganisationUnitGroups() )
+ if ( !groupSet.isMemberOfOrganisationUnitGroups( organisationUnit ) && groupSet.hasOrganisationUnitGroups() )
{
- if ( group.getMembers().contains( organisationUnit ) )
- {
- continue groupSetLoop;
- }
+ groupSets.add( groupSet );
}
-
- groupSets.add( groupSet );
}
return groupSets;