← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5486: finished updating controllers with paging (not every controller will be paged)

 

------------------------------------------------------------
revno: 5486
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-12-19 20:45:07 +0100
message:
  finished updating controllers with paging (not every controller will be paged)
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resources.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
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.java	2011-12-19 17:20:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.java	1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
-package org.hisp.dhis.dataset;
-
-/*
- * Copyright (c) 2004-2011, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.hisp.dhis.common.BaseLinkableObject;
-import org.hisp.dhis.common.Dxf2Namespace;
-import org.hisp.dhis.common.Pager;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@XmlRootElement( name = "completeDataSetRegistrations", namespace = Dxf2Namespace.NAMESPACE )
-@XmlAccessorType( value = XmlAccessType.NONE )
-public class CompleteDataSetRegistrations extends BaseLinkableObject
-{
-    private Pager pager;
-
-    private List<CompleteDataSetRegistration> completeDataSetRegistrations = new ArrayList<CompleteDataSetRegistration>();
-
-    @XmlElement
-    @JsonProperty
-    public Pager getPager()
-    {
-        return pager;
-    }
-
-    public void setPager( Pager pager )
-    {
-        this.pager = pager;
-    }
-
-    @XmlElement( name = "completeDataSetRegistration" )
-    @JsonProperty( value = "completeDataSetRegistrations" )
-    public List<CompleteDataSetRegistration> getCompleteDataSetRegistrations()
-    {
-        return completeDataSetRegistrations;
-    }
-
-    public void setCompleteDataSetRegistrations( List<CompleteDataSetRegistration> completeDataSetRegistrations )
-    {
-        this.completeDataSetRegistrations = completeDataSetRegistrations;
-    }
-}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java	2011-12-09 20:53:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java	2011-12-19 19:45:07 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.BaseLinkableObject;
 import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.common.adapter.IndicatorTypeXmlAdapter;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -49,8 +50,22 @@
 @XmlAccessorType( value = XmlAccessType.NONE )
 public class IndicatorTypes extends BaseLinkableObject
 {
+    private Pager pager;
+
     private List<IndicatorType> indicatorTypes = new ArrayList<IndicatorType>();
 
+    @XmlElement
+    @JsonProperty
+    public Pager getPager()
+    {
+        return pager;
+    }
+
+    public void setPager( Pager pager )
+    {
+        this.pager = pager;
+    }
+
     @XmlElement( name = "indicatorType" )
     @XmlJavaTypeAdapter( IndicatorTypeXmlAdapter.class )
     @JsonProperty( value = "indicatorTypes" )

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java	2011-12-14 16:53:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java	2011-12-19 19:45:07 +0000
@@ -27,12 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.i18n.I18nFormat;
+
 import java.io.OutputStream;
 import java.util.Collection;
 import java.util.Date;
 
-import org.hisp.dhis.i18n.I18nFormat;
-
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -40,19 +40,19 @@
 public interface ReportService
 {
     final String ID = ReportService.class.getName();
-    
+
     final String REPORTTYPE_PDF = "pdf";
     final String REPORTTYPE_XLS = "xls";
 
-    public void renderReport( OutputStream out, Report report, Date reportingPeriod, 
-        Integer organisationUnitId, String type, I18nFormat format );
-    
+    public void renderReport( OutputStream out, Report report, Date reportingPeriod,
+                              Integer organisationUnitId, String type, I18nFormat format );
+
     void renderReport( OutputStream out, String reportUid, Date reportingPeriod,
-        String organisationUnitUid, String type, I18nFormat format );
-    
+                       String organisationUnitUid, String type, I18nFormat format );
+
     /**
      * Saves a Report.
-     * 
+     *
      * @param report the Report to save.
      * @return the generated identifier.
      */
@@ -60,7 +60,7 @@
 
     /**
      * Retrieves the Report with the given identifier.
-     * 
+     *
      * @param id the identifier of the Report to retrieve.
      * @return the Report.
      */
@@ -68,29 +68,35 @@
 
     /**
      * Retrieves the Report with the given uid.
-     * 
+     *
      * @param uid the uid of the Report to retrieve.
      * @return the Report.
      */
     Report getReport( String uid );
 
