← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2075: Relaxed requirement for aggregation operator in dhis14 file import

 

------------------------------------------------------------
revno: 2075
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2010-11-16 15:52:41 +0100
message:
  Relaxed requirement for aggregation operator in dhis14 file import
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/typehandler/AggregationOperatorTypeHandler.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/dhis14/file/typehandler/AggregationOperatorTypeHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/typehandler/AggregationOperatorTypeHandler.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/typehandler/AggregationOperatorTypeHandler.java	2010-11-16 14:52:41 +0000
@@ -29,6 +29,8 @@
 
 import java.sql.SQLException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dataelement.DataElement;
 
 import com.ibatis.sqlmap.client.extensions.ParameterSetter;
@@ -46,7 +48,9 @@
     private static final String JDBC_AVERAGE = "Avg";
     private static final String JDBC_COUNT = "Count";
     
-    static final Integer NON_EXISTING = -1;
+    private static final Integer NON_EXISTING = -1;
+    
+    private static final Log log = LogFactory.getLog( AggregationOperatorTypeHandler.class );
     
     // -------------------------------------------------------------------------
     // TypeHandlerCallback implementation
@@ -73,12 +77,16 @@
             }
             else
             {
-                throw new RuntimeException( "Illegal aggregation operator: " + result );
+                log.warn( "Unknow aggregation operator, returning sum " + result );
+                
+                return DataElement.AGGREGATION_OPERATOR_SUM;
             }
         }
         else
         {
-            throw new RuntimeException( "Aggregation operator is not present" );
+            log.warn( "Aggregation operator is null, returning sum " + result );
+            
+            return DataElement.AGGREGATION_OPERATOR_SUM;
         }
     }