dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27766
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13825: CSD only map datset to service if service oid exists
------------------------------------------------------------
revno: 13825
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-23 13:11:25 +0000
message:
CSD only map datset to service if service oid exists
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-23 09:32:35 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java 2014-01-23 13:11:25 +0000
@@ -315,23 +315,26 @@
for ( DataSet dataSet : organisationUnit.getDataSets() )
{
- if ( dataSet.getCode() == null )
- {
- continue;
- }
-
- Service service = new Service();
- service.setOid( "No oid, please provide service_oid attribute value." );
-
+ String oid = null;
+
for ( AttributeValue attributeValue : dataSet.getAttributeValues() )
{
if ( attributeValue.getAttribute().getName().equals( "service_oid" ) )
{
- service.setOid( attributeValue.getValue() );
+ oid = attributeValue.getValue() ;
break;
}
}
+ // skip if dataset doesn't have a service oid
+ if (oid == null)
+ {
+ continue;
+ }
+
+ Service service = new Service();
+ service.setOid( oid );
+
service.getNames().add( new Name( new CommonName( dataSet.getDisplayName() ) ) );
organization.getServices().add( service );