← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10191: support uuid in alternative datavalueset format (one ou pr line)

 

------------------------------------------------------------
revno: 10191
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-14 10:45:19 +0700
message:
  support uuid in alternative datavalueset format (one ou pr line)
modified:
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.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/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2013-02-13 00:57:36 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2013-03-14 03:45:19 +0000
@@ -67,6 +67,7 @@
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
+import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -251,7 +252,23 @@
         boolean skipExistingCheck = importOptions.isSkipExistingCheck();
 
         Map<String, DataElement> dataElementMap = identifiableObjectManager.getIdMap( DataElement.class, dataElementIdScheme );
-        Map<String, OrganisationUnit> orgUnitMap = identifiableObjectManager.getIdMap( OrganisationUnit.class, orgUnitIdScheme );
+
+        Map<String, OrganisationUnit> orgUnitMap = new HashMap<String, OrganisationUnit>();
+
+        if ( !orgUnitIdScheme.equals( IdentifiableProperty.UUID ) )
+        {
+            identifiableObjectManager.getIdMap( OrganisationUnit.class, orgUnitIdScheme );
+        }
+        else
+        {
+            Collection<OrganisationUnit> allOrganisationUnits = organisationUnitService.getAllOrganisationUnits();
+
+            for ( OrganisationUnit organisationUnit : allOrganisationUnits )
+            {
+                orgUnitMap.put( organisationUnit.getUuid(), organisationUnit );
+            }
+        }
+
         Map<String, DataElementCategoryOptionCombo> categoryOptionComboMap = identifiableObjectManager.getIdMap( DataElementCategoryOptionCombo.class, IdentifiableProperty.UID );
         Map<String, Period> periodMap = new HashMap<String, Period>();