← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18680: Deletion handlers. Using update no ACL when removing the object to delete from bidirectional asso...

 

------------------------------------------------------------
revno: 18680
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-24 19:54:44 +0100
message:
  Deletion handlers. Using update no ACL when removing the object to delete from bidirectional associations. Currently it lead to access denied when the current user did not have access to associated objects it had to remove the object to delete from.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementGroupDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSetDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorGroupDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSetDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSetDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/ValidationRuleGroupDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -37,13 +38,9 @@
 public class CategoryOptionGroupSetDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
     @Autowired
-    private DataElementCategoryService dataElementCategoryService;
-
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -62,7 +59,7 @@
         if ( groupSet != null )
         {
             groupSet.getMembers().remove( categoryOptionGroup );
-            dataElementCategoryService.updateCategoryOptionGroupSet( groupSet );
+            idObjectManager.updateNoAcl( groupSet );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -30,7 +30,9 @@
 
 import java.util.Set;
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Dang Duy Hieu
@@ -38,17 +40,9 @@
 public class DataElementCategoryDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataElementCategoryService categoryService;
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -67,7 +61,7 @@
         for ( DataElementCategory category : categories )
         {
             category.removeDataElementCategoryOption( categoryOption );
-            categoryService.updateDataElementCategory( category );
+            idObjectManager.updateNoAcl( category );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,7 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
@@ -37,17 +39,9 @@
 public class DataElementCategoryOptionDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataElementCategoryService categoryService;
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -64,7 +58,7 @@
         for ( DataElementCategoryOption categoryOption : category.getCategoryOptions() )
         {
             categoryOption.getCategories().remove( category );
-            categoryService.updateDataElementCategoryOption( categoryOption );
+            idObjectManager.updateNoAcl( categoryOption );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -30,9 +30,11 @@
 
 import static org.hisp.dhis.dataelement.DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME;
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
@@ -41,30 +43,14 @@
 public class DataElementDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
+    @Autowired
     private DataElementCategoryService categoryService;
 
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
+    @Autowired
     private JdbcTemplate jdbcTemplate;
-
-    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
-    {
-        this.jdbcTemplate = jdbcTemplate;
-    }
     
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
@@ -82,13 +68,13 @@
         DataElementCategoryCombo default_ = categoryService
             .getDataElementCategoryComboByName( DEFAULT_CATEGORY_COMBO_NAME );
 
-        for ( DataElement dataElement : dataElementService.getAllDataElements() )
+        for ( DataElement dataElement : idObjectManager.getAllNoAcl( DataElement.class ) )
         {
             if ( dataElement.getCategoryCombo().equals( categoryCombo ) )
             {
                 dataElement.setCategoryCombo( default_ );
 
-                dataElementService.updateDataElement( dataElement );
+                idObjectManager.updateNoAcl( dataElement );
             }
         }
     }
@@ -99,7 +85,7 @@
         for ( DataElement element : dataSet.getDataElements() )
         {
             element.getDataSets().remove( dataSet );
-            dataElementService.updateDataElement( element );
+            idObjectManager.updateNoAcl( element );
         }
     }
 
@@ -109,7 +95,7 @@
         for ( DataElement element : group.getMembers() )
         {
             element.getGroups().remove( group );
-            dataElementService.updateDataElement( element );
+            idObjectManager.updateNoAcl( element );
         }
     }
     

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementGroupDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementGroupDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,7 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
@@ -36,17 +38,9 @@
 public class DataElementGroupDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataElementService dataElementService;
