dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16806
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6488: moved things around a bit in AbstractImporter
------------------------------------------------------------
revno: 6488
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-05 12:23:52 +0200
message:
moved things around a bit in AbstractImporter
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.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/importers/AbstractImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java 2012-04-05 10:12:35 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java 2012-04-05 10:23:52 +0000
@@ -106,17 +106,6 @@
// Importer<T> Implementation
//-------------------------------------------------------------------------------------------------------
- private void reset( Object type )
- {
- imports = 0;
- updates = 0;
- ignores = 0;
-
- uidMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.UID );
- nameMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.NAME );
- codeMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.CODE );
- }
-
@Override
public List<ImportConflict> importCollection( List<T> objects, ImportOptions options )
{
@@ -152,18 +141,6 @@
return importObjectLocal( object, options );
}
- private ImportConflict importObjectLocal( T object, ImportOptions options )
- {
- ImportConflict conflict = validateIdentifiableObject( object, options );
-
- if ( conflict == null )
- {
- conflict = startImport( object, options );
- }
-
- return conflict;
- }
-
@Override
public ImportCount getCurrentImportCount()
{
@@ -177,9 +154,32 @@
}
//-------------------------------------------------------------------------------------------------------
- // Helpers
+ // Internal methods
//-------------------------------------------------------------------------------------------------------
+ private void reset( Object type )
+ {
+ imports = 0;
+ updates = 0;
+ ignores = 0;
+
+ uidMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.UID );
+ nameMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.NAME );
+ codeMap = manager.getIdMap( (Class) type.getClass(), IdentifiableObject.IdentifiableProperty.CODE );
+ }
+
+ private ImportConflict importObjectLocal( T object, ImportOptions options )
+ {
+ ImportConflict conflict = validateIdentifiableObject( object, options );
+
+ if ( conflict == null )
+ {
+ conflict = startImport( object, options );
+ }
+
+ return conflict;
+ }
+
private ImportConflict startImport( T object, ImportOptions options )
{
T oldObject = getObject( object, options.getIdScheme() );
@@ -313,6 +313,10 @@
}
}
+ //-------------------------------------------------------------------------------------------------------
+ // Protected methods
+ //-------------------------------------------------------------------------------------------------------
+
/**
* Try to get a usable display based on current idScheme, mainly used for error-reporting
* but can also be use elsewhere. Falls back to the name of the class, if no other alternative
@@ -353,20 +357,4 @@
{
return CodeGenerator.generateCode();
}
-
- protected void mergeIdentifiableObject( BaseIdentifiableObject target, BaseIdentifiableObject source )
- {
- target.setId( source.getId() );
- target.setUid( source.getUid() );
- target.setName( source.getName() );
- target.setCode( source.getCode() );
- }
-
- protected void mergeNameableObject( BaseNameableObject target, BaseNameableObject source )
- {
- mergeIdentifiableObject( target, source );
-
- target.setShortName( source.getShortName() );
- target.setDescription( source.getDescription() );
- }
}