dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17489
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6974: more fixes to importer
------------------------------------------------------------
revno: 6974
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-05-17 13:28:33 +0200
message:
more fixes to importer
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.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-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-05-17 09:11:30 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-05-17 11:28:33 +0000
@@ -140,7 +140,7 @@
doImport( metaData.getReports(), importOptions, importSummary );
doImport( metaData.getCharts(), importOptions, importSummary );
- // doImport( metaData.getMaps(), importOptions, importSummary );
+ doImport( metaData.getMaps(), importOptions, importSummary );
doImport( metaData.getMapLegends(), importOptions, importSummary );
doImport( metaData.getMapLegendSets(), importOptions, importSummary );
doImport( metaData.getMapLayers(), importOptions, importSummary );
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-05-17 09:11:30 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-05-17 11:28:33 +0000
@@ -31,12 +31,10 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
import org.hisp.dhis.attribute.AttributeStore;
-import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.common.annotation.Scanned;
-import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dxf2.importsummary.ImportConflict;
import org.hisp.dhis.dxf2.importsummary.ImportCount;
import org.hisp.dhis.dxf2.metadata.ImportOptions;
@@ -44,7 +42,6 @@
import org.hisp.dhis.dxf2.metadata.ObjectBridge;
import org.hisp.dhis.dxf2.utils.OrganisationUnitUtils;
import org.hisp.dhis.importexport.ImportStrategy;
-import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitComparator;
import org.hisp.dhis.period.Period;
@@ -52,7 +49,6 @@
import org.hisp.dhis.period.PeriodStore;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.system.util.ReflectionUtils;
-import org.hisp.dhis.user.User;
import org.springframework.beans.factory.annotation.Autowired;
import java.lang.reflect.Field;
@@ -214,11 +210,15 @@
for ( T object : objects )
{
- sessionFactory.getCurrentSession().flush();
log.info( "Currently importing: " + object + " (" + object.getClass().getSimpleName() + ")" );
List<ImportConflict> conflicts = importObjectLocal( object, options );
+ if ( !options.isDryRun() )
+ {
+ sessionFactory.getCurrentSession().flush();
+ }
+
if ( !conflicts.isEmpty() )
{
importConflicts.addAll( conflicts );
@@ -459,9 +459,11 @@
else if ( Period.class.isAssignableFrom( identifiableObject.getClass() ) )
{
Period period = (Period) identifiableObject;
-
- // return periodStore.reloadForceAddPeriod( period );
- return null;
+ period = periodStore.reloadForceAddPeriod( period );
+
+ sessionFactory.getCurrentSession().flush();
+
+ return period;
}
return objectBridge.getObject( identifiableObject );