← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13866: csd: get codedType from the 'Type' orgunitgroupset

 

------------------------------------------------------------
revno: 13866
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-01-27 10:46:25 +0000
message:
  csd: get codedType from the 'Type' orgunitgroupset
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-27 10:01:17 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java	2014-01-27 10:46:25 +0000
@@ -304,28 +304,33 @@
                     continue;
                 }
 
-                if ( organisationUnitGroup.getCode() == null )
-                {
-                    continue;
-                }
-
-                CodedType codedType = new CodedType();
-                codedType.setCode( organisationUnitGroup.getCode() );
-
-                codedType.setCodingSchema( "Unknown" );
-
-                for ( AttributeValue attributeValue : organisationUnitGroup.getAttributeValues() )
-                {
-                    if ( attributeValue.getAttribute().getName().equals( "code_system" ) )
-                    {
-                        codedType.setCodingSchema( attributeValue.getValue() );
-                        break;
-                    }
-                }
-
-                codedType.setValue( organisationUnitGroup.getDisplayName() );
-
-                facility.getCodedTypes().add( codedType );
+                
+                if ( organisationUnitGroup.getGroupSet() != null &&
+                    FACILITY_TYPE_GROUPSET.equals( organisationUnitGroup.getGroupSet().getName() ) )
+                {
+                    if ( organisationUnitGroup.getCode() == null )
+                    {
+                        continue;
+                    }
+
+                    CodedType codedType = new CodedType();
+                    codedType.setCode( organisationUnitGroup.getCode() );
+
+                    codedType.setCodingSchema( "Unknown" );
+
+                    for ( AttributeValue attributeValue : organisationUnitGroup.getAttributeValues() )
+                    {
+                        if ( attributeValue.getAttribute().getName().equals( "code_system" ) )
+                        {
+                            codedType.setCodingSchema( attributeValue.getValue() );
+                            break;
+                        }
+                    }
+
+                    codedType.setValue( organisationUnitGroup.getDisplayName() );
+
+                    facility.getCodedTypes().add( codedType );
+                }
             }
 
             Organization organization = new Organization( "No oid, please provide organisation_oid attribute value." );