+    int getReportCount();
+
+    Collection<Report> getReportsBetween( int first, int max );
+
+    Collection<Report> getReportsBetweenByName( String name, int first, int max );
+
     /**
      * Deletes a Report.
-     * 
+     *
      * @param report the Report to delete.
      */
     void deleteReport( Report report );
 
     /**
      * Retrieves all Reports.
-     * 
+     *
      * @return a Collection of Reports.
      */
     Collection<Report> getAllReports();
 
     /**
      * Retrieves the Report with the given name.
-     * 
+     *
      * @param name the name.
      * @return the Report.
      */
@@ -98,7 +104,7 @@
 
     /**
      * Retrieves all Reports with the given identifiers.
-     * 
+     *
      * @param identifiers the Collection of identifiers.
      * @return a Collection of Reports.
      */

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewService.java	2011-12-11 00:21:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlViewService.java	2011-12-19 19:45:07 +0000
@@ -47,6 +47,12 @@
 
     void updateSqlView( SqlView sqlView );
 
+    int getSqlViewCount();
+
+    Collection<SqlView> getSqlViewsBetween( int first, int max );
+
+    Collection<SqlView> getSqlViewsBetweenByName( String name, int first, int max );
+
     SqlView getSqlView( int viewId );
 
     SqlView getSqlViewByUid( String uid );
@@ -68,11 +74,11 @@
     boolean isViewTableExists( String viewTableName );
 
     boolean createAllViewTables();
-    
+
     boolean createViewTable( SqlView sqlViewInstance );
 
     void dropViewTable( String viewName );
-    
+
     void dropAllSqlViewTables();
 
     SqlViewTable getDataSqlViewTable( String viewTableName );

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java	2011-12-11 00:21:52 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java	2011-12-19 19:45:07 +0000
@@ -105,6 +105,24 @@
     }
 
     @Override
+    public int getSqlViewCount()
+    {
+        return sqlViewStore.getCount();
+    }
+
+    @Override
+    public Collection<SqlView> getSqlViewsBetween( int first, int max )
+    {
+        return sqlViewStore.getBetween( first, max );
+    }
+
+    @Override
+    public Collection<SqlView> getSqlViewsBetweenByName( String name, int first, int max )
+    {
+        return sqlViewStore.getBetweenByName( name, first, max );
+    }
+
+    @Override
     public String makeUpForQueryStatement( String query )
     {
         return query.replaceAll( "\\s*;\\s+", ";" ).replaceAll( ";+", ";" ).replaceAll( "\\s+", " " ).trim();

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java	2011-12-14 16:53:56 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java	2011-12-19 19:45:07 +0000
@@ -202,6 +202,24 @@
         return reportStore.getByUid( uid );
     }
 
