← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18045: use clearSharing parameter for dxf2 importer

 

------------------------------------------------------------
revno: 18045
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-01-19 16:19:46 +0700
message:
  use clearSharing parameter for dxf2 importer
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ObjectBridge.java
  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/DefaultObjectBridge.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2015-01-19 09:19:46 +0000
@@ -288,11 +288,17 @@
     @Override
     public void saveObject( Object object )
     {
+        saveObject( object, true );
+    }
+
+    @Override
+    public void saveObject( Object object, boolean clearSharing )
+    {
         if ( _typeSupported( object.getClass() ) && IdentifiableObject.class.isInstance( object ) )
         {
             if ( writeEnabled )
             {
-                manager.save( (IdentifiableObject) object );
+                manager.save( (IdentifiableObject) object, clearSharing );
             }
 
             _updateInternalMaps( object, false );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ObjectBridge.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ObjectBridge.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ObjectBridge.java	2015-01-19 09:19:46 +0000
@@ -51,6 +51,13 @@
     void saveObject( Object object );
 
     /**
+     * Save object. Will save to persistence layer if {@code writeEnabled} is {@code true}.
+     *
+     * @param object Object to write
+     */
+    void saveObject( Object object, boolean clearSharing );
+
+    /**
      * Update object. Will save to persistence layer if {@code writeEnabled} is {@code true}.
      *
      * @param object Object to update

=== 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	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2015-01-19 09:19:46 +0000
@@ -336,7 +336,8 @@
 
         log.debug( "Trying to save new object => " + ImportUtils.getDisplayName( object ) + " (" + object.getClass().getSimpleName() + ")" +
             "" );
-        objectBridge.saveObject( object );
+
+        objectBridge.saveObject( object, !options.isSharing() );
 
         updatePeriodTypes( object );
         reattachCollectionFields( object, collectionFields, user );