← Back to team overview

dhis2-devs team mailing list archive

Re: 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.

Regards 
Jason

Sent from my HTC

----- Reply message -----
From: "Lars Helge Øverland" <larshelge@xxxxxxxxx>
Date: Fri, Jan 28, 2011 22:26
Subject: [Dhis2-devs] Issues with import..what is going on?
To: "Jason Pickering" <jason.p.pickering@xxxxxxxxx>
Cc: "dhis2-devs" <dhis2-devs@xxxxxxxxxxxxxxxxxxx>


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.

Lars


On Fri, Jan 28, 2011 at 1:38 PM, Jason Pickering <
jason.p.pickering@xxxxxxxxx> 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?
>
> Regards,
> Jason
>
>
>
> C:\dhis2\dhis-2\dhis-services\dhis-service-importexport\src\main\java\org\hisp\d
> his\importexport\importer>bzr diff OrganisationUnitImporter.java -r 1937
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/
> org/hisp/dhis/importexport/importer/OrganisationUnitImporter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/i
> mportexport/importer/OrganisationUnitImporter.java      2010-07-30 14:20:36
> +000
> 0
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/i
> mportexport/importer/OrganisationUnitImporter.java      2011-01-28 12:21:19
> +000
> 0
> @@ -104,7 +104,7 @@
>
>         if ( match == null )
>         {
> -            match =
> organisationUnitService.getOrganisationUnitByShortName( obj
> ect.getShortName() );
> +            match = organisationUnitService.getOrganisationUnitByCode(
> object.g
> etCode() );
>         }
>
>         return match;
>
>
>
>
> --
> Jason P. Pickering
> email: jason.p.pickering@xxxxxxxxx
> tel:+260974901293
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>