← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13813: Included coding schema (for csd) on orgunitgroups

 

------------------------------------------------------------
revno: 13813
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-22 16:02:02 +0000
message:
  Included coding schema (for csd) on orgunitgroups
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:48:57 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java	2014-01-22 16:02:02 +0000
@@ -73,6 +73,7 @@
 import javax.xml.bind.Unmarshaller;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -237,7 +238,12 @@
             }
 
             facility.getOtherID().add( new OtherID( organisationUnit.getUid(), "dhis2-uid" ) );
-
+            
+            if (organisationUnit.getCode() != null)
+            {
+                facility.getOtherID().add( new OtherID( organisationUnit.getCode(), "dhis2-code" ) );                
+            }
+            
             facility.setPrimaryName( organisationUnit.getDisplayName() );
 
             if ( organisationUnit.getContactPerson() != null )
@@ -260,10 +266,20 @@
                 {
                     continue;
                 }
-
+                
                 CodedType codedType = new CodedType();
-                codedType.setCode( organisationUnitGroup.getUid() );
-                codedType.setCodingSchema( "dhis2-uid" );
+                codedType.setCode( organisationUnitGroup.getCode() );
+                
+                codedType.setCodingSchema("Unknown" );                
+                for ( AttributeValue attributeValue : organisationUnit.getAttributeValues() )
+                {
+                    if ( attributeValue.getAttribute().getName().equals( "code_system" ) )
+                    {
+                        codedType.setCodingSchema( attributeValue.getValue() );
+                        break;
+                    }
+                }
+
                 codedType.setValue( organisationUnitGroup.getDisplayName() );
 
                 facility.getCodedTypes().add( codedType );
@@ -372,4 +388,5 @@
 
         return csd;
     }
+
 }