=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java 2010-11-27 07:46:29 +0000 @@ -65,6 +65,14 @@ Collection getIndicatorsWithoutGroups(); + int getIndicatorCountByName( String name ); + + Collection getIndicatorsBetweenByName( String name, int first, int max ); + + int getIndicatorCount(); + + Collection getIndicatorsBetween(int first, int max ); + // ------------------------------------------------------------------------- // IndicatorType // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorStore.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorStore.java 2010-11-27 07:46:29 +0000 @@ -58,4 +58,12 @@ Collection getIndicatorsWithGroupSets(); Collection getIndicatorsWithoutGroups(); + + int getIndicatorCountByName( String name ); + + Collection getIndicatorsBetweenByName( String name, int first, int max ); + + int getIndicatorCount(); + + Collection getIndicatorsBetween(int first, int max ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2010-11-27 07:46:29 +0000 @@ -175,6 +175,26 @@ { return i18n( i18nService, indicatorStore.getIndicatorsWithoutGroups() ); } + + public int getIndicatorCount() + { + return indicatorStore.getIndicatorCount(); + } + + public int getIndicatorCountByName( String name ) + { + return indicatorStore.getIndicatorCountByName( name ); + } + + public Collection getIndicatorsBetween( int first, int max ) + { + return i18n( i18nService, indicatorStore.getIndicatorsBetween( first, max ) ); + } + + public Collection getIndicatorsBetweenByName( String name, int first, int max ) + { + return i18n( i18nService, indicatorStore.getIndicatorsBetweenByName( name, first, max ) ); + } // ------------------------------------------------------------------------- // IndicatorType @@ -369,4 +389,5 @@ } } ); } + } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java 2010-10-29 12:19:15 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java 2010-11-27 07:46:29 +0000 @@ -45,16 +45,6 @@ public class HibernateIndicatorStore extends HibernateGenericStore implements IndicatorStore { - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private SessionFactory sessionFactory; - - public void setSessionFactory( SessionFactory sessionFactory ) - { - this.sessionFactory = sessionFactory; - } // ------------------------------------------------------------------------- // Indicator @@ -167,5 +157,25 @@ final String hql = "from Indicator d where d.groups.size = 0"; return sessionFactory.getCurrentSession().createQuery( hql ).list(); + } + + public int getIndicatorCount() + { + return getCount(); + } + + public int getIndicatorCountByName( String name ) + { + return getCountByName( name ); + } + + public Collection getIndicatorsBetween( int first, int max ) + { + return getBetween( first, max ); + } + + public Collection getIndicatorsBetweenByName( String name, int first, int max ) + { + return getBetweenByName( name, first, max ); } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-11-23 18:25:34 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-11-27 07:46:29 +0000 @@ -57,6 +57,7 @@ + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java 2010-11-25 21:34:02 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java 2010-11-27 07:46:29 +0000 @@ -87,7 +87,7 @@ public String execute() { - if ( isNotBlank( key) ) + if ( isNotBlank( key ) ) { this.paging = createPaging( dataElementService.getDataElementGroupCountByName( key ) ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java 2010-11-27 07:46:29 +0000 @@ -27,24 +27,21 @@ * 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.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; -import org.apache.commons.collections.CollectionUtils; import org.hisp.dhis.datadictionary.DataDictionary; import org.hisp.dhis.datadictionary.DataDictionaryService; import org.hisp.dhis.datadictionary.comparator.DataDictionaryNameComparator; import org.hisp.dhis.indicator.Indicator; -import org.hisp.dhis.indicator.IndicatorGroup; import org.hisp.dhis.indicator.IndicatorService; -import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator; import org.hisp.dhis.options.datadictionary.DataDictionaryModeManager; import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler; - -import com.opensymphony.xwork2.Action; +import org.hisp.dhis.paging.ActionPagingSupport; /** * @author Torgeir Lorange Ostby @@ -52,7 +49,7 @@ * ch_bharath1 $ */ public class GetIndicatorListAction - implements Action +extends ActionPagingSupport { // ------------------------------------------------------------------------- // Dependencies @@ -119,13 +116,6 @@ return dataDictionaries; } - private List indicatorGroups; - - public List getIndicatorGroups() - { - return indicatorGroups; - } - // ------------------------------------------------------------------------- // Input & Output // ------------------------------------------------------------------------- @@ -142,16 +132,16 @@ this.dataDictionaryId = dataDictionaryId; } - private Integer indicatorGroupId; - - public Integer getIndicatorGroupId() + private String key; + + public String getKey() { - return indicatorGroupId; + return key; } - public void setIndicatorGroupId( Integer indicatorGroupId ) + public void setKey( String key ) { - this.indicatorGroupId = indicatorGroupId; + this.key = key; } // ------------------------------------------------------------------------- @@ -176,10 +166,6 @@ dataDictionaryModeManager.setCurrentDataDictionary( dataDictionaryId ); } - indicatorGroups = new ArrayList( indicatorService.getAllIndicatorGroups() ); - - Collections.sort( indicatorGroups, new IndicatorGroupNameComparator() ); - dataDictionaries = new ArrayList( dataDictionaryService.getAllDataDictionaries() ); Collections.sort( dataDictionaries, new DataDictionaryNameComparator() ); @@ -188,25 +174,25 @@ // Criteria // ------------------------------------------------------------------------- - if ( dataDictionaryId != null && indicatorGroupId == null ) + if ( isNotBlank( key ) ) // Filter on key only if set + { + this.paging = createPaging( indicatorService.getIndicatorCountByName( key ) ); + + indicators = new ArrayList( indicatorService.getIndicatorsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) ); + } + else if ( dataDictionaryId != null ) { indicators = new ArrayList( dataDictionaryService.getDataDictionary( dataDictionaryId ).getIndicators() ); - } - else if ( dataDictionaryId == null && indicatorGroupId != null ) - { - indicators = new ArrayList( indicatorService.getIndicatorGroup( indicatorGroupId ).getMembers() ); - } - else if ( dataDictionaryId != null && indicatorGroupId != null ) - { - Collection dictionary = dataDictionaryService.getDataDictionary( dataDictionaryId ).getIndicators(); - - Collection members = indicatorService.getIndicatorGroup( indicatorGroupId ).getMembers(); - - indicators = new ArrayList( CollectionUtils.intersection( dictionary, members ) ); + + this.paging = createPaging( indicators.size() ); + + indicators = getBlockElement( indicators, paging.getStartPage(), paging.getEndPos() ); } else { - indicators = new ArrayList( indicatorService.getAllIndicators() ); + this.paging = createPaging( indicatorService.getIndicatorCount() ); + + indicators = new ArrayList( indicatorService.getIndicatorsBetween( paging.getStartPos(), paging.getPageSize() ) ); } Collections.sort( indicators, indicatorComparator ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2010-11-25 21:34:02 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2010-11-27 07:46:29 +0000 @@ -318,6 +318,7 @@ /dhis-web-maintenance-datadictionary/indicator.vm /dhis-web-maintenance-datadictionary/menu.vm javascript/indicator.js,javascript/dataDictionary.js,javascript/denum.js + ../dhis-web-commons/paging/paging.css - + - -
$i18n.getString( "filter_by_name" ):
#filterDiv( "indicator" ) $i18n.getString( "select_data_dictionary" ):
$i18n.getString( "filter_by_group_view_all" ): -
- -
-
+ #if ( $dataDictionaryMode == "extended" ) @@ -69,6 +59,8 @@ #end
+

+ #parse( "/dhis-web-commons/paging/paging.vm" ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js 2010-11-20 08:23:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js 2010-11-27 07:46:29 +0000 @@ -4,10 +4,9 @@ function criteriaChanged() { - var indicatorGroupId = getListValue( "indicatorGroupList" ); var dataDictionaryId = getListValue( "dataDictionaryList" ); - var url = "indicator.action?&dataDictionaryId=" + dataDictionaryId + "&indicatorGroupId=" + indicatorGroupId; + var url = "indicator.action?&dataDictionaryId=" + dataDictionaryId; window.location.href = url; }