← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13800: csd: support facility_oid instead of orgUnit.getCode

 

------------------------------------------------------------
revno: 13800
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-21 16:48:57 +0700
message:
  csd: support facility_oid instead of orgUnit.getCode
modified:
  dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.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-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java	2014-01-21 09:43:33 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java	2014-01-21 09:48:57 +0000
@@ -225,7 +225,16 @@
         for ( OrganisationUnit organisationUnit : organisationUnits )
         {
             Facility facility = new Facility();
-            facility.setOid( organisationUnit.getCode() ); // TODO skip if code is null??
+            facility.setOid( "No oid, please provide facility_oid attribute value" );
+
+            for ( AttributeValue attributeValue : organisationUnit.getAttributeValues() )
+            {
+                if ( attributeValue.getAttribute().getName().equals( "facility_oid" ) )
+                {
+                    facility.setOid( attributeValue.getValue() );
+                    break;
+                }
+            }
 
             facility.getOtherID().add( new OtherID( organisationUnit.getUid(), "dhis2-uid" ) );