=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartStore.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartStore.java 2010-12-13 16:32:50 +0000 @@ -27,6 +27,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Collection; + import org.hisp.dhis.common.GenericStore; /** @@ -45,4 +47,13 @@ * @return the Chart. */ Chart getByTitle( String title ); + + Collection getChartsBetween( int first, int max ); + + Collection getChartsBetweenByName( String name, int first, int max ); + + int getChartCount(); + + int getChartCountByName( String name ); + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2010-11-29 17:23:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java 2010-12-13 16:32:50 +0000 @@ -30,6 +30,7 @@ import java.util.Collection; import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.indicator.IndicatorGroupSet; /** * @author Lars Helge Overland @@ -142,4 +143,12 @@ * @return true if the report table has been generated, false it not. */ boolean reportTableIsGenerated( int id ); + + Collection getReportTablesBetween( int first, int max ); + + Collection getReportTablesBetweenByName( String name, int first, int max ); + + int getReportTableCount(); + + int getReportTableCountByName( String name ); } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartService.java 2010-07-28 13:44:59 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartService.java 2010-12-13 16:32:50 +0000 @@ -33,6 +33,7 @@ import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataelement.DataElementGroupSet; import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.organisationunit.OrganisationUnit; @@ -73,4 +74,13 @@ Chart getChartByTitle( String name ); Collection getCharts( final Collection identifiers ); + + Collection getChartsBetween( int first, int max ); + + Collection getChartsBetweenByName( String name, int first, int max ); + + int getChartCount(); + + int getChartCountByName( String name ); + } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java 2010-12-13 16:32:50 +0000 @@ -27,6 +27,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Collection; + +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; import org.hisp.dhis.chart.Chart; import org.hisp.dhis.chart.ChartStore; @@ -43,4 +48,35 @@ { return getObject( Restrictions.eq( "title", title ) ); } + + public int getChartCount() + { + return getCount(); + } + + public Collection getChartsBetween( int first, int max ) + { + Criteria criteria = getCriteria(); + criteria.addOrder( Order.asc( "title" ) ); + criteria.setFirstResult( first ); + criteria.setMaxResults( max ); + return criteria.list(); + } + public Collection getChartsBetweenByName( String name, int first, int max ) + { + Criteria criteria = getCriteria(); + criteria.add( Restrictions.ilike( "title", "%" + name + "%" ) ); + criteria.addOrder( Order.asc( "title" ) ); + criteria.setFirstResult( first ); + criteria.setMaxResults( max ); + return criteria.list(); + } + + public int getChartCountByName( String name ) + { + Criteria criteria = getCriteria(); + criteria.setProjection( Projections.rowCount() ); + criteria.add( Restrictions.ilike( "title", "%" + name + "%" ) ); + return ((Number) criteria.uniqueResult()).intValue(); + } } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2010-12-05 19:09:58 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2010-12-13 16:32:50 +0000 @@ -640,4 +640,23 @@ } ); } + public int getChartCount() + { + return chartStore.getChartCount(); + } + + public int getChartCountByName( String name ) + { + return chartStore.getChartCountByName( name ); + } + + public Collection getChartsBetween( int first, int max ) + { + return chartStore.getChartsBetween( first, max ); + } + + public Collection getChartsBetweenByName( String name, int first, int max ) + { + return chartStore.getChartsBetweenByName( name, first, max ); + } } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2010-12-11 19:53:11 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2010-12-13 16:32:50 +0000 @@ -558,4 +558,24 @@ return reportTables; } + + public Collection getReportTablesBetweenByName( String name, int first, int max ) + { + return reportTableStore.getBetweenByName( name, first, max ); + } + + public int getReportTableCount() + { + return reportTableStore.getCount(); + } + + public int getReportTableCountByName( String name ) + { + return reportTableStore.getCountByName( name ); + } + + public Collection getReportTablesBetween( int first, int max ) + { + return reportTableStore.getBetween( first, max ); + } } === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java 2010-12-13 16:32:50 +0000 @@ -27,6 +27,8 @@ * 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.Collections; import java.util.List; @@ -34,6 +36,8 @@ import org.hisp.dhis.chart.Chart; import org.hisp.dhis.chart.ChartService; import org.hisp.dhis.chart.comparator.ChartTitleComparator; +import org.hisp.dhis.paging.ActionPagingSupport; +import org.hisp.dhis.reporttable.ReportTable; import com.opensymphony.xwork2.Action; @@ -42,7 +46,7 @@ * @version $Id$ */ public class GetAllChartsAction - implements Action + extends ActionPagingSupport { // ------------------------------------------------------------------------- // Dependencies @@ -56,8 +60,20 @@ } // ------------------------------------------------------------------------- - // Output + // Input & Output // ------------------------------------------------------------------------- + + private String key; + + public String getKey() + { + return key; + } + + public void setKey( String key ) + { + this.key = key; + } private List charts; @@ -72,7 +88,18 @@ public String execute() { - charts = new ArrayList( chartService.getAllCharts() ); + if ( isNotBlank( key ) ) + { + this.paging = createPaging( chartService.getChartCountByName( key ) ); + + charts = new ArrayList( chartService.getChartsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) ); + } + else + { + this.paging = createPaging( chartService.getChartCount() ); + + charts = new ArrayList( chartService.getChartsBetween( paging.getStartPos(), paging.getPageSize() ) ); + } Collections.sort( charts, new ChartTitleComparator() ); === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetAllTablesAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetAllTablesAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetAllTablesAction.java 2010-12-13 16:32:50 +0000 @@ -27,22 +27,24 @@ * 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.Collections; import java.util.List; +import org.hisp.dhis.document.Document; +import org.hisp.dhis.paging.ActionPagingSupport; import org.hisp.dhis.reporttable.ReportTable; import org.hisp.dhis.reporttable.ReportTableService; import org.hisp.dhis.reporttable.comparator.ReportTableComparator; -import com.opensymphony.xwork2.Action; - /** * @author Lars Helge Overland * @version $Id$ */ public class GetAllTablesAction - implements Action + extends ActionPagingSupport { // ------------------------------------------------------------------------- // Dependencies @@ -56,8 +58,20 @@ } // ------------------------------------------------------------------------- - // Output + // Input & Output // ------------------------------------------------------------------------- + + private String key; + + public String getKey() + { + return key; + } + + public void setKey( String key ) + { + this.key = key; + } private List tables; @@ -72,7 +86,18 @@ public String execute() { - tables = new ArrayList( reportTableService.getAllReportTables() ); + if ( isNotBlank( key ) ) + { + this.paging = createPaging( reportTableService.getReportTableCountByName( key ) ); + + tables = new ArrayList( reportTableService.getReportTablesBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) ); + } + else + { + this.paging = createPaging( reportTableService.getReportTableCount() ); + + tables = new ArrayList( reportTableService.getReportTablesBetween( paging.getStartPos(), paging.getPageSize() ) ); + } Collections.sort( tables, new ReportTableComparator() ); === 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 15:18:59 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2010-12-13 16:32:50 +0000 @@ -85,6 +85,7 @@ /dhis-web-reporting/viewChartForm.vm /dhis-web-reporting/menu.vm javascript/chart.js + ../dhis-web-commons/paging/paging.css @@ -184,6 +185,7 @@ /dhis-web-reporting/viewTableForm.vm /dhis-web-reporting/menu.vm javascript/table.js + ../dhis-web-commons/paging/paging.css === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm 2010-12-03 05:41:34 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm 2010-12-13 16:32:50 +0000 @@ -5,6 +5,7 @@ +
#filterDiv( "displayViewChartForm" )

@@ -35,6 +36,8 @@ #end
+

+ #parse( "/dhis-web-commons/paging/paging.vm" ) === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm 2010-12-03 05:41:34 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm 2010-12-13 16:32:50 +0000 @@ -6,6 +6,7 @@ +
#filterDiv( "displayManageTableForm" )

@@ -42,6 +43,8 @@ #end
+

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