Issues with import..what is going on?

Thanks for looking into this. It looks like the uniqueness has been moved from the shortname to the code.

Have a look at that DXF I sent earlier this week. This was the same orgunit hierarchy which I could not import in trunk but which worked fine in 2.0.5.

I suspect it has something to do with the duplication of codes and the change in this method.



Sent from my HTC

----- Reply message -----
From: “Lars Helge Øverland”
Date: Fri, Jan 28, 2011 22:26
Subject: [Dhis2-devs] Issues with import…what is going on?
To: “Jason Pickering”
Cc: “dhis2-devs”

The reason for removing the matching on short name is that we have removed
the uniqueness constraint for that property. This happened after several
complaints that the uniqueness constraint was too cumbersome. This has been
reflected in the importer, I will have a closer look and see if we have
introduced a bug here.


On Fri, Jan 28, 2011 at 1:38 PM, Jason Pickering <> wrote:

Sorry. Script kiddies like me should probably not dabble in all this
code, but sometimes you gotta get things to work.

So, at this point (rev 1938) something happened.

getOrganisationUnitByShortName method was switched to
getOrganisationUnitByCode in the OrganisationUnitImporter. I keep
getting weird problems that I used to not have trying to import either
from DHIS 1.4 XML or DHIS1.4 files with earlier versions of DHIS2. By
NULLING the “code” field entirely in the orgunit table of the 1.4
database, I can import from DHIS 1.4 database which has duplicates in
the code field prior to NULLING all the fields.

Was there are reason that this method was switched ? According to this
code, isn’t the matching during an import occurring first by name and
then by code? Since there is not a unique restriction on the code,
what if multiple orgunits are returned?

I suspect this is related to the same problem I had reported a few
days ago about not being able to import stuff via DXF.

Can someone that knows what they are doing take a look at it?


his\importexport\importer>bzr diff -r 1937
=== modified file

mportexport/importer/ 2010-07-30 14:20:36
mportexport/importer/ 2011-01-28 12:21:19
@@ -104,7 +104,7 @@

    if ( match == null )
  •        match =

organisationUnitService.getOrganisationUnitByShortName( obj
ect.getShortName() );

  •        match = organisationUnitService.getOrganisationUnitByCode(

etCode() );

    return match;

Jason P. Pickering

Mailing list:
Post to :
Unsubscribe :
More help :