← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 979: Fixed bug lp:426160

 

------------------------------------------------------------
revno: 979
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-11-04 19:33:55 +0100
message:
  Fixed bug lp:426160
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.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-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.java	2009-11-04 18:33:55 +0000
@@ -2,6 +2,7 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.period.Period;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
@@ -61,7 +62,7 @@
     }
     
     @Override
-    public boolean allowDeleteDataElement( DataElement dataElement )
+    public void deleteDataElement( DataElement dataElement )
     {
         for ( DataMartExport export : dataMartExportService.getAllDataMartExports() )
         {
@@ -70,12 +71,10 @@
                 dataMartExportService.saveDataMartExport( export );
             }
         }
-        
-        return true;
     }
     
     @Override
-    public boolean allowDeleteIndicator( Indicator indicator )
+    public void deleteIndicator( Indicator indicator )
     {
         for ( DataMartExport export : dataMartExportService.getAllDataMartExports() )
         {
@@ -84,12 +83,22 @@
                 dataMartExportService.saveDataMartExport( export );
             }
         }
-        
-        return true;
-    }
-    
-    @Override
-    public boolean allowDeleteSource( Source source )
+    }
+    
+    @Override
+    public void deletePeriod( Period period )
+    {
+        for ( DataMartExport export : dataMartExportService.getAllDataMartExports() )
+        {
+            if ( export.getPeriods().remove( period ) )
+            {
+                dataMartExportService.saveDataMartExport( export );
+            }
+        }
+    }
+    
+    @Override
+    public void deleteSource( Source source )
     {
         for ( DataMartExport export : dataMartExportService.getAllDataMartExports() )
         {
@@ -98,7 +107,5 @@
                 dataMartExportService.saveDataMartExport( export );
             }
         }
-        
-        return true;
-    }
+    }    
 }