dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18435
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7774: fixes to meta-data importer
------------------------------------------------------------
revno: 7774
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-07-31 00:03:07 +0200
message:
fixes to meta-data importer
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
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-api/src/main/java/org/hisp/dhis/dataset/Section.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2012-06-26 12:06:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2012-07-30 22:03:07 +0000
@@ -255,7 +255,7 @@
{
Section section = (Section) other;
- dataSet = section.getDataSet() == null ? dataSet : section.getDataSet();
+ dataSet = section.getDataSet();
removeAllDataElements();
=== 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-07-04 20:16:23 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-07-30 22:03:07 +0000
@@ -108,12 +108,14 @@
objectBridge.setWriteEnabled( false );
}
- log.info( "User '" + currentUserService.getCurrentUsername() + "' started import at " + new Date() );
-
- if(taskId != null)
+ if ( taskId != null )
{
notifier.notify( taskId, TaskCategory.METADATA_IMPORT, "Importing meta-data" );
}
+ else
+ {
+ log.info( "User '" + currentUserService.getCurrentUsername() + "' started import at " + new Date() );
+ }
for ( Map.Entry<Class<? extends IdentifiableObject>, String> entry : ExchangeClasses.getImportMap().entrySet() )
{
@@ -129,10 +131,14 @@
{
String message = "Importing " + objects.size() + " " + StringUtils.capitalize( entry.getValue() );
- if(taskId != null)
+ if ( taskId != null )
{
notifier.notify( taskId, TaskCategory.METADATA_IMPORT, message );
}
+ else
+ {
+ log.info( message );
+ }
ImportTypeSummary importTypeSummary = doImport( objects, importOptions );
@@ -162,11 +168,15 @@
cacheManager.clearCache();
objectBridge.destroy();
- if(taskId != null)
+ if ( taskId != null )
{
notifier.notify( taskId, TaskCategory.METADATA_IMPORT, NotificationLevel.INFO, "Import done", true ).
addTaskSummary( taskId, TaskCategory.METADATA_IMPORT, importSummary );
}
+ else
+ {
+ log.info( "Import done." );
+ }
return 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-06-28 09:21:53 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-07-30 22:03:07 +0000
@@ -332,11 +332,12 @@
Map<Field, Object> fields = detachFields( object );
Map<Field, Collection<Object>> collectionFields = detachCollectionFields( object );
+ reattachFields( object, fields );
+
log.debug( "Trying to save new object => " + ImportUtils.getDisplayName( object ) + " (" + object.getClass().getSimpleName() + ")" );
objectBridge.saveObject( object );
updatePeriodTypes( object );
- reattachFields( object, fields );
reattachCollectionFields( object, collectionFields );
objectBridge.updateObject( object );
@@ -369,10 +370,11 @@
Map<Field, Object> fields = detachFields( object );
Map<Field, Collection<Object>> collectionFields = detachCollectionFields( object );
+ reattachFields( object, fields );
+
persistedObject.mergeWith( object );
updatePeriodTypes( persistedObject );
- reattachFields( persistedObject, fields );
reattachCollectionFields( persistedObject, collectionFields );
log.debug( "Starting update of object " + ImportUtils.getDisplayName( persistedObject ) + " (" + persistedObject.getClass()