dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12764
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3991: Made import of onchange periods from 1.4 more robust
------------------------------------------------------------
revno: 3991
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-06-22 21:12:48 +0200
message:
Made import of onchange periods from 1.4 more robust
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OnChangePeriodRowHandler.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/rowhandler/OnChangePeriodRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OnChangePeriodRowHandler.java 2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OnChangePeriodRowHandler.java 2011-06-22 19:12:48 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.importexport.importer.PeriodImporter;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.YearlyPeriodType;
import com.ibatis.sqlmap.client.event.RowHandler;
@@ -74,8 +75,11 @@
public void handleRow( Object object )
{
final Period period = (Period) object;
+
+ Integer periodTypeId = periodTypeMapping.get( period.getPeriodType().getName() );
+ Integer defaultId = periodTypeMapping.get( YearlyPeriodType.NAME );
- period.getPeriodType().setId( periodTypeMapping.get( period.getPeriodType().getName() ) ); // Could be onchange or other
+ period.getPeriodType().setId( periodTypeId != null ? periodTypeId : defaultId ); // Could be onchange or other
if ( Dhis14PeriodUtil.periodIsUnique( period ) )
{