-        
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -63,7 +57,7 @@
         for ( DataElementGroup group : dataElement.getGroups() )
         {
             group.getMembers().remove( dataElement );
-            dataElementService.updateDataElementGroup( group );
+            idObjectManager.updateNoAcl( group );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSetDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSetDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSetDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,26 +28,19 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Dang Duy Hieu
- * @version $Id$
  */
 public class DataElementGroupSetDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -66,7 +59,7 @@
         if ( groupSet != null )
         {
             groupSet.getMembers().remove( dataElementGroup );
-            dataElementService.updateDataElementGroupSet( groupSet );
+            idObjectManager.updateNoAcl( groupSet );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationDeletionHandler.java	2015-01-22 17:10:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -47,8 +47,7 @@
 
     public CompleteDataSetRegistrationService completeDataSetRegistrationService;
 
-    public void setCompleteDataSetRegistrationService(
-        CompleteDataSetRegistrationService completeDataSetRegistrationService )
+    public void setCompleteDataSetRegistrationService( CompleteDataSetRegistrationService completeDataSetRegistrationService )
     {
         this.completeDataSetRegistrationService = completeDataSetRegistrationService;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -31,31 +31,24 @@
 import java.util.Collection;
 import java.util.Iterator;
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class DataSetDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataSetService dataSetService;
-
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -75,10 +68,10 @@
         {
             DataSet dataSet = iterator.next();
             dataSet.removeDataElement( dataElement );
-            dataSetService.updateDataSet( dataSet );
+            idObjectManager.updateNoAcl( dataSet );
         }
         
-        for ( DataSet dataSet : dataSetService.getAllDataSets() )
+        for ( DataSet dataSet : idObjectManager.getAllNoAcl( DataSet.class ) )
         {
             boolean update = false;
             
@@ -97,7 +90,7 @@
             
             if ( update )
             {
-                dataSetService.updateDataSet( dataSet );
+                idObjectManager.updateNoAcl( dataSet );
             }
         }
     }
@@ -111,7 +104,7 @@
         {
             DataSet dataSet = iterator.next();
             dataSet.getIndicators().remove( indicator );
-            dataSetService.updateDataSet( dataSet );
+            idObjectManager.updateNoAcl( dataSet );
         }
     }
     
@@ -123,21 +116,21 @@
         if ( dataSet != null )
         {
             dataSet.getSections().remove( section );
-            dataSetService.updateDataSet( dataSet );
+            idObjectManager.updateNoAcl( dataSet );
         }
     }
     
     @Override
     public void deleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
     {
-        Collection<DataSet> dataSets = dataSetService.getAllDataSets();
+        Collection<DataSet> dataSets = idObjectManager.getAllNoAcl( DataSet.class );
 
         for ( DataSet dataSet : dataSets )
         {            
             if ( dataSet != null && categoryCombo.equals( dataSet.getCategoryCombo() ) )
             {
                 dataSet.setCategoryCombo( null );
-                dataSetService.updateDataSet( dataSet );
+                idObjectManager.updateNoAcl( dataSet );
             }
         }        
     }
