← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3775: Fixed bug related to deletion of Sections. Updating OrganisationUnit child/parent bi-directional ...

 

------------------------------------------------------------
revno: 3775
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-05-28 20:05:39 +0200
message:
  Fixed bug related to deletion of Sections. Updating OrganisationUnit child/parent bi-directional association on both sides. This to avoid caching issues but should be done anyway.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.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-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-05-12 13:10:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-05-28 18:05:39 +0000
@@ -1249,43 +1249,20 @@
 	<aop:config>
 
 		<aop:aspect ref="deletionInterceptor">
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.datadictionary.DataDictionaryService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.dataelement.DataElementService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.dataelement.DataElementCategoryService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.dataset.DataSetService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.indicator.IndicatorService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.expression.ExpressionService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.minmax.MinMaxDataElementService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.validation.ValidationRuleService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.period.PeriodService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.organisationunit.OrganisationUnitService.delete*(..) )"
-				method="intercept" />
-			<aop:before
-				pointcut="execution( * org.hisp.dhis.organisationunit.OrganisationUnitGroupService.delete*(..) )"
-				method="intercept" />
-			<aop:before pointcut="execution( * org.hisp.dhis.user.UserStore.delete*(..) )"
-				method="intercept" />
-			<aop:before pointcut="execution( * org.hisp.dhis.concept.ConceptService.delete*(..) )"
-				method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.datadictionary.DataDictionaryService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.dataelement.DataElementService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.dataelement.DataElementCategoryService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.dataset.DataSetService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.dataset.SectionService.delete*(..) )" method="intercept" />
+			<aop:before pointcut="execution( * org.hisp.dhis.indicator.IndicatorService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.expression.ExpressionService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.minmax.MinMaxDataElementService.delete*(..) )"	method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.validation.ValidationRuleService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.period.PeriodService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.organisationunit.OrganisationUnitService.delete*(..) )" method="intercept" />
+			<aop:before	pointcut="execution( * org.hisp.dhis.organisationunit.OrganisationUnitGroupService.delete*(..) )" method="intercept" />
+			<aop:before pointcut="execution( * org.hisp.dhis.user.UserService.delete*(..) )" method="intercept" />
+			<aop:before pointcut="execution( * org.hisp.dhis.concept.ConceptService.delete*(..) )" method="intercept" />
 		</aop:aspect>
 
 		<aop:aspect ref="statementInterceptor">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java	2011-05-28 11:57:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java	2011-05-28 18:05:39 +0000
@@ -115,6 +115,7 @@
         }
 
         section.setDataElements( selectedDataElements );
+        dataSet.getSections().add( section );
         sectionService.addSection( section );
 
         if ( dataSet.getMobile() != null && dataSet.getMobile() ) // TODO Hack

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java	2011-05-22 12:19:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java	2011-05-28 18:05:39 +0000
@@ -233,13 +233,12 @@
         if ( parent == null )
         {
             // -----------------------------------------------------------------
-            // If no unit is selected, the parent is the parent of the roots in
-            // the tree
+            // If no unit is selected, the parent is the parent of the roots
             // -----------------------------------------------------------------
 
             parent = selectionManager.getRootOrganisationUnitsParent();
         }
-
+        
         // ---------------------------------------------------------------------
         // Create organisation unit
         // ---------------------------------------------------------------------
@@ -255,6 +254,11 @@
         organisationUnit.setEmail( email );
         organisationUnit.setPhoneNumber( phoneNumber );
 
+        if ( parent != null )
+        {
+            parent.getChildren().add( organisationUnit );
+        }
+
         organisationUnitId = organisationUnitService.addOrganisationUnit( organisationUnit );
 
         for ( String id : dataSets )
@@ -264,6 +268,7 @@
             if ( dataSet != null )
             {
                 dataSet.getSources().add( organisationUnit );
+                organisationUnit.getDataSets().add( dataSet );
                 dataSetService.updateDataSet( dataSet );
             }
         }
@@ -275,6 +280,7 @@
             if ( group != null )
             {
                 group.getMembers().add( organisationUnit );
+                organisationUnit.getGroups().add( group );
                 organisationUnitGroupService.updateOrganisationUnitGroup( group );
             }
         }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java	2011-05-22 12:19:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java	2011-05-28 18:05:39 +0000
@@ -283,6 +283,7 @@
             if ( dataSet != null )
             {
                 dataSet.getSources().add( organisationUnit );
+                organisationUnit.getDataSets().add( dataSet );
                 dataSetService.updateDataSet( dataSet );
             }
         }
@@ -301,11 +302,13 @@
 
             if ( oldGroup != null && oldGroup.getMembers().remove( organisationUnit ) )
             {
+                organisationUnit.getGroups().remove( oldGroup );
                 organisationUnitGroupService.updateOrganisationUnitGroup( oldGroup );
             }
 
             if ( newGroup != null && newGroup.getMembers().add( organisationUnit ) )
             {
+                organisationUnit.getGroups().add( newGroup );
                 organisationUnitGroupService.updateOrganisationUnitGroup( newGroup );
             }
         }