← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4594: added href to generated json

 

------------------------------------------------------------
revno: 4594
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-09-15 16:05:40 +0200
message:
  added href to generated json
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 13:37:40 +0000
+++ 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
@@ -17,11 +17,8 @@
 
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.importexport.dxf2.model.DataSetLinks;
-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;
@@ -33,8 +30,6 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private LinkBuilder linkBuilder = new LinkBuilderImpl();
-
     private DataSetService dataSetService;
 
     @Required
@@ -63,7 +58,8 @@
         for(DataSet dataSet : dataSets)
         {
             Map<String, Object> dataSetMap = new HashMap<String, Object>();
-            dataSetMap.put( "uuid", dataSet.getUuid() );
+            dataSetMap.put( "id", dataSet.getUuid() );
+            dataSetMap.put( "href", uriInfo.getAbsolutePath().toASCIIString() + "/" + dataSet.getUuid() );
             dataSetMap.put( "name", dataSet.getName() );
 
             dataSetsArray.add( dataSetMap );
@@ -87,7 +83,7 @@
         }
 
         Map<String, Object> dataSetMap = new HashMap<String, Object>();
-        dataSetMap.put( "uuid", dataSet.getUuid() );
+        dataSetMap.put( "id", dataSet.getUuid() );
         dataSetMap.put( "name", dataSet.getName() );
 
         return new JSONWithPadding( dataSetMap, callback );