← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14191: add/remove group methods on *groupset

 

------------------------------------------------------------
revno: 14191
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-03-11 16:39:25 +0100
message:
  add/remove group methods on *groupset
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.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/dataelement/CategoryOptionGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java	2014-02-21 13:19:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java	2014-03-11 15:39:25 +0000
@@ -150,11 +150,13 @@
     public void addCategoryOptionGroup( CategoryOptionGroup categoryOptionGroup )
     {
         members.add( categoryOptionGroup );
+        categoryOptionGroup.setGroupSet( this );
     }
 
     public void removeCategoryOptionGroup( CategoryOptionGroup categoryOptionGroup )
     {
         members.remove( categoryOptionGroup );
+        categoryOptionGroup.setGroupSet( null );
     }
 
     @Override

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java	2014-02-11 18:19:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java	2014-03-11 15:39:25 +0000
@@ -115,12 +115,18 @@
         members.add( dataElementGroup );
         dataElementGroup.setGroupSet( this );
     }
+    
+    public void removeDataElementGroup( DataElementGroup dataElementGroup )
+    {
+        members.remove( dataElementGroup );
+        dataElementGroup.setGroupSet( null );
+    }
 
     public void removeAllDataElementGroups()
     {
         for ( DataElementGroup dataElementGroup : members )
         {
-            if ( dataElementGroup.getGroupSet() == this )
+            if ( dataElementGroup.getGroupSet().equals( this ) )
             {
                 dataElementGroup.setGroupSet( null );
             }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java	2013-09-16 17:07:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java	2014-03-11 15:39:25 +0000
@@ -164,13 +164,15 @@
 
     public void addIndicatorGroup( IndicatorGroup indicatorGroup )
     {
-        if ( !members.contains( indicatorGroup ) )
-        {
-            this.members.add( indicatorGroup );
-        }
-
+        members.add( indicatorGroup );
         indicatorGroup.setGroupSet( this );
     }
+    
+    public void removeIndicatorGroup( IndicatorGroup indicatorGroup )
+    {
+        members.remove( indicatorGroup );
+        indicatorGroup.setGroupSet( null );
+    }
 
     // -------------------------------------------------------------------------
     // Getters and setters