+    @Override
+    public int getReportCount()
+    {
+        return reportStore.getCount();
+    }
+
+    @Override
+    public Collection<Report> getReportsBetween( int first, int max )
+    {
+        return reportStore.getBetween( first, max );
+    }
+
+    @Override
+    public Collection<Report> getReportsBetweenByName( String name, int first, int max )
+    {
+        return reportStore.getBetweenByName( name, first, max );
+    }
+
     public Report getReportByName( String name )
     {
         return reportStore.getByName( name );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2011-12-19 19:45:07 +0000
@@ -27,18 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.chart.Chart;
 import org.hisp.dhis.chart.ChartService;
 import org.hisp.dhis.chart.Charts;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.i18n.I18nManager;
 import org.hisp.dhis.i18n.I18nManagerException;
 import org.hisp.dhis.indicator.Indicator;
@@ -53,11 +47,14 @@
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.HttpRequestMethodNotSupportedException;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -73,10 +70,10 @@
 
     @Autowired
     private IndicatorService indicatorService;
-    
+
     @Autowired
     private OrganisationUnitService organisationUnitService;
-    
+
     @Autowired
     private I18nManager i18nManager;
 
@@ -88,15 +85,21 @@
     public String getCharts( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         Charts charts = new Charts();
-        charts.setCharts( new ArrayList<Chart>( chartService.getAllCharts() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = chartService.getChartCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            charts.setPager( pager );
+
+            List<Chart> chartList = new ArrayList<Chart>( chartService.getChartsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            charts.setCharts( chartList );
         }
         else
         {
-
+            charts.setCharts( new ArrayList<Chart>( chartService.getAllCharts() ) );
         }
 
         if ( params.hasLinks() )
@@ -126,7 +129,7 @@
         return "chart";
     }
 
-    @RequestMapping( value = {"/{uid}/data","/{uid}/data.png"}, method = RequestMethod.GET )
+    @RequestMapping( value = {"/{uid}/data", "/{uid}/data.png"}, method = RequestMethod.GET )
     public void getChart( @PathVariable( "uid" ) String uid,
                           @RequestParam( value = "width", defaultValue = "700", required = false ) int width,
                           @RequestParam( value = "height", defaultValue = "500", required = false ) int height,
@@ -138,8 +141,8 @@
         ChartUtilities.writeChartAsPNG( response.getOutputStream(), chart, width, height );
     }
 
-    @RequestMapping( value = {"/data","/data.png"}, method = RequestMethod.GET )
-    public void getChart( @RequestParam( value = "in" ) String indicatorUid, 
+    @RequestMapping( value = {"/data", "/data.png"}, method = RequestMethod.GET )
+    public void getChart( @RequestParam( value = "in" ) String indicatorUid,
                           @RequestParam( value = "ou" ) String organisationUnitUid,
                           @RequestParam( value = "periods", required = false ) boolean periods,
                           @RequestParam( value = "width", defaultValue = "700", required = false ) int width,
@@ -149,9 +152,9 @@
     {
         Indicator indicator = indicatorService.getIndicator( indicatorUid );
         OrganisationUnit unit = organisationUnitService.getOrganisationUnit( organisationUnitUid );
-        
+
         JFreeChart chart = null;
-        
+
         if ( periods )
         {
             chart = chartService.getJFreePeriodChart( indicator, unit, !skipTitle, i18nManager.getI18nFormat() );
@@ -160,11 +163,11 @@
         {
             chart = chartService.getJFreeOrganisationUnitChart( indicator, unit, !skipTitle, i18nManager.getI18nFormat() );
         }
-        
+
         response.setContentType( ContextUtils.CONTENT_TYPE_PNG );
         ChartUtilities.writeChartAsPNG( response.getOutputStream(), chart, width, height );
     }
-    
+
     //-------------------------------------------------------------------------------------------------------
     // POST
     //-------------------------------------------------------------------------------------------------------

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java	1970-01-01 00:00:00 +0000
@@ -1,86 +0,0 @@
-package org.hisp.dhis.api.controller;
-
-/*
- * Copyright (c) 2004-2011, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.dataset.CompleteDataSetRegistration;
-import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
-import org.hisp.dhis.dataset.CompleteDataSetRegistrations;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Controller
-@RequestMapping( value = "/completeDataSetRegistrations" )
-public class CompleteDataSetRegistrationController
-{
-    @Autowired
-    private CompleteDataSetRegistrationService completeDataSetRegistrationService;
-
-    //-------------------------------------------------------------------------------------------------------
-    // GET
-    //-------------------------------------------------------------------------------------------------------
-
-    @RequestMapping( method = RequestMethod.GET )
-    public String getCompleteDataSetRegistrations( IdentifiableObjectParams params, Model model, HttpServletRequest request )
-    {
-        CompleteDataSetRegistrations completeDataSetRegistrations = new CompleteDataSetRegistrations();
-        completeDataSetRegistrations.setCompleteDataSetRegistrations( new ArrayList<CompleteDataSetRegistration>( completeDataSetRegistrationService.getAllCompleteDataSetRegistrations() ) );
-
-        if ( params.isPaging() )
-        {
-
-        }
-        else
-        {
-
-        }
-
-        model.addAttribute( "model", completeDataSetRegistrations );
-
-        return "completeDataSetRegistrations";
-    }
-
-    /*
-    @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
-    public Chart getChart( @PathVariable( "uid" ) String uid )
-    {
-        CompleteDataSetRegistration completeDataSetRegistration = completeDataSetRegistrationService.getCompleteDataSetRegistration(  )
-        Chart chart = chartService.getChart( uid );
-
-        return chart;
-    }*/
-}

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.constant.Constant;
 import org.hisp.dhis.constant.ConstantService;
 import org.hisp.dhis.constant.Constants;
@@ -46,6 +47,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -67,15 +69,22 @@
     public String getConstants( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         Constants constants = new Constants();
-        constants.setConstants( new ArrayList<Constant>( constantService.getAllConstants() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = constantService.getConstantCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            constants.setPager( pager );
+
+            List<Constant> constantList = new ArrayList<Constant>(
+                constantService.getConstantsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            constants.setConstants( constantList );
         }
         else
         {
-
+            constants.setConstants( new ArrayList<Constant>( constantService.getAllConstants() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java	2011-12-19 19:45:07 +0000
@@ -31,6 +31,7 @@
 import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.api.view.Jaxb2Utils;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dataelement.DataElementGroups;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -49,6 +50,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 @Controller
 @RequestMapping( value = DataElementGroupController.RESOURCE_PATH )
@@ -70,15 +72,22 @@
     public String getDataElementGroups( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         DataElementGroups dataElementGroups = new DataElementGroups();
-        dataElementGroups.setDataElementGroups( new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = dataElementService.getDataElementGroupCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            dataElementGroups.setPager( pager );
+
+            List<DataElementGroup> dataElementGroupList = new ArrayList<DataElementGroup>(
+                dataElementService.getDataElementGroupsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            dataElementGroups.setDataElementGroups( dataElementGroupList );
         }
         else
         {
-
+            dataElementGroups.setDataElementGroups( new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java	2011-12-12 13:03:59 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java	2011-12-19 19:45:07 +0000
@@ -31,6 +31,7 @@
 import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.api.view.Jaxb2Utils;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataelement.DataElementGroupSets;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -49,6 +50,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -73,7 +75,23 @@
     public String getDataElementGroupSets( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         DataElementGroupSets dataElementGroupSets = new DataElementGroupSets();
-        dataElementGroupSets.setDataElementGroupSets( new ArrayList<DataElementGroupSet>( dataElementService.getAllDataElementGroupSets() ) );
+
+        if ( params.isPaging() )
+        {
+            int total = dataElementService.getDataElementGroupSetCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            dataElementGroupSets.setPager( pager );
+
+            List<DataElementGroupSet> dataElementGroupSetList = new ArrayList<DataElementGroupSet>(
+                dataElementService.getDataElementGroupSetsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            dataElementGroupSets.setDataElementGroupSets( dataElementGroupSetList );
+        }
+        else
+        {
+            dataElementGroupSets.setDataElementGroupSets( new ArrayList<DataElementGroupSet>( dataElementService.getAllDataElementGroupSets() ) );
+        }
 
         if ( params.hasLinks() )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java	2011-12-16 11:41:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java	2011-12-19 19:45:07 +0000
@@ -30,6 +30,7 @@
 import org.apache.commons.io.IOUtils;
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.document.Document;
 import org.hisp.dhis.document.DocumentService;
 import org.hisp.dhis.document.Documents;
@@ -49,6 +50,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -61,7 +63,7 @@
 
     @Autowired
     private DocumentService documentService;
-    
+
     @Autowired
     private LocationManager locationManager;
 
@@ -73,7 +75,23 @@
     public String getDocuments( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         Documents documents = new Documents();
-        documents.setDocuments( new ArrayList<Document>( documentService.getAllDocuments() ) );
+
+        if ( params.isPaging() )
+        {
+            int total = documentService.getDocumentCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            documents.setPager( pager );
+
+            List<Document> documentList = new ArrayList<Document>(
+                documentService.getDocumentsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            documents.setDocuments( documentList );
+        }
+        else
+        {
+            documents.setDocuments( new ArrayList<Document>( documentService.getAllDocuments() ) );
+        }
 
         if ( params.hasLinks() )
         {
@@ -101,20 +119,20 @@
 
         return "document";
     }
-    
+
     @RequestMapping( value = "/{uid}/data", method = RequestMethod.GET )
     public void getDocumentContent( @PathVariable( "uid" ) String uid, HttpServletResponse response ) throws Exception
     {
         Document document = documentService.getDocument( uid );
-        
+
         if ( document.isExternal() )
         {
             response.sendRedirect( response.encodeRedirectURL( document.getUrl() ) );
         }
         else
-        {            
+        {
             ContextUtils.configureResponse( response, document.getContentType(), true, document.getUrl(), true );
-            
+
             InputStream in = locationManager.getInputStream( document.getUrl(), DocumentService.DIR );
 
             IOUtils.copy( in, response.getOutputStream() );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorGroups;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -46,6 +47,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -67,15 +69,22 @@
     public String getIndicatorGroups( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         IndicatorGroups indicatorGroups = new IndicatorGroups();
-        indicatorGroups.setIndicatorGroups( new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = indicatorService.getIndicatorGroupCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            indicatorGroups.setPager( pager );
+
+            List<IndicatorGroup> indicatorGroupList = new ArrayList<IndicatorGroup>(
+                indicatorService.getIndicatorGroupsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            indicatorGroups.setIndicatorGroups( indicatorGroupList );
         }
         else
         {
-
+            indicatorGroups.setIndicatorGroups( new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorGroupSets;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -46,6 +47,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -67,15 +69,22 @@
     public String getIndicatorGroupSets( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         IndicatorGroupSets indicatorGroupSets = new IndicatorGroupSets();
-        indicatorGroupSets.setIndicatorGroupSets( new ArrayList<IndicatorGroupSet>( indicatorService.getAllIndicatorGroupSets() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = indicatorService.getIndicatorGroupSetCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            indicatorGroupSets.setPager( pager );
+
+            List<IndicatorGroupSet> indicatorGroupSetList = new ArrayList<IndicatorGroupSet>(
+                indicatorService.getIndicatorGroupSetsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            indicatorGroupSets.setIndicatorGroupSets( indicatorGroupSetList );
         }
         else
         {
-
+            indicatorGroupSets.setIndicatorGroupSets( new ArrayList<IndicatorGroupSet>( indicatorService.getAllIndicatorGroupSets() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.indicator.IndicatorTypes;
@@ -46,6 +47,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -67,15 +69,22 @@
     public String getIndicatorTypes( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         IndicatorTypes indicatorTypes = new IndicatorTypes();
-        indicatorTypes.setIndicatorTypes( new ArrayList<IndicatorType>( indicatorService.getAllIndicatorTypes() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = indicatorService.getIndicatorTypeCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            indicatorTypes.setPager( pager );
+
+            List<IndicatorType> indicatorTypeList = new ArrayList<IndicatorType>(
+                indicatorService.getIndicatorTypesBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            indicatorTypes.setIndicatorTypes( indicatorTypeList );
         }
         else
         {
-
+            indicatorTypes.setIndicatorTypes( new ArrayList<IndicatorType>( indicatorService.getAllIndicatorTypes() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java	2011-12-19 19:45:07 +0000
@@ -81,15 +81,6 @@
         Maps maps = new Maps();
         maps.setMaps( new ArrayList<MapView>( mappingService.getAllMapViews() ) );
 
-        if ( params.isPaging() )
-        {
-
-        }
-        else
-        {
-
-        }
-
         if ( params.hasLinks() )
         {
             WebLinkPopulator listener = new WebLinkPopulator( request );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java	2011-12-19 19:45:07 +0000
@@ -75,15 +75,6 @@
         MessageConversations messageConversations = new MessageConversations();
         messageConversations.setMessageConversations( new ArrayList<MessageConversation>( messageService.getMessageConversations( 0, 300 ) ) );
 
-        if ( params.isPaging() )
-        {
-
-        }
-        else
-        {
-
-        }
-
         if ( params.hasLinks() )
         {
             WebLinkPopulator listener = new WebLinkPopulator( request );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java	2011-12-19 19:45:07 +0000
@@ -4,6 +4,7 @@
 import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.api.view.Jaxb2Utils;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroups;
@@ -22,6 +23,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -46,15 +48,22 @@
     public String getOrganisationUnits( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         OrganisationUnitGroups organisationUnitGroups = new OrganisationUnitGroups();
-        organisationUnitGroups.setOrganisationUnitGroups( new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = organisationUnitGroupService.getOrganisationUnitGroupCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            organisationUnitGroups.setPager( pager );
+
+            List<OrganisationUnitGroup> organisationUnitGroupList = new ArrayList<OrganisationUnitGroup>(
+                organisationUnitGroupService.getOrganisationUnitGroupsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            organisationUnitGroups.setOrganisationUnitGroups( organisationUnitGroupList );
         }
         else
         {
-
+            organisationUnitGroups.setOrganisationUnitGroups( new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java	2011-12-19 19:45:07 +0000
@@ -31,6 +31,7 @@
 import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.api.view.Jaxb2Utils;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSets;
@@ -49,6 +50,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -73,15 +75,22 @@
     public String getOrganisationUnitGroupSets( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         OrganisationUnitGroupSets organisationUnitGroupSets = new OrganisationUnitGroupSets();
-        organisationUnitGroupSets.setOrganisationUnitGroupSets( new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService.getAllOrganisationUnitGroupSets() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = organisationUnitGroupService.getOrganisationUnitGroupSetCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            organisationUnitGroupSets.setPager( pager );
+
+            List<OrganisationUnitGroupSet> organisationUnitGroupSetList = new ArrayList<OrganisationUnitGroupSet>(
+                organisationUnitGroupService.getOrganisationUnitGroupSetsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            organisationUnitGroupSets.setOrganisationUnitGroupSets( organisationUnitGroupSetList );
         }
         else
         {
-
+            organisationUnitGroupSets.setOrganisationUnitGroupSets( new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService.getAllOrganisationUnitGroupSets() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java	2011-12-19 19:45:07 +0000
@@ -75,15 +75,6 @@
         OrganisationUnitLevels organisationUnitLevels = new OrganisationUnitLevels();
         organisationUnitLevels.setOrganisationUnitLevels( new ArrayList<OrganisationUnitLevel>( organisationUnitService.getOrganisationUnitLevels() ) );
 
-        if ( params.isPaging() )
-        {
-
-        }
-        else
-        {
-
-        }
-
         if ( params.hasLinks() )
         {
             WebLinkPopulator listener = new WebLinkPopulator( request );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java	2011-12-19 17:20:37 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.i18n.I18nManager;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Cal;
@@ -51,6 +52,7 @@
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 
 @Controller
 @RequestMapping( value = ReportController.RESOURCE_PATH )
@@ -78,7 +80,15 @@
 
         if ( params.isPaging() )
         {
-            reports.setReports( new ArrayList<Report>( reportService.getAllReports() ) );
+            int total = reportService.getReportCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            reports.setPager( pager );
+
+            List<Report> reportList = new ArrayList<Report>(
+                reportService.getReportsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            reports.setReports( reportList );
         }
         else
         {
@@ -113,7 +123,7 @@
         return "report";
     }
 
-    @RequestMapping( value = {"/{uid}/data","/{uid}/data.pdf"}, method = RequestMethod.GET )
+    @RequestMapping( value = {"/{uid}/data", "/{uid}/data.pdf"}, method = RequestMethod.GET )
     public void getReportAsPdf( @PathVariable( "uid" ) String uid,
                                 @RequestParam( value = "ou", required = false ) String organisationUnitUid,
                                 @RequestParam( value = "pe", required = false ) String period, HttpServletResponse response )
@@ -150,7 +160,7 @@
 
         String filename = CodecUtils.filenameEncode( report.getName() ) + "." + type;
         ContextUtils.configureResponse( response, contentType, true, filename, attachment );
-        
+
         reportService.renderReport( response.getOutputStream(), uid, date, organisationUnitUid, type,
             i18nManager.getI18nFormat() );
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2011-12-19 17:20:37 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2011-12-19 19:45:07 +0000
@@ -30,6 +30,7 @@
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.i18n.I18nManager;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Cal;
@@ -52,6 +53,7 @@
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 
 import static org.hisp.dhis.system.util.CodecUtils.filenameEncode;
 
@@ -81,7 +83,15 @@
 
         if ( params.isPaging() )
         {
-            reportTables.setReportTables( new ArrayList<ReportTable>( reportTableService.getAllReportTables() ) );
+            int total = reportTableService.getReportTableCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            reportTables.setPager( pager );
+
+            List<ReportTable> reportTableList = new ArrayList<ReportTable>(
+                reportTableService.getReportTablesBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            reportTables.setReportTables( reportTableList );
         }
         else
         {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.sqlview.SqlView;
 import org.hisp.dhis.sqlview.SqlViewService;
 import org.hisp.dhis.sqlview.SqlViews;
@@ -46,6 +47,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -67,15 +69,22 @@
     public String getSqlViews( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         SqlViews sqlViews = new SqlViews();
-        sqlViews.setSqlViews( new ArrayList<SqlView>( sqlViewService.getAllSqlViews() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = sqlViewService.getSqlViewCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            sqlViews.setPager( pager );
+
+            List<SqlView> sqlViewList = new ArrayList<SqlView>(
+                sqlViewService.getSqlViewsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            sqlViews.setSqlViews( sqlViewList );
         }
         else
         {
-
+            sqlViews.setSqlViews( new ArrayList<SqlView>( sqlViewService.getAllSqlViews() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.user.Users;
@@ -46,6 +47,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -69,15 +71,6 @@
         Users users = new Users();
         users.setUsers( new ArrayList<User>( userService.getAllUsers() ) );
 
-        if ( params.isPaging() )
-        {
-
-        }
-        else
-        {
-
-        }
-
         if ( params.hasLinks() )
         {
             WebLinkPopulator listener = new WebLinkPopulator( request );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.validation.ValidationRule;
 import org.hisp.dhis.validation.ValidationRuleService;
 import org.hisp.dhis.validation.ValidationRules;
@@ -46,6 +47,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -67,15 +69,22 @@
     public String getValidationRules( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         ValidationRules validationRules = new ValidationRules();
-        validationRules.setValidationRules( new ArrayList<ValidationRule>( validationRuleService.getAllValidationRules() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = validationRuleService.getValidationRuleCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            validationRules.setPager( pager );
+
+            List<ValidationRule> validationRuleList = new ArrayList<ValidationRule>(
+                validationRuleService.getValidationRulesBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            validationRules.setValidationRules( validationRuleList );
         }
         else
         {
-
+            validationRules.setValidationRules( new ArrayList<ValidationRule>( validationRuleService.getAllValidationRules() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleGroupController.java	2011-12-19 18:07:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleGroupController.java	2011-12-19 19:45:07 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.validation.ValidationRuleGroup;
 import org.hisp.dhis.validation.ValidationRuleGroups;
 import org.hisp.dhis.validation.ValidationRuleService;
@@ -46,6 +47,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -67,15 +69,22 @@
     public String getValidationRuleGroups( IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         ValidationRuleGroups validationRuleGroups = new ValidationRuleGroups();
-        validationRuleGroups.setValidationRuleGroups( new ArrayList<ValidationRuleGroup>( validationRuleService.getAllValidationRuleGroups() ) );
 
         if ( params.isPaging() )
         {
-
+            int total = validationRuleService.getValidationRuleGroupCount();
+
+            Pager pager = new Pager( params.getPage(), total );
+            validationRuleGroups.setPager( pager );
+
+            List<ValidationRuleGroup> validationRuleGroupList = new ArrayList<ValidationRuleGroup>(
+                validationRuleService.getValidationRuleGroupsBetween( pager.getOffset(), pager.getPageSize() ) );
+
+            validationRuleGroups.setValidationRuleGroups( validationRuleGroupList );
         }
         else
         {
-
+            validationRuleGroups.setValidationRuleGroups( new ArrayList<ValidationRuleGroup>( validationRuleService.getAllValidationRuleGroups() ) );
         }
 
         if ( params.hasLinks() )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resources.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resources.java	2011-12-16 19:36:39 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resources.java	2011-12-19 19:45:07 +0000
@@ -34,7 +34,6 @@
 import org.hisp.dhis.common.Dxf2Namespace;
 import org.hisp.dhis.constant.Constants;
 import org.hisp.dhis.dataelement.*;
-import org.hisp.dhis.dataset.CompleteDataSetRegistrations;
 import org.hisp.dhis.dataset.DataSets;
 import org.hisp.dhis.document.Documents;
 import org.hisp.dhis.indicator.IndicatorGroupSets;
@@ -116,7 +115,6 @@
         resources.add( new Resource( "CategoryOptions", DataElementCategoryOptions.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "CategoryOptionCombos", DataElementCategoryOptionCombos.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "Charts", Charts.class, requestMethods, mediaTypes ) );
-        resources.add( new Resource( "CompleteDataSetRegistrations", CompleteDataSetRegistrations.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "Constants", Constants.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "DataElements", DataElements.class, requestMethods, mediaTypes ) );
         resources.add( new Resource( "DataElementGroups", DataElementGroups.class, requestMethods, mediaTypes ) );