=== 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-04-22 18:21:40 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-04-22 21:25:27 +0000 @@ -131,12 +131,13 @@ doImport( metaData.getDataSets(), importOptions, importSummary ); */ + cacheManager.clearCache(); + objectBridge.destroy(); + Date endDate = new Date(); log.info( "Started import at " + startDate ); log.info( "Finished import at " + endDate ); - objectBridge.destroy(); - cacheManager.clearCache(); return importSummary; } === modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2012-04-22 20:14:05 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2012-04-22 21:25:27 +0000 @@ -27,14 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hisp.dhis.common.IdentifiableObject; @@ -49,6 +41,8 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import java.util.*; + /** * @author Morten Olav Hansen */ === 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-04-22 18:54:45 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-04-22 21:25:27 +0000 @@ -30,7 +30,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hisp.dhis.common.BaseIdentifiableObject; -import org.hisp.dhis.common.CodeGenerator; import org.hisp.dhis.common.IdentifiableObject; import org.hisp.dhis.common.NameableObject; import org.hisp.dhis.common.annotation.Scanned; @@ -42,6 +41,7 @@ import org.hisp.dhis.dxf2.utils.OrganisationUnitUtils; import org.hisp.dhis.importexport.ImportStrategy; import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet; import org.hisp.dhis.organisationunit.comparator.OrganisationUnitComparator; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; @@ -107,7 +107,9 @@ { // make sure that the internalId is 0, so that the system will generate a ID object.setId( 0 ); - object.setUid( CodeGenerator.generateCode() ); + + // FIXME add uidValidator.. part of bean validation impl? + // object.setUid( CodeGenerator.generateCode() ); log.debug( "Trying to save new object => " + getDisplayName( object ) ); @@ -467,7 +469,8 @@ { for ( Field field : identifiableObjects.keySet() ) { - IdentifiableObject ref = findObjectByReference( identifiableObjects.get( field ) ); + IdentifiableObject idObject = identifiableObjects.get( field ); + IdentifiableObject ref = findObjectByReference( idObject ); if ( ref != null ) { @@ -475,7 +478,10 @@ } else { - log.warn( "Ignored reference " + ref + " on object " + identifiableObject + "." ); + if ( !OrganisationUnitGroupSet.class.isInstance( idObject ) ) + { + log.warn( "Ignored reference " + idObject + " on object " + identifiableObject + "." ); + } } } } @@ -483,8 +489,7 @@ private Map> scanIdentifiableObjectCollections( IdentifiableObject identifiableObject ) { - Map> collected = new HashMap>(); + Map> collected = new HashMap>(); Field[] fields = identifiableObject.getClass().getDeclaredFields(); for ( Field field : fields ) @@ -541,7 +546,7 @@ } else { - log.warn( "Ignored reference " + ref + " on object " + identifiableObject + "." ); + log.warn( "Ignored reference " + idObject + " on object " + identifiableObject + "." ); } }