← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1851: Only appending random number to orgunit shortnames larger than 30 chars in 1.4 file import

 

------------------------------------------------------------
revno: 1851
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-05-13 16:56:08 +0200
message:
  Only appending random number to orgunit shortnames larger than 30 chars in 1.4 file import
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRowHandler.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-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRowHandler.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRowHandler.java	2010-05-13 14:56:08 +0000
@@ -81,7 +81,11 @@
         NameMappingUtil.addOrganisationUnitMapping( unit.getId(), unit.getName() );
 
         unit.setUuid( UUIdUtils.getUUId() );
-        unit.setShortName( unit.getShortName() + EMPTY + MathUtils.getRandom() );
+        
+        if ( unit.getShortName() != null && unit.getShortName().length() > 30 )
+        {
+            unit.setShortName( unit.getShortName().substring( 30 ) + MathUtils.getRandom() );
+        }
             
         if ( unit.getCode() != null && unit.getCode().trim().length() == 0 )
         {