← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6490: Minor fix to import

 

------------------------------------------------------------
revno: 6490
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-05 13:56:10 +0200
message:
  Minor fix to import
modified:
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/ConstantImporter.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-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java	2012-04-04 17:50:32 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java	2012-04-05 11:56:10 +0000
@@ -27,12 +27,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.List;
+
 import org.hisp.dhis.dxf2.importsummary.ImportConflict;
 import org.hisp.dhis.dxf2.importsummary.ImportCount;
 
-import java.util.Collection;
-import java.util.List;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java	2012-04-05 10:24:25 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java	2012-04-05 11:56:10 +0000
@@ -50,7 +50,7 @@
 public abstract class AbstractImporter<T extends BaseIdentifiableObject>
     implements Importer<T>
 {
-    private static final Log LOG = LogFactory.getLog( AbstractImporter.class );
+    private static final Log log = LogFactory.getLog( AbstractImporter.class );
 
     //-------------------------------------------------------------------------------------------------------
     // Dependencies
@@ -114,7 +114,7 @@
     {
         if ( !objects.isEmpty() )
         {
-            Object object = objects.get( 0 );
+            T object = objects.get( 0 );
             reset( object );
         }
 
@@ -160,15 +160,15 @@
     // Internal methods
     //-------------------------------------------------------------------------------------------------------
 
-    private void reset( Object type )
+    private void reset( T type )
     {
         imports = 0;
         updates = 0;
         ignores = 0;
-
-        uidMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.UID );
-        nameMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.NAME );
-        codeMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.CODE );
+        
+        uidMap = manager.getIdMap( (Class<T>) type.getClass(), IdentifiableObject.IdentifiableProperty.UID );
+        nameMap = manager.getIdMap( (Class<T>) type.getClass(), IdentifiableObject.IdentifiableProperty.NAME );
+        codeMap = manager.getIdMap( (Class<T>) type.getClass(), IdentifiableObject.IdentifiableProperty.CODE );
     }
 
     private ImportConflict importObjectLocal( T object, ImportOptions options )

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/ConstantImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/ConstantImporter.java	2012-04-05 09:34:45 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/ConstantImporter.java	2012-04-05 11:56:10 +0000
@@ -41,18 +41,18 @@
 public class ConstantImporter
     extends AbstractImporter<Constant>
 {
-    private static final Log LOG = LogFactory.getLog( ConstantImporter.class );
+    private static final Log log = LogFactory.getLog( ConstantImporter.class );
 
     @Override
     protected ImportConflict newObject( Constant constant, ImportOptions options )
     {
-        LOG.info( "NEW OBJECT: " + constant );
+        log.info( "NEW OBJECT: " + constant );
 
         if ( !options.isDryRun() )
         {
-            LOG.info( "Trying to save new object with UID: " + constant.getUid() );
+            log.info( "Trying to save new object with UID: " + constant.getUid() );
             manager.save( constant );
-            LOG.info( "Save successful." );
+            log.info( "Save successful." );
         }
 
         return null;
@@ -65,9 +65,9 @@
 
         if ( !options.isDryRun() )
         {
-            LOG.info( "Trying to update object with UID: " + oldConstant.getUid() );
+            log.info( "Trying to update object with UID: " + oldConstant.getUid() );
             manager.update( oldConstant );
-            LOG.info( "Update successful." );
+            log.info( "Update successful." );
         }
 
         return null;