← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1122: Removed commented code

 

------------------------------------------------------------
revno: 1122
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-11-25 10:34:14 +0100
message:
  Removed commented code
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/importer/DefaultDXFImportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml


--
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-importexport/src/main/java/org/hisp/dhis/importexport/dxf/importer/DefaultDXFImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/importer/DefaultDXFImportService.java	2009-11-24 13:01:57 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/importer/DefaultDXFImportService.java	2009-11-25 09:34:14 +0000
@@ -107,7 +107,6 @@
 import org.hisp.dhis.importexport.dxf.converter.ValidationRuleConverter;
 import org.hisp.dhis.importexport.dxf2.importer.Parser;
 import org.hisp.dhis.importexport.invoker.ConverterInvoker;
-import org.hisp.dhis.importexport.locking.LockingManager;
 import org.hisp.dhis.importexport.mapping.NameMappingUtil;
 import org.hisp.dhis.importexport.mapping.ObjectMappingGenerator;
 import org.hisp.dhis.indicator.Indicator;
@@ -305,14 +304,6 @@
         this.objectMappingGenerator = objectMappingGenerator;
     }
 
-    @SuppressWarnings( "unused" )
-    private LockingManager lockingManager;
-
-    public void setLockingManager( LockingManager lockingManager )
-    {
-        this.lockingManager = lockingManager;
-    }
-
     private HibernateCacheManager cacheManager;
 
     public void setCacheManager( HibernateCacheManager cacheManager )
@@ -1191,39 +1182,30 @@
             }
             else if ( reader.isStartElement( DataValueConverter.COLLECTION_NAME ) && params.isDataValues() )
             {
-                /*if ( params.skipMapping() == false && lockingManager.currentImportContainsLockedData() )
-                {
-                    // setMessage( "import_contains_data_for_locked_periods" );
-
-                    log.warn( "Skipped DataValues because import file contained DataValues for locked Period, Organisation Unit and DataSet combinations" );
-                }
-                else */ //TODO too slow
-                {
-                    BatchHandler<DataValue> batchHandler = batchHandlerFactory
-                        .createBatchHandler( DataValueBatchHandler.class );
-
-                    BatchHandler<ImportDataValue> importDataValueBatchHandler = batchHandlerFactory
-                        .createBatchHandler( ImportDataValueBatchHandler.class );
-
-                    batchHandler.init();
-
-                    importDataValueBatchHandler.init();
-
-                    XMLConverter converter = new DataValueConverter( batchHandler, importDataValueBatchHandler,
-                        dataValueService, dataMartService, importObjectService, params, objectMappingGenerator
-                            .getDataElementMapping( params.skipMapping() ), objectMappingGenerator
-                            .getPeriodMapping( params.skipMapping() ), objectMappingGenerator
-                            .getOrganisationUnitMapping( params.skipMapping() ), objectMappingGenerator
-                            .getCategoryOptionComboMapping( params.skipMapping() ) );
-
-                    converterInvoker.invokeRead( converter, reader, params );
-
-                    batchHandler.flush();
-
-                    importDataValueBatchHandler.flush();
-
-                    log.info( "Imported DataValues" );
-                }
+                BatchHandler<DataValue> batchHandler = batchHandlerFactory
+                    .createBatchHandler( DataValueBatchHandler.class );
+
+                BatchHandler<ImportDataValue> importDataValueBatchHandler = batchHandlerFactory
+                    .createBatchHandler( ImportDataValueBatchHandler.class );
+
+                batchHandler.init();
+
+                importDataValueBatchHandler.init();
+
+                XMLConverter converter = new DataValueConverter( batchHandler, importDataValueBatchHandler,
+                    dataValueService, dataMartService, importObjectService, params, objectMappingGenerator
+                        .getDataElementMapping( params.skipMapping() ), objectMappingGenerator
+                        .getPeriodMapping( params.skipMapping() ), objectMappingGenerator
+                        .getOrganisationUnitMapping( params.skipMapping() ), objectMappingGenerator
+                        .getCategoryOptionComboMapping( params.skipMapping() ) );
+
+                converterInvoker.invokeRead( converter, reader, params );
+
+                batchHandler.flush();
+
+                importDataValueBatchHandler.flush();
+
+                log.info( "Imported DataValues" );
             }
         }
     }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java	2009-11-23 10:37:57 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java	2009-11-25 09:34:14 +0000
@@ -60,7 +60,6 @@
 import org.hisp.dhis.importexport.ImportObjectManager;
 import org.hisp.dhis.importexport.ImportObjectStatus;
 import org.hisp.dhis.importexport.ImportObjectStore;
-import org.hisp.dhis.importexport.locking.LockingManager;
 import org.hisp.dhis.importexport.mapping.GroupMemberAssociationVerifier;
 import org.hisp.dhis.importexport.mapping.NameMappingUtil;
 import org.hisp.dhis.importexport.mapping.ObjectMappingGenerator;
@@ -203,14 +202,6 @@
         this.importDataValueService = importDataValueService;
     }
 
