← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12898: Fixed bug with update of analytical objects

 

------------------------------------------------------------
revno: 12898
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-11-07 18:16:55 +0100
message:
  Fixed bug with update of analytical objects
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.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/common/BaseAnalyticalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2013-09-17 16:22:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2013-11-07 17:16:55 +0000
@@ -579,6 +579,29 @@
         
         return StringUtils.join( ids, DIMENSION_SEP );
     }
+
+    /**
+     * Clear or set to false all persistent properties for this object.
+     */
+    public void clear()
+    {
+        indicators.clear();
+        dataElements.clear();
+        dataElementOperands.clear();
+        dataSets.clear();
+        periods.clear();
+        relatives = null;
+        organisationUnits.clear();
+        categoryDimensions.clear();
+        dataElementGroups.clear();
+        organisationUnitGroups.clear();
+        userOrganisationUnit = false;
+        userOrganisationUnitChildren = false;
+        userOrganisationUnitGrandChildren = false;
+        organisationUnitLevels.clear();
+        itemOrganisationUnitGroups.clear();
+        rewindRelativePeriods = false;
+    }
     
     @Override
     public void mergeWith( IdentifiableObject other )
@@ -589,37 +612,24 @@
         {
             BaseAnalyticalObject object = (BaseAnalyticalObject) other;
             
-            indicators.clear();
+            this.clear();
+            
             indicators.addAll( object.getIndicators() );
-
-            dataElements.clear();
             dataElements.addAll( object.getDataElements() );
-
-            dataElementOperands.clear();
             dataElementOperands.addAll( object.getDataElementOperands() );
-            
-            dataSets.clear();
             dataSets.addAll( object.getDataSets() );
-            
-            periods.clear();
             periods.addAll( object.getPeriods() );
-
             relatives = object.getRelatives() == null ? relatives : object.getRelatives();
-            
-            organisationUnits.clear();
             organisationUnits.addAll( object.getOrganisationUnits() );
-            
-            dataElementGroups.clear();
+            categoryDimensions.addAll( object.getCategoryDimensions() );
             dataElementGroups.addAll( object.getDataElementGroups() );
-            
-            organisationUnitGroups.clear();
             organisationUnitGroups.addAll( object.getOrganisationUnitGroups() );
-            
-            categoryDimensions.clear();
-            categoryDimensions.addAll( object.getCategoryDimensions() );
-            
             userOrganisationUnit = object.isUserOrganisationUnit();
             userOrganisationUnitChildren = object.isUserOrganisationUnitChildren();
+            userOrganisationUnitGrandChildren = object.isUserOrganisationUnitGrandChildren();
+            organisationUnitLevels.addAll( object.getOrganisationUnitLevels() );
+            itemOrganisationUnitGroups = object.getItemOrganisationUnitGroups();
+            rewindRelativePeriods = object.isRewindRelativePeriods();
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java	2013-09-24 09:43:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java	2013-11-07 17:16:55 +0000
@@ -181,16 +181,7 @@
     {
         if ( object != null )
         {
-            object.getIndicators().clear();
-            object.getDataElements().clear();
-            object.getDataElementOperands().clear();
-            object.getDataSets().clear();
-            object.getPeriods().clear();
-            object.setRelatives( null );
-            object.getOrganisationUnits().clear();
-            object.getCategoryDimensions().clear();
-            object.getDataElementGroups().clear();
-            object.getOrganisationUnitGroups().clear();
+            object.clear();
 
             if ( object.getUser() != null )
             {