← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4596: made getDataSet use DataSetMapper instead

 

------------------------------------------------------------
revno: 4596
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-09-15 16:25:25 +0200
message:
  made getDataSet use DataSetMapper instead
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResourceP.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/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResourceP.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResourceP.java	2011-09-15 14:05:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResourceP.java	2011-09-15 14:25:25 +0000
@@ -17,8 +17,10 @@
 
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.importexport.dxf2.service.DataSetMapper;
 import org.hisp.dhis.importexport.dxf2.service.LinkBuilder;
 import org.hisp.dhis.importexport.dxf2.service.LinkBuilderImpl;
+import org.hisp.dhis.web.api.UrlResourceListener;
 import org.springframework.beans.factory.annotation.Required;
 
 import com.sun.jersey.api.json.JSONWithPadding;
@@ -82,10 +84,9 @@
             throw new IllegalArgumentException( "No dataset with uuid " + uuid );
         }
 
-        Map<String, Object> dataSetMap = new HashMap<String, Object>();
-        dataSetMap.put( "id", dataSet.getUuid() );
-        dataSetMap.put( "name", dataSet.getName() );
-
-        return new JSONWithPadding( dataSetMap, callback );
+        org.hisp.dhis.importexport.dxf2.model.DataSet dxfDataSet = new DataSetMapper().convert( dataSet );
+        new UrlResourceListener( uriInfo ).beforeMarshal( dxfDataSet );
+        
+        return new JSONWithPadding( dxfDataSet, callback );
     }
 }