dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06208
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1943: Fixed bug with import analyser
------------------------------------------------------------
revno: 1943
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Tue 2010-06-01 15:12:21 +0200
message:
Fixed bug with import analyser
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/analysis/DefaultImportAnalyser.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/analysis/ImportAnalyserTest.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/analysis/DefaultImportAnalyser.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/analysis/DefaultImportAnalyser.java 2010-06-01 11:04:02 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/analysis/DefaultImportAnalyser.java 2010-06-01 13:12:21 +0000
@@ -63,13 +63,9 @@
private static final String SEPARARATOR = "-";
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
private ExpressionService expressionService;
- public void setExpressionService( ExpressionService expressionService )
+ public DefaultImportAnalyser( ExpressionService expressionService )
{
this.expressionService = expressionService;
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java 2010-06-01 08:53:29 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java 2010-06-01 13:12:21 +0000
@@ -58,6 +58,7 @@
import org.hisp.dhis.importexport.ImportObjectService;
import org.hisp.dhis.importexport.ImportParams;
import org.hisp.dhis.importexport.ImportService;
+import org.hisp.dhis.importexport.analysis.DefaultImportAnalyser;
import org.hisp.dhis.importexport.analysis.ImportAnalyser;
import org.hisp.dhis.importexport.dhis14.file.query.QueryManager;
import org.hisp.dhis.importexport.dhis14.file.rowhandler.CalculatedDataElementRowHandler;
@@ -226,16 +227,11 @@
this.dataMartService = dataMartService;
}
- private ImportAnalyser importAnalyser;
-
- public void setImportAnalyser( ImportAnalyser importAnalyser )
- {
- this.importAnalyser = importAnalyser;
- }
-
@Autowired
private HibernateCacheManager cacheManager;
+ private ImportAnalyser importAnalyser;
+
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
@@ -257,6 +253,8 @@
{
NameMappingUtil.clearMapping();
+ importAnalyser = new DefaultImportAnalyser( expressionService );
+
if ( !verifyImportFile( params, state ) )
{
return;
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java 2010-06-01 08:53:29 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java 2010-06-01 13:12:21 +0000
@@ -53,6 +53,7 @@
import org.hisp.dhis.importexport.ImportDataValue;
import org.hisp.dhis.importexport.ImportObjectService;
import org.hisp.dhis.importexport.ImportParams;
+import org.hisp.dhis.importexport.analysis.ImportAnalyser;
import org.hisp.dhis.importexport.importer.DataValueImporter;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
@@ -101,11 +102,13 @@
public DataValueConverter( BatchHandler<ImportDataValue> importDataValueBatchHandler,
DataElementCategoryService categoryService,
ImportObjectService importObjectService,
+ ImportAnalyser importAnalyser,
ImportParams params )
{
this.importDataValueBatchHandler = importDataValueBatchHandler;
this.categoryService = categoryService;
this.importObjectService = importObjectService;
+ this.importAnalyser = importAnalyser;
this.params = params;
this.dataElementMapping = new MimicingHashMap<Object, Integer>();
this.periodMapping = new MimicingHashMap<Object, Integer>();
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java 2010-06-01 08:53:29 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java 2010-06-01 13:12:21 +0000
@@ -44,12 +44,14 @@
import org.hisp.dhis.common.ProcessState;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.importexport.CSVConverter;
import org.hisp.dhis.importexport.ImportDataValue;
import org.hisp.dhis.importexport.ImportObjectService;
import org.hisp.dhis.importexport.ImportParams;
import org.hisp.dhis.importexport.ImportService;
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.dhis14.xml.converter.CalculatedDataElementAssociationConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataElementCategoryComboConverter;
@@ -147,16 +149,6 @@
this.objectMappingGenerator = objectMappingGenerator;
}
- private ImportAnalyser importAnalyser;
-
- public void setImportAnalyser( ImportAnalyser importAnalyser )
- {
- this.importAnalyser = importAnalyser;
- }
-
- @Autowired
- private HibernateCacheManager cacheManager;
-
private ConverterInvoker converterInvoker;
public void setConverterInvoker( ConverterInvoker converterInvoker )
@@ -164,6 +156,18 @@
this.converterInvoker = converterInvoker;
}
+ private ExpressionService expressionService;
+
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
+
+ @Autowired
+ private HibernateCacheManager cacheManager;
+
+ private ImportAnalyser importAnalyser;
+
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
@@ -186,6 +190,8 @@
{
NameMappingUtil.clearMapping();
+ importAnalyser = new DefaultImportAnalyser( expressionService );
+
if ( !( params.isPreview() || params.isAnalysis() ) )
{
throw new RuntimeException( "Only preview mode allowed for DHIS 1.4 XML import" );
@@ -290,6 +296,7 @@
CSVConverter dataValueConverter = new DataValueConverter( importDataValueBatchHandler,
categoryService,
importObjectService,
+ importAnalyser,
params );
dataValueConverter.read( streamReader, params );
=== 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 2010-06-01 11:04:02 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2010-06-01 13:12:21 +0000
@@ -148,10 +148,9 @@
<property name="batchHandlerFactory" ref="batchHandlerFactory" />
<property name="objectMappingGenerator"
ref="org.hisp.dhis.importexport.mapping.ObjectMappingGenerator" />
- <property name="importAnalyser"
- ref="org.hisp.dhis.importexport.analysis.ImportAnalyser" />
<property name="converterInvoker"
ref="org.hisp.dhis.importexport.invoker.ConverterInvoker" />
+ <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService"/>
</bean>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
@@ -187,8 +186,6 @@
ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
<property name="dataMartService" ref="org.hisp.dhis.datamart.DataMartService" />
- <property name="importAnalyser"
- ref="org.hisp.dhis.importexport.analysis.ImportAnalyser" />
</bean>
<bean
@@ -332,16 +329,6 @@
</bean>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Analyser -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-
- <bean id="org.hisp.dhis.importexport.analysis.ImportAnalyser"
- class="org.hisp.dhis.importexport.analysis.DefaultImportAnalyser"
- scope="prototype">
- <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
- </bean>
-
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Locking -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/analysis/ImportAnalyserTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/analysis/ImportAnalyserTest.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/analysis/ImportAnalyserTest.java 2010-06-01 13:12:21 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.DhisTest;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -49,8 +50,10 @@
public class ImportAnalyserTest
extends DhisTest
{
+ private ExpressionService expressionService;
+
private ImportAnalyser analyser;
-
+
// -------------------------------------------------------------------------
// Fixture
// -------------------------------------------------------------------------
@@ -58,7 +61,9 @@
@Override
public void setUpTest()
{
- analyser = (ImportAnalyser) getBean( ImportAnalyser.ID );
+ expressionService = (ExpressionService) getBean( ExpressionService.ID );
+
+ analyser = new DefaultImportAnalyser( expressionService );
}
// -------------------------------------------------------------------------