dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18001
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7408: minor fixes (dont deadlock when there is no parent available in the current XML)
------------------------------------------------------------
revno: 7408
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-27 08:24:21 +0300
message:
minor fixes (dont deadlock when there is no parent available in the current XML)
modified:
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/utils/OrganisationUnitUtils.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/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-06-26 13:01:21 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-06-27 05:24:21 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.expression.Expression;
import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.importexport.ImportStrategy;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
@@ -332,12 +333,11 @@
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 );
@@ -427,7 +427,9 @@
for ( T object : objects )
{
ObjectHandlerUtils.preObjectHandlers( object, objectHandlers );
+
importObjectLocal( object );
+
ObjectHandlerUtils.postObjectHandlers( object, objectHandlers );
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/OrganisationUnitUtils.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/OrganisationUnitUtils.java 2012-04-20 08:34:30 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/OrganisationUnitUtils.java 2012-06-27 05:24:21 +0000
@@ -80,21 +80,26 @@
{
if ( parent.getUid() != null )
{
- organisationUnit.setParent( organisationUnitMap.get( parent.getUid() ) );
+ parent = organisationUnitMap.get( parent.getUid() );
}
else if ( parent.getCode() != null )
{
- organisationUnit.setParent( organisationUnitMap.get( parent.getCode() ) );
+ parent = organisationUnitMap.get( parent.getCode() );
}
else if ( parent.getName() != null )
{
- organisationUnit.setParent( organisationUnitMap.get( parent.getName() ) );
+ parent = organisationUnitMap.get( parent.getName() );
}
else if ( parent.getShortName() != null )
{
- organisationUnit.setParent( organisationUnitMap.get( parent.getShortName() ) );
+ parent = organisationUnitMap.get( parent.getShortName() );
}
}
+
+ if ( parent != null )
+ {
+ organisationUnit.setParent( parent );
+ }
}
}
}