------------------------------------------------------------ revno: 13816 committer: Bob Jolliffe <bobjolli...@gmail.com> branch nick: dhis2 timestamp: Wed 2014-01-22 19:51:07 +0000 message: Discriminate between facility and non-facility type orgunits in csd 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-22 16:02:02 +0000 +++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java 2014-01-22 19:51:07 +0000 @@ -73,10 +73,11 @@ 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; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @author Morten Olav Hansen <morte...@gmail.com> @@ -85,7 +86,12 @@ @RequestMapping( value = "/csd" ) public class CsdController { - private static String SOAP_CONTENT_TYPE = "application/soap+xml"; + private static final Log log = LogFactory.getLog( CsdController.class ); + + private static final String SOAP_CONTENT_TYPE = "application/soap+xml"; + + // Name of group + private static final String FACILITY_TYPE_DISCRIMINATOR = "Health Facility"; // ------------------------------------------------------------------------- // Dependencies @@ -225,6 +231,21 @@ for ( OrganisationUnit organisationUnit : organisationUnits ) { + boolean isFacility = false; + for (OrganisationUnitGroup group : organisationUnit.getGroups()) + { + if( group.getName().equals( FACILITY_TYPE_DISCRIMINATOR)) + { + isFacility = true; + break; + } + } + // skip if orgunit is not a health facility + if (!isFacility) + { + continue; + } + Facility facility = new Facility(); facility.setOid( "No oid, please provide facility_oid attribute value" ); @@ -271,7 +292,7 @@ codedType.setCode( organisationUnitGroup.getCode() ); codedType.setCodingSchema("Unknown" ); - for ( AttributeValue attributeValue : organisationUnit.getAttributeValues() ) + for ( AttributeValue attributeValue : organisationUnitGroup.getAttributeValues() ) { if ( attributeValue.getAttribute().getName().equals( "code_system" ) ) {
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp