← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17638: minor fix, check for dryRun in categoryDimension import

 

------------------------------------------------------------
revno: 17638
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-12-02 16:39:03 +0700
message:
  minor fix, check for dryRun in categoryDimension import
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.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-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2014-12-02 09:31:18 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2014-12-02 09:39:03 +0000
@@ -989,7 +989,11 @@
             {
                 List<DataElementCategoryDimension> detachedCategoryDimensions = ReflectionUtils.invokeMethod( object, getterMethod );
                 dataElementCategoryDimensions.addAll( detachedCategoryDimensions );
-                detachedCategoryDimensions.clear();
+
+                if ( !options.isDryRun() )
+                {
+                    detachedCategoryDimensions.clear();
+                }
             }
 
             return dataElementCategoryDimensions;
@@ -1011,8 +1015,11 @@
                     Map<Field, Collection<Object>> detachCollectionFields = detachCollectionFields( categoryDimension );
                     reattachCollectionFields( categoryDimension, detachCollectionFields );
 
-                    categoryDimension.setId( 0 );
-                    detachedCategoryDimensions.add( categoryDimension );
+                    if ( !options.isDryRun() )
+                    {
+                        categoryDimension.setId( 0 );
+                        detachedCategoryDimensions.add( categoryDimension );
+                    }
                 }
 
             }