dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12712
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3970: Made PeriodConvert more robust
------------------------------------------------------------
revno: 3970
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-06-21 14:38:28 +0200
message:
Made PeriodConvert more robust
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/PeriodConverter.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/PeriodConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/PeriodConverter.java 2010-10-29 14:40:59 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/PeriodConverter.java 2011-06-21 12:38:28 +0000
@@ -133,10 +133,18 @@
PeriodType periodType = new MonthlyPeriodType();
period.setPeriodType( periodType );
+
+ Integer periodTypeId = periodTypeMapping.get( values.get( FIELD_PERIOD_TYPE ) );
- if ( values.get( FIELD_PERIOD_TYPE ) != null && values.get( FIELD_PERIOD_TYPE ).equalsIgnoreCase( "relative" ) )
- {
- continue; // Backwards compatibility
+ if ( periodTypeId != null )
+ {
+ period.getPeriodType().setId( periodTypeId );
+ }
+ else
+ {
+ log.warn( "Unknow period type, falling back to Monthly: " + values.get( FIELD_PERIOD_TYPE ) );
+
+ period.getPeriodType().setId( periodTypeMapping.get( MonthlyPeriodType.NAME ) );
}
period.setId( Integer.parseInt( values.get( FIELD_ID ) ) );