← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1964: Enabled import analysis for DXF

 

------------------------------------------------------------
revno: 1964
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-06-03 19:31:53 +0200
message:
  Enabled import analysis for DXF
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/IndicatorConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.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-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java	2010-06-01 08:53:29 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java	2010-06-03 17:31:53 +0000
@@ -57,6 +57,8 @@
 import org.hisp.dhis.importexport.ImportObjectService;
 import org.hisp.dhis.importexport.ImportParams;
 import org.hisp.dhis.importexport.XMLConverter;
+import org.hisp.dhis.importexport.analysis.DefaultImportAnalyser;
+import org.hisp.dhis.importexport.analysis.ImportAnalyser;
 import org.hisp.dhis.importexport.invoker.ConverterInvoker;
 import org.hisp.dhis.importexport.mapping.NameMappingUtil;
 import org.hisp.dhis.importexport.mapping.ObjectMappingGenerator;
@@ -257,6 +259,8 @@
 
     public void read( XMLReader reader, ImportParams params, ProcessState state )
     {
+        ImportAnalyser importAnalyser = new DefaultImportAnalyser( expressionService );
+        
         NameMappingUtil.clearMapping();
 
         if ( params.isPreview() )
@@ -381,7 +385,7 @@
                 batchHandler.init();
 
                 XMLConverter converter = new DataElementConverter( batchHandler, importObjectService,
-                    objectMappingGenerator.getCategoryComboMapping( params.skipMapping() ), dataElementService );
+                    objectMappingGenerator.getCategoryComboMapping( params.skipMapping() ), dataElementService, importAnalyser );
 
                 converterInvoker.invokeRead( converter, reader, params );
 
@@ -524,7 +528,7 @@
                 XMLConverter converter = new IndicatorConverter( batchHandler, importObjectService, indicatorService,
                     expressionService, objectMappingGenerator.getIndicatorTypeMapping( params.skipMapping() ),
                     objectMappingGenerator.getDataElementMapping( params.skipMapping() ), objectMappingGenerator
-                        .getCategoryOptionComboMapping( params.skipMapping() ) );
+                        .getCategoryOptionComboMapping( params.skipMapping() ), importAnalyser );
 
                 converterInvoker.invokeRead( converter, reader, params );
 
@@ -731,7 +735,7 @@
                 batchHandler.init();
 
                 XMLConverter converter = new OrganisationUnitConverter( batchHandler, sourceBatchHandler,
-                    importObjectService, organisationUnitService );
+                    importObjectService, organisationUnitService, importAnalyser );
 
                 converterInvoker.invokeRead( converter, reader, params );
 
@@ -978,6 +982,11 @@
             }
         }
 
+        if ( params.isAnalysis() )
+        {
+            state.setOutput( importAnalyser.getImportAnalysis() );
+        }
+
         NameMappingUtil.clearMapping();
 
         cacheManager.clearCache();

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java	2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java	2010-06-03 17:31:53 +0000
@@ -40,6 +40,7 @@
 import org.hisp.dhis.importexport.ImportObjectService;
 import org.hisp.dhis.importexport.ImportParams;
 import org.hisp.dhis.importexport.XMLConverter;
+import org.hisp.dhis.importexport.analysis.ImportAnalyser;
 import org.hisp.dhis.importexport.importer.DataElementImporter;
 import org.hisp.dhis.system.util.DateUtils;
 
@@ -95,12 +96,14 @@
     public DataElementConverter( BatchHandler<DataElement> batchHandler, 
         ImportObjectService importObjectService,
         Map<Object, Integer> categoryComboMapping,
-        DataElementService dataElementService )
+        DataElementService dataElementService,
+        ImportAnalyser importAnalyser )
     {        
         this.batchHandler = batchHandler;
         this.importObjectService = importObjectService;
         this.categoryComboMapping = categoryComboMapping;
         this.dataElementService = dataElementService;
+        this.importAnalyser = importAnalyser;
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/IndicatorConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/IndicatorConverter.java	2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/IndicatorConverter.java	2010-06-03 17:31:53 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.importexport.ImportObjectService;
 import org.hisp.dhis.importexport.ImportParams;
 import org.hisp.dhis.importexport.XMLConverter;
+import org.hisp.dhis.importexport.analysis.ImportAnalyser;
 import org.hisp.dhis.importexport.importer.IndicatorImporter;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -112,7 +113,8 @@
         ExpressionService expressionService,
         Map<Object, Integer> indicatorTypeMapping, 
         Map<Object, Integer> dataElementMapping,
-        Map<Object, Integer> categoryOptionComboMapping )
+        Map<Object, Integer> categoryOptionComboMapping,
+        ImportAnalyser importAnalyser )
     {
         this.batchHandler = batchHandler;
         this.importObjectService = importObjectService;
@@ -121,6 +123,7 @@
         this.indicatorTypeMapping = indicatorTypeMapping;
         this.dataElementMapping = dataElementMapping;
         this.categoryOptionComboMapping = categoryOptionComboMapping;
+        this.importAnalyser = importAnalyser;
     }    
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java	2010-06-02 13:17:11 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java	2010-06-03 17:31:53 +0000
@@ -39,6 +39,7 @@
 import org.hisp.dhis.importexport.ImportObjectService;
 import org.hisp.dhis.importexport.ImportParams;
 import org.hisp.dhis.importexport.XMLConverter;
+import org.hisp.dhis.importexport.analysis.ImportAnalyser;
 import org.hisp.dhis.importexport.importer.OrganisationUnitImporter;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -92,12 +93,14 @@
     public OrganisationUnitConverter( BatchHandler<OrganisationUnit> batchHandler, 
         BatchHandler<Source> sourceBatchHandler, 
         ImportObjectService importObjectService, 
-        OrganisationUnitService organisationUnitService )
+        OrganisationUnitService organisationUnitService,
+        ImportAnalyser importAnalyser )
     {
         this.batchHandler = batchHandler;
         this.sourceBatchHandler = sourceBatchHandler;
         this.importObjectService = importObjectService;
         this.organisationUnitService = organisationUnitService;
+        this.importAnalyser = importAnalyser;
     }
     
     // -------------------------------------------------------------------------