dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27542
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13712: csd: use code for oid, use orgunitgroup as codedType
------------------------------------------------------------
revno: 13712
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-14 16:58:09 +0700
message:
csd: use code for oid, use orgunitgroup as codedType
modified:
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/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-api-fred/src/main/java/org/hisp/dhis/web/csd/webapi/CsdController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/webapi/CsdController.java 2014-01-14 09:03:54 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/webapi/CsdController.java 2014-01-14 09:58:09 +0000
@@ -29,6 +29,7 @@
*/
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.web.csd.domain.Envelope;
import org.hisp.dhis.web.csd.domain.csd.CodedType;
@@ -92,7 +93,7 @@
for ( OrganisationUnit organisationUnit : organisationUnits )
{
Facility facility = new Facility();
- facility.setOid( "1.3.6.1.4.1.21367.200.99.11" ); // TODO use code for OID?
+ facility.setOid( organisationUnit.getCode() ); // TODO use code for OID?
facility.getOtherID().add( new OtherID( organisationUnit.getUid(), "dhis2-uid" ) );
@@ -101,12 +102,24 @@
facility.getOtherID().add( new OtherID( organisationUnit.getCode(), "dhis2-code" ) );
}
- CodedType fakeCodedType = new CodedType( "103-110", "1.3.6.1.4.1.21367.100.1", "Radiology - Imaging Services" );
- facility.getCodedTypes().add( fakeCodedType );
-
facility.setPrimaryName( organisationUnit.getDisplayName() );
- Organization organization = new Organization("1.3.6.1.4.1.21367.200.99.1");
+ for ( OrganisationUnitGroup organisationUnitGroup : organisationUnit.getGroups() )
+ {
+ if ( organisationUnitGroup.getCode() == null )
+ {
+ continue;
+ }
+
+ CodedType codedType = new CodedType();
+ codedType.setCode( organisationUnitGroup.getUid() );
+ codedType.setCodingSchema( "dhis2-uid" );
+ codedType.setValue( organisationUnitGroup.getDisplayName() );
+
+ facility.getCodedTypes().add( codedType );
+ }
+
+ Organization organization = new Organization( "1.3.6.1.4.1.21367.200.99.1" );
facility.getOrganizations().add( organization );
Record record = new Record();