dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09248
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2402: Apply pagination in Data Element Category, Data Element Category Combination and Concept lists.
------------------------------------------------------------
revno: 2402
committer: Quang <Quang@Quang-PC>
branch nick: trunk
timestamp: Tue 2010-12-21 00:34:30 +0700
message:
Apply pagination in Data Element Category, Data Element Category Combination and Concept lists.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/ConceptService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/concept/DefaultConceptService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/GetDataElementCategoryComboListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/GetConceptListAction.java
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/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/concept.vm
--
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-api/src/main/java/org/hisp/dhis/concept/ConceptService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/ConceptService.java 2010-09-17 21:30:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/ConceptService.java 2010-12-20 17:34:30 +0000
@@ -29,6 +29,8 @@
import java.util.Collection;
+import org.hisp.dhis.dataelement.DataElementCategory;
+
/**
* @author Dang Duy Hieu
* @version $Id ConceptService.java Aug 25, 2010$
@@ -59,4 +61,12 @@
// Concept expanding
// -------------------------------------------------------------------------
+ Collection<Concept> getConceptsBetween( int first, int max );
+
+ Collection<Concept> getConceptsBetweenByName( String name, int first, int max );
+
+ int getConceptCount();
+
+ int getConceptCountByName( String name );
+
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2010-12-07 17:02:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2010-12-20 17:34:30 +0000
@@ -348,4 +348,20 @@
*/
Collection<DataElementOperand> getFullOperands( Collection<DataElement> dataElements );
+
+ Collection<DataElementCategory> getDataElementCategorysBetween( int first, int max );
+
+ Collection<DataElementCategory> getDataElementCategorysBetweenByName( String name, int first, int max );
+
+ int getDataElementCategoryCount();
+
+ int getDataElementCategoryCountByName( String name );
+
+ Collection<DataElementCategoryCombo> getDataElementCategoryCombosBetween( int first, int max );
+
+ Collection<DataElementCategoryCombo> getDataElementCategoryCombosBetweenByName( String name, int first, int max );
+
+ int getDataElementCategoryComboCount();
+
+ int getDataElementCategoryComboCountByName( String name );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/concept/DefaultConceptService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/concept/DefaultConceptService.java 2010-11-12 17:58:03 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/concept/DefaultConceptService.java 2010-12-20 17:34:30 +0000
@@ -92,4 +92,28 @@
Concept defaultConcept = new Concept( "default" );
conceptStore.save( defaultConcept );
}
+
+ @Override
+ public int getConceptCount()
+ {
+ return conceptStore.getCount();
+ }
+
+ @Override
+ public int getConceptCountByName( String name )
+ {
+ return conceptStore.getCountByName( name );
+ }
+
+ @Override
+ public Collection<Concept> getConceptsBetween( int first, int max )
+ {
+ return conceptStore.getBetween( first, max );
+ }
+
+ @Override
+ public Collection<Concept> getConceptsBetweenByName( String name, int first, int max )
+ {
+ return conceptStore.getBetweenByName( name, first, max );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2010-12-07 17:02:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2010-12-20 17:34:30 +0000
@@ -682,4 +682,45 @@
return optionsMap;
}
+
+ public int getDataElementCategoryCount()
+ {
+ return dataElementCategoryStore.getCount();
+ }
+
+ public int getDataElementCategoryCountByName( String name )
+ {
+ return dataElementCategoryStore.getCountByName( name );
+ }
+
+ public Collection<DataElementCategory> getDataElementCategorysBetween( int first, int max )
+ {
+ return dataElementCategoryStore.getBetween( first, max );
+ }
+
+ public Collection<DataElementCategory> getDataElementCategorysBetweenByName( String name, int first, int max )
+ {
+ return dataElementCategoryStore.getBetweenByName( name, first, max );
+ }
+
+ public int getDataElementCategoryComboCount()
+ {
+ return dataElementCategoryComboStore.getCount();
+ }
+
+ public int getDataElementCategoryComboCountByName( String name )
+ {
+ return dataElementCategoryComboStore.getCountByName( name );
+ }
+
+ public Collection<DataElementCategoryCombo> getDataElementCategoryCombosBetween( int first, int max )
+ {
+ return dataElementCategoryComboStore.getBetween( first, max );
+ }
+
+ public Collection<DataElementCategoryCombo> getDataElementCategoryCombosBetweenByName( String name, int first,
+ int max )
+ {
+ return dataElementCategoryComboStore.getBetweenByName( name, first, max );
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryListAction.java 2010-11-27 18:16:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryListAction.java 2010-12-20 17:34:30 +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.datadictionary.DataDictionary;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.comparator.DataElementCategoryNameComparator;
-
-import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.paging.ActionPagingSupport;
/**
* @author Abyot Asalefew
* @version $Id$
*/
public class GetDataElementCategoryListAction
- implements Action
+ extends ActionPagingSupport<DataElementCategory>
{
// -------------------------------------------------------------------------
// Dependencies
@@ -72,6 +74,18 @@
{
return defaultCategory;
}
+
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -81,9 +95,19 @@
{
defaultCategory = dataElementCategoryService.getDataElementCategoryByName( DataElementCategory.DEFAULT_NAME );
- dataElementCategories = new ArrayList<DataElementCategory>( dataElementCategoryService
- .getAllDataElementCategories() );
-
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( dataElementCategoryService.getDataElementCategoryCountByName( key ) );
+
+ dataElementCategories = new ArrayList<DataElementCategory>( dataElementCategoryService.getDataElementCategorysBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( dataElementCategoryService.getDataElementCategoryCount() );
+
+ dataElementCategories = new ArrayList<DataElementCategory>( dataElementCategoryService.getDataElementCategorysBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+
Collections.sort( dataElementCategories, new DataElementCategoryNameComparator() );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/GetDataElementCategoryComboListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/GetDataElementCategoryComboListAction.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/categorycombo/GetDataElementCategoryComboListAction.java 2010-12-20 17:34:30 +0000
@@ -27,13 +27,17 @@
* 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.datadictionary.DataDictionary;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.comparator.DataElementCategoryComboNameComparator;
+import org.hisp.dhis.paging.ActionPagingSupport;
import com.opensymphony.xwork2.Action;
@@ -42,7 +46,7 @@
* @version $Id$
*/
public class GetDataElementCategoryComboListAction
- implements Action
+ extends ActionPagingSupport<DataElementCategoryCombo>
{
// -------------------------------------------------------------------------
// Dependencies
@@ -72,6 +76,18 @@
{
return defaultCombo;
}
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
@@ -82,9 +98,19 @@
defaultCombo = dataElementCategoryService
.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
- dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService
- .getAllDataElementCategoryCombos() );
-
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( dataElementCategoryService.getDataElementCategoryComboCountByName( key ) );
+
+ dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService.getDataElementCategoryCombosBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( dataElementCategoryService.getDataElementCategoryComboCount() );
+
+ dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService.getDataElementCategoryCombosBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+
Collections.sort( dataElementCategoryCombos, new DataElementCategoryComboNameComparator() );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/GetConceptListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/GetConceptListAction.java 2010-11-27 18:16:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/GetConceptListAction.java 2010-12-20 17:34:30 +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.concept.ConceptService;
import org.hisp.dhis.concept.Concept;
import org.hisp.dhis.concept.comparator.ConceptNameComparator;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.paging.ActionPagingSupport;
import com.opensymphony.xwork2.ActionSupport;
@@ -42,7 +46,7 @@
* @version $Id$
*/
public class GetConceptListAction
- extends ActionSupport
+ extends ActionPagingSupport<Concept>
{
// -------------------------------------------------------------------------
// Dependencies
@@ -73,6 +77,18 @@
return defaultConcept;
}
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
// -------------------------------------------------------------------------
// Action implemantation
// -------------------------------------------------------------------------
@@ -81,8 +97,19 @@
{
defaultConcept = conceptService.getConceptByName( Concept.DEFAULT_CONCEPT_NAME );
- concepts = new ArrayList<Concept>( conceptService.getAllConcepts() );
-
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( conceptService.getConceptCountByName( key ) );
+
+ concepts = new ArrayList<Concept>( conceptService.getConceptsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( conceptService.getConceptCount() );
+
+ concepts = new ArrayList<Concept>( conceptService.getConceptsBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+
Collections.sort( concepts, new ConceptNameComparator() );
return SUCCESS;
=== 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-12-13 06:40:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2010-12-20 17:34:30 +0000
@@ -803,6 +803,7 @@
<param name="page">/dhis-web-maintenance-datadictionary/multidimensional/category.vm</param>
<param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
<param name="javascripts">javascript/category.js</param>
+ <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
</action>
<action name="getDataElementCategory"
@@ -878,6 +879,7 @@
<param name="page">/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm</param>
<param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
<param name="javascripts">javascript/categoryCombo.js</param>
+ <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
</action>
<action name="getDataElementCategoryCombo"
@@ -951,6 +953,7 @@
/dhis-web-maintenance-datadictionary/multidimensional/concept.vm</param>
<param name="javascripts">javascript/concept.js</param>
<param name="requiredAuthorities">F_CONCEPT_MANAGEMENT</param>
+ <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
</action>
<action name="showAddConceptForm"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm 2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm 2010-12-20 17:34:30 +0000
@@ -5,7 +5,7 @@
<td style="vertical-align:top">
<table width="100%">
<tr>
- <td>$i18n.getString( "filter_by_name" ): <form style="display:inline" action="none" onsubmit="return false"><div style="inline"><input type="text" onkeyup="filterValues( this.value )"/></div></form></td>
+ <td>#filterDiv( "category" )</td>
<td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddDataElementCategoryForm.action'"/></td>
</tr>
</table>
@@ -34,6 +34,8 @@
</tbody>
</table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
</td>
<td style="width:20em; padding-left:2em; vertical-align:top">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm 2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm 2010-12-20 17:34:30 +0000
@@ -5,7 +5,7 @@
<td style="vertical-align:top">
<table width="100%">
<tr>
- <td>$i18n.getString( "filter_by_name" ): <form style="display:inline" action="none" onsubmit="return false"><div style="inline"><input type="text" onkeyup="filterValues( this.value )"/></div></form></td>
+ <td>#filterDiv( "categoryCombo" )</td>
<td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddDataElementCategoryComboForm.action'"/></td>
</tr>
</table>
@@ -34,6 +34,8 @@
</tbody>
</table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
</td>
<td style="width:20em; padding-left:2em; vertical-align:top">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/concept.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/concept.vm 2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/concept.vm 2010-12-20 17:34:30 +0000
@@ -5,7 +5,7 @@
<td style="vertical-align:top">
<table width="100%">
<tr>
- <td>$i18n.getString( "filter_by_name" ): <form style="display:inline" action="none" onsubmit="return false"><div style="inline"><input type="text" onkeyup="filterValues( this.value )"/></div></form></td>
+ <td>#filterDiv( "concept" )</td>
<td colspan="4" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddConceptForm.action'" style="width:80px"/></td>
</tr>
</table>
@@ -33,6 +33,8 @@
#end
</tbody>
</table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
</td>
<td style="width:20em; padding-left:2em; vertical-align:top">