@@ -151,7 +144,7 @@
         {
             DataSet dataSet = iterator.next();
             dataSet.getSources().remove( unit );
-            dataSetService.updateDataSet( dataSet );
+            idObjectManager.updateNoAcl( dataSet );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorGroupDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorGroupDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,26 +28,19 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class IndicatorGroupDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private IndicatorService indicatorService;
-
-    public void setIndicatorService( IndicatorService indicatorService )
-    {
-        this.indicatorService = indicatorService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -64,7 +57,7 @@
         for ( IndicatorGroup group : indicator.getGroups() )
         {
             group.getMembers().remove( indicator );
-            indicatorService.updateIndicatorGroup( group );
+            idObjectManager.updateNoAcl( group );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSetDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSetDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSetDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,7 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
@@ -36,17 +38,9 @@
 public class IndicatorGroupSetDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private IndicatorService indicatorService;
-
-    public void setIndicatorService( IndicatorService indicatorService )
-    {
-        this.indicatorService = indicatorService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -65,7 +59,7 @@
         if ( groupSet != null )
         {
             groupSet.getMembers().remove( indicatorGroup );
-            indicatorService.updateIndicatorGroupSet( groupSet );
+            idObjectManager.updateNoAcl( groupSet );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,9 +28,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.hisp.dhis.user.User;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
@@ -38,17 +40,9 @@
 public class OrganisationUnitDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -65,7 +59,7 @@
         for ( OrganisationUnit unit : dataSet.getSources() )
         {
             unit.getDataSets().remove( dataSet );
-            organisationUnitService.updateOrganisationUnit( unit );
+            idObjectManager.updateNoAcl( unit );
         }
     }
 
@@ -75,7 +69,7 @@
         for ( OrganisationUnit unit : user.getOrganisationUnits() )
         {
             unit.getUsers().remove( user );
-            organisationUnitService.updateOrganisationUnit( unit );
+            idObjectManager.updateNoAcl( unit );
         }
     }
 
@@ -85,7 +79,7 @@
         for ( OrganisationUnit unit : group.getMembers() )
         {
             unit.getGroups().remove( group );
-            organisationUnitService.updateOrganisationUnit( unit );
+            idObjectManager.updateNoAcl( unit );
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,25 +28,18 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class OrganisationUnitGroupDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private OrganisationUnitGroupService organisationUnitGroupService;
-
-    public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
-    {
-        this.organisationUnitGroupService = organisationUnitGroupService;
-    }
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
     
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
@@ -64,7 +57,7 @@
         for ( OrganisationUnitGroup group : unit.getGroups() )
         {
             group.getMembers().remove( unit );
-            organisationUnitGroupService.updateOrganisationUnitGroup( group );
+            idObjectManager.updateNoAcl( group );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSetDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSetDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSetDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,25 +28,18 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class OrganisationUnitGroupSetDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private OrganisationUnitGroupService organisationUnitGroupService;
-
-    public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
-    {
-        this.organisationUnitGroupService = organisationUnitGroupService;
-    }
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
     
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
@@ -66,7 +59,7 @@
         if ( groupSet != null )
         {
             groupSet.getOrganisationUnitGroups().remove( group );
-            organisationUnitGroupService.updateOrganisationUnitGroupSet( groupSet );
+            idObjectManager.updateNoAcl( groupSet );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,8 +28,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
@@ -37,17 +39,9 @@
 public class UserDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private UserService userService;
-
-    public void setUserService( UserService userService )
-    {
-        this.userService = userService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -64,7 +58,7 @@
         for ( UserCredentials credentials : authorityGroup.getMembers() )
         {
             credentials.getUserAuthorityGroups().remove( authorityGroup );
-            userService.updateUserCredentials( credentials );
+            idObjectManager.updateNoAcl( credentials );
         }
     }
     
@@ -74,7 +68,7 @@
         for ( User user : unit.getUsers() )
         {
             user.getOrganisationUnits().remove( unit );
-            userService.updateUser( user );
+            idObjectManager.updateNoAcl( user );
         }
     }
 
@@ -84,14 +78,14 @@
         for ( User user : group.getMembers() )
         {
             user.getGroups().remove( group );
-            userService.updateUser( user );
+            idObjectManager.updateNoAcl( user );
         }
     }
 
     @Override
     public String allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
     {
-        for ( UserCredentials credentials : userService.getAllUserCredentials() )
+        for ( UserCredentials credentials : authorityGroup.getMembers() )
         {
             for ( UserAuthorityGroup role : credentials.getUserAuthorityGroups() )
             {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/ValidationRuleGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/ValidationRuleGroupDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/ValidationRuleGroupDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -28,7 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
@@ -36,16 +38,8 @@
 public class ValidationRuleGroupDeletionHandler
     extends DeletionHandler
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private ValidationRuleService validationRuleService;
-
-    public void setValidationRuleService( ValidationRuleService validationRuleService )
-    {
-        this.validationRuleService = validationRuleService;
-    }
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
     
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
@@ -63,7 +57,7 @@
         for ( ValidationRuleGroup group : validationRule.getGroups() )
         {
             group.getMembers().remove( validationRule );
-            validationRuleService.updateValidationRuleGroup( group );
+            idObjectManager.updateNoAcl( group );
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-03-19 00:30:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-03-24 18:54:44 +0000
@@ -1038,20 +1038,12 @@
     <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataelement.DataElementDeletionHandler" class="org.hisp.dhis.dataelement.DataElementDeletionHandler">
-    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-    <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-    <property name="jdbcTemplate" ref="jdbcTemplate" />
-  </bean>
+  <bean id="org.hisp.dhis.dataelement.DataElementDeletionHandler" class="org.hisp.dhis.dataelement.DataElementDeletionHandler" />
 
-  <bean id="org.hisp.dhis.dataelement.DataElementGroupDeletionHandler" class="org.hisp.dhis.dataelement.DataElementGroupDeletionHandler">
-    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-  </bean>
+  <bean id="org.hisp.dhis.dataelement.DataElementGroupDeletionHandler" class="org.hisp.dhis.dataelement.DataElementGroupDeletionHandler" />
 
   <bean id="org.hisp.dhis.dataelement.DataElementCategoryOptionDeletionHandler"
-    class="org.hisp.dhis.dataelement.DataElementCategoryOptionDeletionHandler">
-    <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-  </bean>
+    class="org.hisp.dhis.dataelement.DataElementCategoryOptionDeletionHandler" />
 
   <bean id="org.hisp.dhis.dataelement.DataElementCategoryOptionComboDeletionHandler"
     class="org.hisp.dhis.dataelement.DataElementCategoryOptionComboDeletionHandler">
@@ -1067,9 +1059,7 @@
   <bean id="org.hisp.dhis.dataelement.DataElementCategoryDimensionDeletionHandler" 
     class="org.hisp.dhis.dataelement.DataElementCategoryDimensionDeletionHandler" />
 
-  <bean id="org.hisp.dhis.dataset.DataSetDeletionHandler" class="org.hisp.dhis.dataset.DataSetDeletionHandler">
-    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-  </bean>
+  <bean id="org.hisp.dhis.dataset.DataSetDeletionHandler" class="org.hisp.dhis.dataset.DataSetDeletionHandler" />
 
   <bean id="org.hisp.dhis.dataset.CompleteDataSetRegistrationDeletionHandler"
     class="org.hisp.dhis.dataset.CompleteDataSetRegistrationDeletionHandler">
@@ -1090,13 +1080,9 @@
     <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
   </bean>
 
-  <bean id="org.hisp.dhis.indicator.IndicatorGroupDeletionHandler" class="org.hisp.dhis.indicator.IndicatorGroupDeletionHandler">
-    <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
-  </bean>
+  <bean id="org.hisp.dhis.indicator.IndicatorGroupDeletionHandler" class="org.hisp.dhis.indicator.IndicatorGroupDeletionHandler" />
 
-  <bean id="org.hisp.dhis.indicator.IndicatorGroupSetDeletionHandler" class="org.hisp.dhis.indicator.IndicatorGroupSetDeletionHandler">
-    <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
-  </bean>
+  <bean id="org.hisp.dhis.indicator.IndicatorGroupSetDeletionHandler" class="org.hisp.dhis.indicator.IndicatorGroupSetDeletionHandler" />
 
   <bean id="org.hisp.dhis.minmax.MinMaxDataElementDeletionHandler" class="org.hisp.dhis.minmax.MinMaxDataElementDeletionHandler">
     <property name="minMaxDataElementService" ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
@@ -1107,36 +1093,26 @@
   </bean>
 
   <bean id="org.hisp.dhis.validation.ValidationRuleGroupDeletionHandler"
-    class="org.hisp.dhis.validation.ValidationRuleGroupDeletionHandler">
-    <property name="validationRuleService" ref="org.hisp.dhis.validation.ValidationRuleService" />
-  </bean>
+    class="org.hisp.dhis.validation.ValidationRuleGroupDeletionHandler" />
 
   <bean id="org.hisp.dhis.datavalue.DataValueDeletionHandler" class="org.hisp.dhis.datavalue.DataValueDeletionHandler">
     <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
   <bean id="org.hisp.dhis.organisationunit.OrganisationUnitDeletionHandler"
-    class="org.hisp.dhis.organisationunit.OrganisationUnitDeletionHandler">
-    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-  </bean>
+    class="org.hisp.dhis.organisationunit.OrganisationUnitDeletionHandler" />
 
   <bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupDeletionHandler"
-    class="org.hisp.dhis.organisationunit.OrganisationUnitGroupDeletionHandler">
-    <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
-  </bean>
+    class="org.hisp.dhis.organisationunit.OrganisationUnitGroupDeletionHandler" />
 
   <bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupSetDeletionHandler"
-    class="org.hisp.dhis.organisationunit.OrganisationUnitGroupSetDeletionHandler">
-    <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
-  </bean>
+    class="org.hisp.dhis.organisationunit.OrganisationUnitGroupSetDeletionHandler" />
 
   <bean id="org.hisp.dhis.datavalue.DataValueAuditDeletionHandler" class="org.hisp.dhis.datavalue.DataValueAuditDeletionHandler">
     <property name="dataValueAuditService" ref="org.hisp.dhis.datavalue.DataValueAuditService" />
   </bean>
 
-  <bean id="org.hisp.dhis.user.UserDeletionHandler" class="org.hisp.dhis.user.UserDeletionHandler">
-    <property name="userService" ref="org.hisp.dhis.user.UserService" />
-  </bean>
+  <bean id="org.hisp.dhis.user.UserDeletionHandler" class="org.hisp.dhis.user.UserDeletionHandler" />
 
   <bean id="org.hisp.dhis.user.UserGroupDeletionHandler" class="org.hisp.dhis.user.UserGroupDeletionHandler">
     <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
@@ -1148,15 +1124,11 @@
 
   <bean id="org.hisp.dhis.user.UserSettingDeletionHandler" class="org.hisp.dhis.user.UserSettingDeletionHandler" />
 
-  <bean id="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler"
-    class="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler">
-    <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-  </bean>
+  <bean id="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler" 
+  	class="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler" />
 
   <bean id="org.hisp.dhis.dataelement.DataElementGroupSetDeletionHandler"
-    class="org.hisp.dhis.dataelement.DataElementGroupSetDeletionHandler">
-    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-  </bean>
+    class="org.hisp.dhis.dataelement.DataElementGroupSetDeletionHandler" />
 
   <bean id="org.hisp.dhis.configuration.ConfigurationDeletionHandler" class="org.hisp.dhis.configuration.ConfigurationDeletionHandler">
     <property name="jdbcTemplate" ref="jdbcTemplate" />

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java	2015-03-12 07:39:04 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java	2015-03-24 18:54:44 +0000
@@ -30,16 +30,17 @@
 
 import java.util.Collection;
 
+import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.hisp.dhis.trackedentity.TrackedEntity;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.user.UserAuthorityGroup;
 import org.hisp.dhis.validation.ValidationCriteria;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Chau Thu Tran
- * @version ProgramDeleteHandler.java Sep 30, 2010 1:39:15 PM
  */
 public class ProgramDeletionHandler
     extends DeletionHandler
@@ -48,13 +49,12 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    @Autowired
     private ProgramService programService;
 
-    public void setProgramService( ProgramService programService )
-    {
-        this.programService = programService;
-    }
-
+    @Autowired
+    private IdentifiableObjectManager idObjectManager;
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -73,20 +73,20 @@
         for ( Program program : programs )
         {
             program.getValidationCriteria().remove( validationCriteria );
-            programService.updateProgram( program );
+            idObjectManager.updateNoAcl( program );
         }
     }
 
     @Override
     public void deleteOrganisationUnit( OrganisationUnit unit )
     {
-        Collection<Program> programs = programService.getAllPrograms();
+        Collection<Program> programs = idObjectManager.getAllNoAcl( Program.class );
 
         for ( Program program : programs )
         {
             if ( program.getOrganisationUnits().remove( unit ) )
             {
-                programService.updateProgram( program );
+                idObjectManager.updateNoAcl( program );
             }
         }
     }
@@ -94,13 +94,13 @@
     @Override
     public void deleteUserAuthorityGroup( UserAuthorityGroup group )
     {
-        Collection<Program> programs = programService.getAllPrograms();
+        Collection<Program> programs = idObjectManager.getAllNoAcl( Program.class );
 
         for ( Program program : programs )
         {
             if ( program.getUserRoles().remove( group ) )
             {
-                programService.updateProgram( program );
+                idObjectManager.updateNoAcl( program );
             }
         }
     }
@@ -116,7 +116,7 @@
     @Override
     public void deleteTrackedEntityAttribute( TrackedEntityAttribute trackedEntityAttribute )
     {
-        Collection<Program> programs = programService.getAllPrograms();
+        Collection<Program> programs = idObjectManager.getAllNoAcl( Program.class );
 
         for ( Program program : programs )
         {
@@ -125,7 +125,7 @@
                 if ( programAttribute.getAttribute().equals( trackedEntityAttribute ) )
                 {
                     program.getProgramAttributes().remove( programAttribute );
-                    programService.updateProgram( program );
+                    idObjectManager.updateNoAcl( program );
                 }
             }
         }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml	2015-03-13 08:24:36 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml	2015-03-24 18:54:44 +0000
@@ -463,9 +463,7 @@
 			ref="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.program.ProgramDeletionHandler" class="org.hisp.dhis.program.ProgramDeletionHandler">
-		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-	</bean>
+	<bean id="org.hisp.dhis.program.ProgramDeletionHandler" class="org.hisp.dhis.program.ProgramDeletionHandler" />
 
 	<bean
 		id="org.hisp.dhis.trackedentity.TrackedEntityInstanceDeletionHandler"