← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1306: Made the OrganisationUnit - OrganisationUnitGroup association bi-directional.

 

------------------------------------------------------------
revno: 1306
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-01-14 08:10:41 +0100
message:
  Made the OrganisationUnit - OrganisationUnitGroup association bi-directional.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml


--
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	2009-11-03 11:04:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2010-01-14 07:10:41 +0000
@@ -65,6 +65,8 @@
     private String url;
 
     private Date lastUpdated;
+
+    private Set<OrganisationUnitGroup> groups = new HashSet<OrganisationUnitGroup>();
     
     private transient int level;
     
@@ -342,6 +344,16 @@
         this.lastUpdated = lastUpdated;
     }
 
+    public Set<OrganisationUnitGroup> getGroups()
+    {
+        return groups;
+    }
+
+    public void setGroups( Set<OrganisationUnitGroup> groups )
+    {
+        this.groups = groups;
+    }
+
     public int getLevel()
     {
         return level;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2009-12-11 11:28:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2010-01-14 07:10:41 +0000
@@ -55,5 +55,10 @@
 		
     <property name="lastUpdated"/>
     
+    <set name="groups" table="orgunitgroupmembers" inverse="true">
+      <key column="organisationunitid"/>
+      <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid"/>
+    </set>
+    
   </joined-subclass>
 </hibernate-mapping>