← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2059: Merges bugfixes from 2.0.5 revisions 2081..2085

 

------------------------------------------------------------
revno: 2059
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-15 15:01:36 +0100
message:
  Merges bugfixes from 2.0.5 revisions 2081..2085
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.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/file/query/IbatisQueryManager.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/IndicatorConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.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/DefaultImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java	2010-11-15 14:01:36 +0000
@@ -186,6 +186,8 @@
         }
         catch ( IOException ex )
         {
+            log.error( ex );
+            
             throw new ImportException( "Failed to import stream", ex );
         }
         finally

=== 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-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java	2010-11-15 14:01:36 +0000
@@ -317,7 +317,8 @@
         }
         catch ( Exception ex )
         {
-            log.info( ex );
+            log.error( ex );
+         
             throw new ImportException( "DHIS14 import failed", ex );
         }
     }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/query/IbatisQueryManager.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/query/IbatisQueryManager.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/query/IbatisQueryManager.java	2010-11-15 14:01:36 +0000
@@ -74,6 +74,8 @@
         }        
         catch ( SQLException ex )
         {
+            ex.printStackTrace();
+            
             throw new RuntimeException( "Query for Object failed", ex );
         }
         finally
@@ -105,6 +107,8 @@
         }
         catch ( SQLException ex )
         {
+            ex.printStackTrace();
+            
             throw new RuntimeException( "Query for List failed", ex );
         }
         finally
@@ -141,6 +145,8 @@
         }        
         catch ( SQLException ex )
         {
+            ex.printStackTrace();
+            
             throw new RuntimeException( "Query with RowHandler failed", ex );
         }
         finally

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/IndicatorConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/IndicatorConverter.java	2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/IndicatorConverter.java	2010-11-15 14:01:36 +0000
@@ -39,6 +39,7 @@
 
 import org.amplecode.staxwax.reader.XMLReader;
 import org.amplecode.staxwax.writer.XMLWriter;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.ImportObjectService;
 import org.hisp.dhis.importexport.ImportParams;
@@ -98,6 +99,8 @@
     private Map<Object, Integer> dataElementMapping;
     private Map<Object, String> dataElementAggregationOperatorMap;
     
+    private DataElementCategoryOptionCombo categoryOptionCombo;
+    
     // -------------------------------------------------------------------------
     // Constructor
     // -------------------------------------------------------------------------
@@ -118,7 +121,8 @@
      */
     public IndicatorConverter( ImportObjectService importObjectService,
         IndicatorService indicatorService,
-        ImportAnalyser importAnalyser )
+        ImportAnalyser importAnalyser,
+        DataElementCategoryOptionCombo categoryOptionCombo )
     {
         this.importObjectService = importObjectService;
         this.indicatorTypeMapping = new MimicingHashMap<Object, Integer>();
@@ -126,6 +130,7 @@
         this.dataElementAggregationOperatorMap = NameMappingUtil.getDataElementAggregationOperatorMap();
         this.indicatorService = indicatorService;
         this.importAnalyser = importAnalyser;
+        this.categoryOptionCombo = categoryOptionCombo;
     }
 
     // -------------------------------------------------------------------------
@@ -196,8 +201,8 @@
         indicator.setNumeratorAggregationOperator( numeratorAggregationOperator != null ? numeratorAggregationOperator : AGGREGATION_OPERATOR_SUM );
         indicator.setDenominatorAggregationOperator( denominatorAggregationOperator != null ? denominatorAggregationOperator : AGGREGATION_OPERATOR_SUM );
         
-        indicator.setNumerator( convertExpressionFromDhis14( values.get( FIELD_NUMERATOR ), dataElementMapping, 1, indicator.getName() ) );
-        indicator.setDenominator( convertExpressionFromDhis14( values.get( FIELD_DENOMINATOR ), dataElementMapping, 1, indicator.getName() ) );
+        indicator.setNumerator( convertExpressionFromDhis14( values.get( FIELD_NUMERATOR ), dataElementMapping, categoryOptionCombo.getId(), indicator.getName() ) );
+        indicator.setDenominator( convertExpressionFromDhis14( values.get( FIELD_DENOMINATOR ), dataElementMapping, categoryOptionCombo.getId(), indicator.getName() ) );
 
         indicator.setSortOrder( parseInt( values.get( FIELD_SORT_ORDER ) ) );
         indicator.setLastUpdated( Dhis14DateUtil.getDate( values.get( FIELD_LAST_UPDATED ) ) );

=== 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-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java	2010-11-15 14:01:36 +0000
@@ -42,6 +42,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.cache.HibernateCacheManager;
 import org.hisp.dhis.common.ProcessState;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.expression.ExpressionService;
@@ -190,7 +191,9 @@
     }
     
     public void importData( ImportParams params, InputStream inputStream, ProcessState state )
-    {        
+    {   
+        DataElementCategoryOptionCombo defaultCategoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
+        
         NameMappingUtil.clearMapping();
         
         importAnalyser = new DefaultImportAnalyser( expressionService );
@@ -237,7 +240,7 @@
                 XMLConverter dataElementConverter = new DataElementConverter( 
                     importObjectService, dataElementService, categoryService, expressionMap, importAnalyser );
                 XMLConverter indicatorTypeConverter = new IndicatorTypeConverter( importObjectService, indicatorService );
-                XMLConverter indicatorConverter = new IndicatorConverter( importObjectService, indicatorService, importAnalyser );
+                XMLConverter indicatorConverter = new IndicatorConverter( importObjectService, indicatorService, importAnalyser, defaultCategoryOptionCombo );
                 XMLConverter organisationUnitConverter = new OrganisationUnitConverter( importObjectService, organisationUnitService, importAnalyser );
                 XMLConverter hierarchyConverter = new OrganisationUnitHierarchyConverter( importObjectService, organisationUnitService );
                 XMLConverter periodConverter = new PeriodConverter( importObjectService, periodService, objectMappingGenerator.getPeriodTypeMapping() );