dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25074
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12358: bugfixes for user import, verify that userCredentials part is available
------------------------------------------------------------
revno: 12358
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-10-01 12:32:30 +0200
message:
bugfixes for user import, verify that userCredentials part is available
modified:
dhis-2/dhis-services/dhis-service-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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2013-10-01 10:06:54 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2013-10-01 10:32:30 +0000
@@ -415,6 +415,14 @@
if ( object instanceof User )
{
userCredentials = ((User) object).getUserCredentials();
+
+ if ( userCredentials == null )
+ {
+ summaryType.getImportConflicts().add(
+ new ImportConflict( ImportUtils.getDisplayName( object ), "User is missing userCredentials part." ) );
+
+ return false;
+ }
}
Map<Field, Object> fields = detachFields( object );
@@ -433,7 +441,7 @@
if ( object instanceof User )
{
userCredentials.setUser( (User) object );
- userCredentials.setId( ((User) object).getId() );
+ userCredentials.setId( object.getId() );
Map<Field, Collection<Object>> collectionFieldsUserCredentials = detachCollectionFields( userCredentials );
@@ -445,7 +453,7 @@
((User) object).setUserCredentials( userCredentials );
- objectBridge.updateObject( (User) object );
+ objectBridge.updateObject( object );
}
if ( !options.isDryRun() )
@@ -493,6 +501,14 @@
if ( object instanceof User )
{
userCredentials = ((User) object).getUserCredentials();
+
+ if ( userCredentials == null )
+ {
+ summaryType.getImportConflicts().add(
+ new ImportConflict( ImportUtils.getDisplayName( object ), "User is missing userCredentials part." ) );
+
+ return false;
+ }
}
Map<Field, Object> fields = detachFields( object );