=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/DocumentService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/DocumentService.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/DocumentService.java 2010-12-13 15:18:59 +0000 @@ -29,6 +29,8 @@ import java.util.Collection; +import org.hisp.dhis.datamart.DataMartExport; + /** * @author Lars Helge Overland * @version $Id$ @@ -75,4 +77,13 @@ * @return the Document. */ Document getDocumentByName( String name ); + + Collection getDocumentsBetween( int first, int max ); + + Collection getDocumentsBetweenByName( String name, int first, int max ); + + int getDocumentCount(); + + int getDocumentCountByName( String name ); + } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java 2010-12-13 15:18:59 +0000 @@ -81,4 +81,24 @@ { return documentStore.getByName( name ); } + + public int getDocumentCount() + { + return documentStore.getCount(); + } + + public int getDocumentCountByName( String name ) + { + return documentStore.getCountByName( name ); + } + + public Collection getDocumentsBetween( int first, int max ) + { + return documentStore.getBetween( first, max ); + } + + public Collection getDocumentsBetweenByName( String name, int first, int max ) + { + return documentStore.getBetweenByName( name, first, max ); + } } === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetAllDocumentsAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetAllDocumentsAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetAllDocumentsAction.java 2010-12-13 15:18:59 +0000 @@ -27,11 +27,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import static org.apache.commons.lang.StringUtils.isNotBlank; + import java.util.ArrayList; import java.util.List; +import org.hisp.dhis.dataelement.DataElementGroup; import org.hisp.dhis.document.Document; import org.hisp.dhis.document.DocumentService; +import org.hisp.dhis.paging.ActionPagingSupport; +import org.hisp.dhis.report.Report; import com.opensymphony.xwork2.Action; @@ -40,7 +45,7 @@ * @version $Id$ */ public class GetAllDocumentsAction - implements Action + extends ActionPagingSupport { // ------------------------------------------------------------------------- // Dependencies @@ -54,7 +59,7 @@ } // ------------------------------------------------------------------------- - // Output + // Input & Output // ------------------------------------------------------------------------- private List documents; @@ -63,6 +68,18 @@ { return documents; } + + private String key; + + public String getKey() + { + return key; + } + + public void setKey( String key ) + { + this.key = key; + } // ------------------------------------------------------------------------- // Action implementation @@ -70,8 +87,19 @@ public String execute() { - documents = new ArrayList( documentService.getAllDocuments() ); - + if ( isNotBlank( key ) ) + { + this.paging = createPaging( documentService.getDocumentCountByName( key ) ); + + documents = new ArrayList( documentService.getDocumentsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) ); + } + else + { + this.paging = createPaging( documentService.getDocumentCount() ); + + documents = new ArrayList( documentService.getDocumentsBetween( paging.getStartPos(), paging.getPageSize() ) ); + } + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2010-12-13 14:58:04 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2010-12-13 15:18:59 +0000 @@ -33,6 +33,7 @@ /dhis-web-reporting/viewDocumentForm.vm /dhis-web-reporting/menu.vm javascript/document.js + ../dhis-web-commons/paging/paging.css === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm 2010-12-03 05:41:34 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm 2010-12-13 15:18:59 +0000 @@ -8,6 +8,7 @@ +
#filterDiv( "displayViewDocumentForm" )
@@ -39,6 +40,8 @@ #end +

+ #parse( "/dhis-web-commons/paging/paging.vm" )