-    @SuppressWarnings( "unused" )
-    private LockingManager lockingManager;
-
-    public void setLockingManager( LockingManager lockingManager )
-    {
-        this.lockingManager = lockingManager;
-    }
-
     // -------------------------------------------------------------------------
     // ImportObjectManager implementation
     // -------------------------------------------------------------------------
@@ -1330,50 +1321,42 @@
     @Transactional
     public void importDataValues()
     {
-        /*
-        if ( lockingManager.currentImportContainsLockedData() )
-        {
-            log.warn( "Import file contained DataValues for locked periods" );
-        }
-        else*/ //TODO too slow
-        {
-            BatchHandler<DataValue> batchHandler = batchHandlerFactory.createBatchHandler( DataValueBatchHandler.class );
-            
-            batchHandler.init();
-            
-            Map<Object, Integer> dataElementMapping = objectMappingGenerator.getDataElementMapping( false );
-            Map<Object, Integer> periodMapping = objectMappingGenerator.getPeriodMapping( false );
-            Map<Object, Integer> sourceMapping = objectMappingGenerator.getOrganisationUnitMapping( false );
-            Map<Object, Integer> categoryOptionComboMapping = objectMappingGenerator.getCategoryOptionComboMapping( false );
-            
-            Collection<ImportDataValue> importValues = importDataValueService.getImportDataValues( ImportObjectStatus.NEW );
-            
-            for ( ImportDataValue importValue : importValues )
+        BatchHandler<DataValue> batchHandler = batchHandlerFactory.createBatchHandler( DataValueBatchHandler.class );
+        
+        batchHandler.init();
+        
+        Map<Object, Integer> dataElementMapping = objectMappingGenerator.getDataElementMapping( false );
+        Map<Object, Integer> periodMapping = objectMappingGenerator.getPeriodMapping( false );
+        Map<Object, Integer> sourceMapping = objectMappingGenerator.getOrganisationUnitMapping( false );
+        Map<Object, Integer> categoryOptionComboMapping = objectMappingGenerator.getCategoryOptionComboMapping( false );
+        
+        Collection<ImportDataValue> importValues = importDataValueService.getImportDataValues( ImportObjectStatus.NEW );
+        
+        for ( ImportDataValue importValue : importValues )
+        {
+            DataValue value = importValue.getDataValue();
+            
+            value.getDataElement().setId( dataElementMapping.get( value.getDataElement().getId() ) );
+            value.getPeriod().setId( periodMapping.get( value.getPeriod().getId() ) );
+            value.getSource().setId( sourceMapping.get( value.getSource().getId() ) );
+            value.getOptionCombo().setId( categoryOptionComboMapping.get( value.getOptionCombo().getId() ) );
+            
+            // -------------------------------------------------------------
+            // Must check for existing datavalues since this cannot be done
+            // during preview
+            // -------------------------------------------------------------
+            
+            if ( !batchHandler.objectExists( value ) )
             {
-                DataValue value = importValue.getDataValue();
-                
-                value.getDataElement().setId( dataElementMapping.get( value.getDataElement().getId() ) );
-                value.getPeriod().setId( periodMapping.get( value.getPeriod().getId() ) );
-                value.getSource().setId( sourceMapping.get( value.getSource().getId() ) );
-                value.getOptionCombo().setId( categoryOptionComboMapping.get( value.getOptionCombo().getId() ) );
-                
-                // -------------------------------------------------------------
-                // Must check for existing datavalues since this cannot be done
-                // during preview
-                // -------------------------------------------------------------
-                
-                if ( !batchHandler.objectExists( value ) )
-                {
-                    batchHandler.addObject( value );
-                }
+                batchHandler.addObject( value );
             }
-            
-            batchHandler.flush();
-            
-            importDataValueService.deleteImportDataValues();
-            
-            log.info( "Imported DataValues" );
         }
+        
+        batchHandler.flush();
+        
+        importDataValueService.deleteImportDataValues();
+        
+        log.info( "Imported DataValues" );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml	2009-11-23 17:06:09 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml	2009-11-25 09:34:14 +0000
@@ -123,8 +123,6 @@
 		<property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
 		<property name="importDataValueService"
 			ref="org.hisp.dhis.importexport.ImportDataValueService" />
-		<property name="lockingManager"
-			ref="org.hisp.dhis.importexport.locking.LockingManager" />
 	</bean>
 
 	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
@@ -294,8 +292,6 @@
 		<property name="batchHandlerFactory" ref="batchHandlerFactory" />
 		<property name="objectMappingGenerator"
 			ref="org.hisp.dhis.importexport.mapping.ObjectMappingGenerator" />
-		<property name="lockingManager"
-			ref="org.hisp.dhis.importexport.locking.LockingManager" />
 		<property name="cacheManager" ref="org.hisp.dhis.cache.HibernateCacheManager" />
 		<property name="converterInvoker"
 			ref="org.hisp.dhis.importexport.invoker.ConverterInvoker" />