dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17950
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7359: Made ignoreCount work correctly in metaData import. Also made importer not log imports with count 0.
------------------------------------------------------------
revno: 7359
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-06-23 18:51:43 +0300
message:
Made ignoreCount work correctly in metaData import. Also made importer not log imports with count 0.
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-06-05 15:36:07 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-06-23 15:51:43 +0000
@@ -100,14 +100,18 @@
if ( Collection.class.isAssignableFrom( value.getClass() ) )
{
List<?> objects = new ArrayList<Object>( (Collection<?>) value );
- log.info( "Importing " + objects.size() + " " + StringUtils.capitalize( entry.getValue() ) );
-
- ImportTypeSummary importTypeSummary = doImport( objects, importOptions );
-
- if ( importTypeSummary != null )
+
+ if ( !objects.isEmpty() )
{
- importSummary.getImportTypeSummaries().add( importTypeSummary );
- importSummary.incrementImportCount( importTypeSummary.getImportCount() );
+ log.info( "Importing " + objects.size() + " " + StringUtils.capitalize( entry.getValue() ) );
+
+ ImportTypeSummary importTypeSummary = doImport( objects, importOptions );
+
+ if ( importTypeSummary != null )
+ {
+ importSummary.getImportTypeSummaries().add( importTypeSummary );
+ importSummary.incrementImportCount( importTypeSummary.getImportCount() );
+ }
}
}
else
=== 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-06 11:36:25 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-06-23 15:51:43 +0000
@@ -160,7 +160,7 @@
* @param oldObject The current version of the object
* @return An ImportConflict instance if there was a conflict, otherwise null
*/
- protected boolean updatedObject( T object, T oldObject )
+ protected boolean updateObject( T object, T oldObject )
{
log.debug( "Starting update of object " + ImportUtils.getDisplayName( oldObject ) + " (" + oldObject.getClass()
.getSimpleName() + ")" );
@@ -466,7 +466,7 @@
}
else if ( ImportStrategy.UPDATES.equals( options.getImportStrategy() ) )
{
- if ( updatedObject( object, oldObject ) )
+ if ( updateObject( object, oldObject ) )
{
summaryType.incrementUpdated();
}
@@ -475,7 +475,7 @@
{
if ( oldObject != null )
{
- if ( updatedObject( object, oldObject ) )
+ if ( updateObject( object, oldObject ) )
{
summaryType.incrementUpdated();
}
@@ -557,6 +557,8 @@
if ( conflict != null )
{
summaryType.getImportConflicts().add( conflict );
+
+ return false;
}
return true;
@@ -570,11 +572,9 @@
if ( objects.size() > 0 )
{
conflict = reportConflict( object );
- }
-
- if ( conflict != null )
- {
summaryType.getImportConflicts().add( conflict );
+
+ return false;
}
return true;