← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13728: csd: map dataSet.code => service.oid

 

------------------------------------------------------------
revno: 13728
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-14 20:42:15 +0700
message:
  csd: map dataSet.code => service.oid
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 12:58:25 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/webapi/CsdController.java	2014-01-14 13:42:15 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -43,6 +44,7 @@
 import org.hisp.dhis.web.csd.domain.csd.OtherID;
 import org.hisp.dhis.web.csd.domain.csd.Person;
 import org.hisp.dhis.web.csd.domain.csd.Record;
+import org.hisp.dhis.web.csd.domain.csd.Service;
 import org.hisp.dhis.web.fred.webapi.v1.utils.GeoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -137,6 +139,19 @@
             Organization organization = new Organization( "1.3.6.1.4.1.21367.200.99.1" );
             facility.getOrganizations().add( organization );
 
+            for ( DataSet dataSet : organisationUnit.getDataSets() )
+            {
+                if ( dataSet.getCode() == null )
+                {
+                    continue;
+                }
+
+                Service service = new Service();
+                service.setOid( dataSet.getCode() );
+
+                organization.getServices().add( service );
+            }
+
             if ( OrganisationUnit.FEATURETYPE_POINT.equals( organisationUnit.getFeatureType() ) )
             {
                 Geocode geocode = new Geocode();