← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3934: Add method in Report Survey and Target

 

------------------------------------------------------------
revno: 3934
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-06-17 16:27:52 +0530
message:
  Add method in Report Survey and Target
modified:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTarget.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/Report_in.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/survey/Survey.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 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTarget.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTarget.java	2011-04-27 17:15:13 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTarget.java	2011-06-17 10:57:52 +0000
@@ -145,6 +145,38 @@
         return "[" + name + "]";
     }
     
+
+    // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
+    public void addOrganisationUnit( OrganisationUnit unit )
+    {
+        sources.add( unit );
+    }
+    
+    public void removeOrganisationUnit( OrganisationUnit unit )
+    {
+        sources.remove( unit );
+    }
+    
+    public void updateOrganisationUnits( Set<OrganisationUnit> updates )
+    {
+        for ( OrganisationUnit unit : new HashSet<OrganisationUnit>( sources ) )
+        {
+            if ( !updates.contains( unit ) )
+            {
+                removeOrganisationUnit( unit );
+            }
+        }
+        
+        for ( OrganisationUnit unit : updates )
+        {
+            addOrganisationUnit( unit );
+        }
+    }
+    
+    
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/Report_in.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/Report_in.java	2011-04-27 17:15:13 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/Report_in.java	2011-06-17 10:57:52 +0000
@@ -166,6 +166,40 @@
         return name.equals( other.getName() );
     }
 
+    
+    // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
+    public void addOrganisationUnit( OrganisationUnit unit )
+    {
+        sources.add( unit );
+    }
+    
+    public void removeOrganisationUnit( OrganisationUnit unit )
+    {
+        sources.remove( unit );
+    }
+    
+    public void updateOrganisationUnits( Set<OrganisationUnit> updates )
+    {
+        for ( OrganisationUnit unit : new HashSet<OrganisationUnit>( sources ) )
+        {
+            if ( !updates.contains( unit ) )
+            {
+                removeOrganisationUnit( unit );
+            }
+        }
+        
+        for ( OrganisationUnit unit : updates )
+        {
+            addOrganisationUnit( unit );
+        }
+    }
+    
+    
+    
+    
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/survey/Survey.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/survey/Survey.java	2011-04-27 17:15:13 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/survey/Survey.java	2011-06-17 10:57:52 +0000
@@ -140,6 +140,37 @@
         return "[" + name + "]";
     }
     
+
+    // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
+    public void addOrganisationUnit( OrganisationUnit unit )
+    {
+        sources.add( unit );
+    }
+    
+    public void removeOrganisationUnit( OrganisationUnit unit )
+    {
+        sources.remove( unit );
+    }
+    
+    public void updateOrganisationUnits( Set<OrganisationUnit> updates )
+    {
+        for ( OrganisationUnit unit : new HashSet<OrganisationUnit>( sources ) )
+        {
+            if ( !updates.contains( unit ) )
+            {
+                removeOrganisationUnit( unit );
+            }
+        }
+        
+        for ( OrganisationUnit unit : updates )
+        {
+            addOrganisationUnit( unit );
+        }
+    }
+    
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------