← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10049: FRED-API: added basic meta-block, includes limit, offset, total

 

------------------------------------------------------------
revno: 10049
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-07 18:05:03 +0300
message:
  FRED-API: added basic meta-block, includes limit, offset, total
modified:
  dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java
  dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/domain/Facilities.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/webapi/v1/controller/FacilityController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java	2013-03-07 12:59:06 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java	2013-03-07 15:05:03 +0000
@@ -316,6 +316,10 @@
             }
         }
 
+        facilities.getMeta().put( "limit", limitValue );
+        facilities.getMeta().put( "offset", offset );
+        facilities.getMeta().put( "total", organisationUnitService.getNumberOfOrganisationUnits() );
+
         Collections.sort( allOrganisationUnits, IdentifiableObjectNameComparator.INSTANCE );
         List<OrganisationUnitLevel> organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels();
 

=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/domain/Facilities.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/domain/Facilities.java	2013-01-31 02:31:35 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/domain/Facilities.java	2013-03-07 15:05:03 +0000
@@ -27,20 +27,37 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.codehaus.jackson.annotate.JsonPropertyOrder;
+
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
+@JsonPropertyOrder( value = { "meta", "facilities" } )
 public class Facilities
 {
+    private Map<String, Object> meta = new HashMap<String, Object>();
+
     private List<Facility> facilities = new ArrayList<Facility>();
 
     public Facilities()
     {
     }
 
+    public Map<String, Object> getMeta()
+    {
+        return meta;
+    }
+
+    public void setMeta( Map<String, Object> meta )
+    {
+        this.meta = meta;
+    }
+
     public List<Facility> getFacilities()
     {
         return facilities;
@@ -56,6 +73,7 @@
     {
         return "Facilities{" +
             "facilities=" + facilities +
+            ", meta=" + meta +
             '}';
     }
 }