=== 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 2011-11-25 11:00:15 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2011-12-19 18:07:12 +0000 @@ -27,18 +27,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.Collection; - import org.hisp.dhis.concept.Concept; import org.hisp.dhis.hierarchy.HierarchyViolationException; +import java.util.Collection; + /** * @author Abyot Asalefew * @version $Id$ */ -public interface DataElementCategoryService +public interface DataElementCategoryService { - String ID = DataElementCategoryService.class.getName(); + String ID = DataElementCategoryService.class.getName(); // ------------------------------------------------------------------------- // Category @@ -46,7 +46,7 @@ /** * Adds a DataElementCategory. - * + * * @param dataElementCategory the DataElementCategory to add. * @return a generated unique id of the added Category. */ @@ -54,7 +54,7 @@ /** * Updates a DataElementCategory. - * + * * @param dataElementCategory the DataElementCategory to update. */ void updateDataElementCategory( DataElementCategory dataElementCategory ); @@ -63,15 +63,15 @@ * Deletes a DataElementCategory. The DataElementCategory is also removed from any * DataElementCategoryCombos if it is a member of. It is not possible to delete a * DataElementCategory with options. - * + * * @param dataElementCategory the DataElementCategory to delete. * @throws HierarchyViolationException if the DataElementCategory has children. */ void deleteDataElementCategory( DataElementCategory dataElementCategory ); - + /** * Returns a DataElementCategory. - * + * * @param id the id of the DataElementCategory to return. * @return the DataElementCategory with the given id, or null if no match. */ @@ -79,35 +79,35 @@ /** * Returns a DataElementCategory. - * + * * @param uid the uid of the DataElementCategory to return. * @return the DataElementCategory with the given uid, or null if no match. */ DataElementCategory getDataElementCategory( String uid ); - + /** * Retrieves the DataElementCategories with the given identifiers. - * + * * @param identifiers the identifiers of the DataElementCategories to retrieve. * @return a collection of DataElementCategories. */ Collection getDataElementCategories( Collection identifiers ); - + /** * Retrieves the DataElementCategory with the given name. - * + * * @param name the name of the DataElementCategory to retrieve. * @return the DataElementCategory. */ DataElementCategory getDataElementCategoryByName( String name ); - + /** * Returns all DataElementCategories. - * + * * @return a collection of all DataElementCategories, or an empty collection if there * are no DataElementCategories. */ - Collection getAllDataElementCategories(); + Collection getAllDataElementCategories(); // ------------------------------------------------------------------------- // CategoryOption @@ -115,29 +115,29 @@ /** * Adds a DataElementCategoryOption. - * - * @param dataElemtnCategoryOption the DataElementCategoryOption to add. + * + * @param dataElementCategoryOption the DataElementCategoryOption to add. * @return a generated unique id of the added DataElementCategoryOption. */ int addDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption ); /** * Updates a DataElementCategoryOption. - * + * * @param dataElementCategoryOption the DataElementCategoryOption to update. */ void updateDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption ); - + /** * Deletes a DataElementCategoryOption. - * + * * @param dataElementCategoryOption */ void deleteDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption ); /** * Returns a DataElementCategoryOption. - * + * * @param id the id of the DataElementCategoryOption to return. * @return the DataElementCategoryOption with the given id, or null if no match. */ @@ -145,52 +145,53 @@ /** * Returns a DataElementCategoryOption. - * + * * @param uid the id of the DataElementCategoryOption to return. * @return the DataElementCategoryOption with the given uid, or null if no match. */ DataElementCategoryOption getDataElementCategoryOption( String uid ); - + /** * Retrieves the DataElementCategoryOptions with the given identifiers. - * + * * @param identifiers the identifiers of the DataElementCategoryOption to retrieve. * @return a Collection of DataElementCategoryOptions. */ Collection getDataElementCategoryOptions( Collection identifiers ); - + /** * Retrieves the DataElementCategoryOption with the given name. + * * @param name the name. * @return the DataElementCategoryOption with the given name. */ DataElementCategoryOption getDataElementCategoryOptionByName( String name ); - + /** * Returns all DataElementCategoryOptions. - * + * * @return a collection of all DataElementCategoryOptions, or an empty collection if there * are no DataElementCategoryOptions. */ Collection getAllDataElementCategoryOptions(); - + /** * Returns all DataElementCategoryOptions for a given concept - * + * * @param concept the Concept * @return a collection of all DataElementCategoryOptions, or an empty collection if there * are no DataElementCategoryOptions. */ Collection getDataElementCategorOptionsByConcept( Concept concept ); - + // ------------------------------------------------------------------------- // CategoryCombo // ------------------------------------------------------------------------- /** * Adds a DataElementCategoryCombo. - * + * * @param dataElementCategoryCombo the DataElementCategoryCombo to add. * @return the generated identifier. */ @@ -198,21 +199,21 @@ /** * Updates a DataElementCategoryCombo. - * + * * @param dataElementCategoryCombo the DataElementCategoryCombo to update. */ void updateDataElementCategoryCombo( DataElementCategoryCombo dataElementCategoryCombo ); /** * Deletes a DataElementCategoryCombo. - * + * * @param dataElementCategoryCombo the DataElementCategoryCombo to delete. */ void deleteDataElementCategoryCombo( DataElementCategoryCombo dataElementCategoryCombo ); - + /** * Retrieves a DataElementCategoryCombo with the given identifier. - * + * * @param id the identifier of the DataElementCategoryCombo to retrieve. * @return the DataElementCategoryCombo. */ @@ -220,67 +221,67 @@ /** * Retrieves a DataElementCategoryCombo with the given uid. - * + * * @param uid the identifier of the DataElementCategoryCombo to retrieve. * @return the DataElementCategoryCombo. */ DataElementCategoryCombo getDataElementCategoryCombo( String uid ); - + /** * Retrieves the DataElementCategoryCombo with the given identifiers. - * + * * @param identifiers the identifiers. * @return a collection of DataElementCategoryCombos. */ Collection getDataElementCategoryCombos( Collection identifiers ); - + /** * Retrieves the DataElementCategoryCombo with the given name. - * + * * @param name the name of the DataElementCategoryCombo to retrieve. * @return the DataElementCategoryCombo. */ DataElementCategoryCombo getDataElementCategoryComboByName( String name ); - + /** * Retrieves all DataElementCategoryCombos. - * + * * @return a collection of DataElementCategoryCombos. */ Collection getAllDataElementCategoryCombos(); - + // ------------------------------------------------------------------------- // CategoryOptionCombo // ------------------------------------------------------------------------- /** * Adds a DataElementCategoryOptionCombo. - * + * * @param dataElementCategoryOptionCombo the DataElementCategoryOptionCombo - * to add. + * to add. * @return the generated identifier. */ int addDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo ); /** * Updates a DataElementCategoryOptionCombo. - * + * * @param dataElementCategoryOptionCombo the DataElementCategoryOptionCombo - * to update. + * to update. */ void updateDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo ); /** * Deletes a DataElementCategoryOptionCombo. - * + * * @param dataElementCategoryOptionCombo the DataElementCategoryOptionCombo - * to delete. + * to delete. */ void deleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo ); /** * Retrieves the DataElementCategoryOptionCombo with the given identifier. - * + * * @param id the identifier of the DataElementCategoryOptionCombo. * @return the DataElementCategoryOptionCombo. */ @@ -288,7 +289,7 @@ /** * Retrieves the DataElementCategoryOptionCombo with the given uid. - * + * * @param uid the uid of the DataElementCategoryOptionCombo. * @return the DataElementCategoryOptionCombo. */ @@ -296,7 +297,7 @@ /** * Retrieves the DataElementCategoryOptionCombos with the given identifiers. - * + * * @param identifiers the identifiers of the DataElementCategoryOptionCombos. * @return a Collection of DataElementCategoryOptionCombos. */ @@ -305,24 +306,24 @@ /** * Retrieves the DataElementCategoryOptionCombo with the given Collection * of DataElementCategoryOptions. - * + * * @param categoryOptions * @return */ DataElementCategoryOptionCombo getDataElementCategoryOptionCombo( Collection categoryOptions ); - + /** * Retrieves a DataElementCategoryOptionCombo. - * + * * @param categoryOptionCombo the DataElementCategoryOptionCombo to - * retrieve. + * retrieve. * @return a DataElementCategoryOptionCombo. */ DataElementCategoryOptionCombo getDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo ); /** * Retrieves all DataElementCategoryOptionCombos. - * + * * @return a Collection of DataElementCategoryOptionCombos. */ Collection getAllDataElementCategoryOptionCombos(); @@ -336,7 +337,7 @@ /** * Retrieves the default DataElementCategoryOptionCombo. - * + * * @return the DataElementCategoryOptionCombo. */ DataElementCategoryOptionCombo getDefaultDataElementCategoryOptionCombo(); @@ -344,7 +345,7 @@ /** * Generates and persists DataElementCategoryOptionCombos for the given * DataElementCategoryCombo. - * + * * @param categoryCombo the DataElementCategoryCombo. */ void generateOptionCombos( DataElementCategoryCombo categoryCombo ); @@ -352,31 +353,31 @@ /** * Invokes updateOptionCombos( DataElementCategoryCombo ) for all category * combos which the given category is a part of. - * + * * @param category the DataElementCategory. */ void updateOptionCombos( DataElementCategory category ); - + /** * Generates the complete set of category option combos for the given * category combo and compares it to the set of persisted category option * combos. Those which are not matched are persisted. - * + * * @param categoryCombo the DataElementCategoryCombo. */ void updateOptionCombos( DataElementCategoryCombo categoryCombo ); - + /** * Populates all transient properties on each Operand in the given collection. - * + * * @param operands the collection of Operands. * @return a collection of Operands. */ public Collection populateOperands( Collection operands ); - + /** * Gets the Operands for the given Collection of DataElements. - * + * * @param dataElements the Collection of DataElements. * @return the Operands for the given Collection of DataElements. */ @@ -384,51 +385,70 @@ /** * Gets the Operands for the given Collection of DataElements. - * - * @param dataElements the Collection of DataElements. + * + * @param dataElements the Collection of DataElements. * @param includeTotals whether to include DataElement totals in the Collection of Operands. * @return the Operands for the given Collection of DataElements. */ Collection getOperands( Collection dataElements, boolean includeTotals ); - + /** * Gets the Operands for the DataElements whith names like the given name. - * + * * @param name the name. * @return the Operands for the DataElements with names like the given name. */ Collection getOperandsLikeName( String name ); - + /** - * Gets the Operands for the given Collection of DataElements. Operands will contain DataElement and CategoryOptionCombo object - * + * Gets the Operands for the given Collection of DataElements. Operands will contain DataElement and CategoryOptionCombo object + * * @param dataElements the Collection of DataElements. * @return the Operands for the given Collection of DataElements. */ Collection getFullOperands( Collection dataElements ); - + Collection getDataElementCategorysBetween( int first, int max ); - + Collection getDataElementCategorysBetweenByName( String name, int first, int max ); - + /** * Returns all DataElementCategories for a given concept - * + * * @param concept the Concept * @return a collection of all DataElementCategories, or an empty collection. */ Collection getDataElementCategorysByConcept( Concept concept ); int getDataElementCategoryCount(); - + int getDataElementCategoryCountByName( String name ); + Collection getDataElementCategoryBetween( int first, int max ); + + Collection getDataElementCategoryBetweenByName( String name, int first, int max ); + + int getDataElementCategoryOptionCount(); + + int getDataElementCategoryOptionCountByName( String name ); + + Collection getDataElementCategoryOptionsBetween( int first, int max ); + + Collection getDataElementCategoryOptionsBetweenByName( String name, int first, int max ); + + int getDataElementCategoryOptionComboCount(); + + int getDataElementCategoryOptionComboCountByName( String name ); + + Collection getDataElementCategoryOptionCombosBetween( int first, int max ); + + Collection getDataElementCategoryOptionCombosBetweenByName( String name, int first, int max ); + + int getDataElementCategoryComboCount(); + + int getDataElementCategoryComboCountByName( String name ); + Collection getDataElementCategoryCombosBetween( int first, int max ); - + Collection 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/dataelement/DefaultDataElementCategoryService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2011-11-25 11:00:15 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2011-12-19 18:07:12 +0000 @@ -27,12 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - import org.apache.commons.collections.CollectionUtils; import org.hisp.dhis.common.GenericDimensionalObjectStore; import org.hisp.dhis.common.GenericIdentifiableObjectStore; @@ -41,6 +35,8 @@ import org.hisp.dhis.system.util.FilterUtils; import org.springframework.transaction.annotation.Transactional; +import java.util.*; + /** * @author Abyot Asalefew * @version $Id$ @@ -230,7 +226,7 @@ { return dataElementCategoryComboStore.getByUid( uid ); } - + public Collection getDataElementCategoryCombos( final Collection identifiers ) { Collection categoryCombo = getAllDataElementCategoryCombos(); @@ -255,7 +251,7 @@ // ------------------------------------------------------------------------- public int addDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo ) - { + { return dataElementCategoryOptionComboStore.save( dataElementCategoryOptionCombo ); } @@ -376,7 +372,7 @@ categoryOptionCombo.setCategoryCombo( categoryCombo ); categoryOptionCombo.setCategoryOptions( new ArrayList( categoryOptions ) ); - + addDataElementCategoryOptionCombo( categoryOptionCombo ); Set categoryOptionCombos = new HashSet(); @@ -384,7 +380,7 @@ categoryCombo.setOptionCombos( categoryOptionCombos ); updateDataElementCategoryCombo( categoryCombo ); - + categoryOption.setCategoryOptionCombos( categoryOptionCombos ); updateDataElementCategoryOption( categoryOption ); } @@ -402,13 +398,13 @@ { DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() ); DataElementCategoryOptionCombo categoryOptionCombo = getDataElementCategoryOptionCombo( operand.getOptionComboId() ); - + operand.updateProperties( dataElement, categoryOptionCombo ); } - + return operands; } - + public Collection getOperands( Collection dataElements, boolean includeTotals ) { Collection operands = new ArrayList(); @@ -419,10 +415,10 @@ { DataElementOperand operand = new DataElementOperand(); operand.updateProperties( dataElement ); - + operands.add( operand ); } - + for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getOptionCombos() ) { DataElementOperand operand = new DataElementOperand(); @@ -434,7 +430,7 @@ return operands; } - + public Collection getOperands( Collection dataElements ) { return getOperands( dataElements, false ); @@ -443,10 +439,10 @@ public Collection getOperandsLikeName( String name ) { Collection dataElements = dataElementService.getDataElementsLikeName( name ); - + return getOperands( dataElements ); } - + public Collection getFullOperands( Collection dataElements ) { Collection operands = new ArrayList(); @@ -466,18 +462,18 @@ } public void generateOptionCombos( DataElementCategoryCombo categoryCombo ) - { + { categoryCombo.generateOptionCombos(); - + for ( DataElementCategoryOptionCombo optionCombo : categoryCombo.getOptionCombos() ) { categoryCombo.getOptionCombos().add( optionCombo ); addDataElementCategoryOptionCombo( optionCombo ); } - + updateDataElementCategoryCombo( categoryCombo ); } - + public void updateOptionCombos( DataElementCategory category ) { for ( DataElementCategoryCombo categoryCombo : getAllDataElementCategoryCombos() ) @@ -488,12 +484,12 @@ } } } - + public void updateOptionCombos( DataElementCategoryCombo categoryCombo ) { List generatedOptionCombos = categoryCombo.generateOptionCombosList(); Set persistedOptionCombos = categoryCombo.getOptionCombos(); - + for ( DataElementCategoryOptionCombo optionCombo : generatedOptionCombos ) { if ( !persistedOptionCombos.contains( optionCombo ) ) @@ -505,7 +501,7 @@ updateDataElementCategoryCombo( categoryCombo ); } - + public int getDataElementCategoryCount() { return dataElementCategoryStore.getCount(); @@ -516,6 +512,30 @@ return dataElementCategoryStore.getCountByName( name ); } + @Override + public int getDataElementCategoryOptionCount() + { + return dataElementCategoryOptionStore.getCount(); + } + + @Override + public int getDataElementCategoryOptionCountByName( String name ) + { + return dataElementCategoryOptionStore.getCountByName( name ); + } + + @Override + public int getDataElementCategoryOptionComboCount() + { + return dataElementCategoryOptionComboStore.getCount(); + } + + @Override + public int getDataElementCategoryOptionComboCountByName( String name ) + { + return dataElementCategoryOptionComboStore.getCountByName( name ); + } + public Collection getDataElementCategorysBetween( int first, int max ) { return dataElementCategoryStore.getBetween( first, max ); @@ -535,24 +555,63 @@ { return dataElementCategoryComboStore.getCountByName( name ); } - + public Collection getDataElementCategoryCombosBetween( int first, int max ) { return dataElementCategoryComboStore.getBetween( first, max ); } public Collection getDataElementCategoryCombosBetweenByName( String name, int first, - int max ) + int max ) { return dataElementCategoryComboStore.getBetweenByName( name, first, max ); } @Override - public Collection getDataElementCategorOptionsByConcept(Concept concept) { - return dataElementCategoryOptionStore.getByConcept(concept); - } - - @Override - public Collection getDataElementCategorysByConcept(Concept concept) { - return dataElementCategoryStore.getByConcept(concept); } + public Collection getDataElementCategorOptionsByConcept( Concept concept ) + { + return dataElementCategoryOptionStore.getByConcept( concept ); + } + + @Override + public Collection getDataElementCategorysByConcept( Concept concept ) + { + return dataElementCategoryStore.getByConcept( concept ); + } + + @Override + public Collection getDataElementCategoryBetween( int first, int max ) + { + return dataElementCategoryStore.getBetween( first, max ); + } + + @Override + public Collection getDataElementCategoryBetweenByName( String name, int first, int max ) + { + return dataElementCategoryStore.getBetweenByName( name, first, max ); + } + + @Override + public Collection getDataElementCategoryOptionsBetween( int first, int max ) + { + return dataElementCategoryOptionStore.getBetween( first, max ); + } + + @Override + public Collection getDataElementCategoryOptionsBetweenByName( String name, int first, int max ) + { + return dataElementCategoryOptionStore.getBetweenByName( name, first, max ); + } + + @Override + public Collection getDataElementCategoryOptionCombosBetween( int first, int max ) + { + return dataElementCategoryOptionComboStore.getBetween( first, max ); + } + + @Override + public Collection getDataElementCategoryOptionCombosBetweenByName( String name, int first, int max ) + { + return dataElementCategoryOptionComboStore.getBetweenByName( name, first, max ); + } } === modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java' --- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2011-12-05 12:21:38 +0000 +++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2011-12-19 18:07:12 +0000 @@ -27,9 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.Collection; -import java.util.List; - import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.SQLQuery; @@ -42,11 +39,14 @@ import org.springframework.beans.factory.annotation.Required; import org.springframework.jdbc.core.JdbcTemplate; +import java.util.Collection; +import java.util.List; + /** * @author Lars Helge Overland * @version $Id$ */ -public class HibernateGenericStore< T > +public class HibernateGenericStore implements GenericNameableObjectStore { protected SessionFactory sessionFactory; @@ -56,9 +56,9 @@ { this.sessionFactory = sessionFactory; } - + protected JdbcTemplate jdbcTemplate; - + public void setJdbcTemplate( JdbcTemplate jdbcTemplate ) { this.jdbcTemplate = jdbcTemplate; @@ -82,7 +82,7 @@ { this.clazz = clazz; } - + private boolean cacheable = false; /** @@ -100,14 +100,14 @@ { this.cacheable = cacheable; } - + // ------------------------------------------------------------------------- // Convenience methods // ------------------------------------------------------------------------- /** * Creates a Query. - * + * * @param hql the hql query. * @return a Query instance. */ @@ -115,10 +115,10 @@ { return sessionFactory.getCurrentSession().createQuery( hql ).setCacheable( cacheable ); } - + /** * Creates a SqlQuery. - * + * * @param sql the sql query. * @return a SqlQuery instance. */ @@ -128,10 +128,10 @@ query.setCacheable( cacheable ); return query; } - + /** * Creates a Critera for the implementation Class type. - * + * * @return a Criteria instance. */ protected final Criteria getCriteria() @@ -143,29 +143,29 @@ { return sessionFactory.getCurrentSession().createCriteria( getClazz() ); } - + /** * Creates a Criteria for the implementation Class type restricted by the * given Criterions. - * + * * @param expressions the Criterions for the Criteria. * @return a Criteria instance. */ protected final Criteria getCriteria( Criterion... expressions ) { Criteria criteria = getCriteria(); - + for ( Criterion expression : expressions ) { criteria.add( expression ); } - + return criteria; } - + /** * Retrieves an object based on the given Criterions. - * + * * @param expressions the Criterions for the Criteria. * @return an object of the implementation Class type. */ @@ -174,10 +174,10 @@ { return (T) getCriteria( expressions ).uniqueResult(); } - + /** * Retrieves a List based on the given Criterions. - * + * * @param expressions the Criterions for the Criteria. * @return a List with objects of the implementation Class type. */ @@ -254,7 +254,7 @@ } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) public Collection getLikeName( String name ) { return getCriteria().add( Restrictions.ilike( "name", "%" + name + "%" ) ).list(); @@ -274,7 +274,7 @@ } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) public Collection getBetween( int first, int max ) { Criteria criteria = getCriteria(); @@ -285,7 +285,7 @@ } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) public Collection getBetweenByName( String name, int first, int max ) { Criteria criteria = getCriteria(); @@ -311,5 +311,5 @@ criteria.setProjection( Projections.rowCount() ); criteria.add( Restrictions.ilike( "name", "%" + name + "%" ) ); return ((Number) criteria.uniqueResult()).intValue(); - } + } } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeTypeController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeTypeController.java 2011-12-09 18:08:05 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeTypeController.java 2011-12-19 18:07:12 +0000 @@ -68,6 +68,15 @@ Attributes attributes = new Attributes(); attributes.setAttributes( new ArrayList( attributeService.getAllAttributes() ) ); + 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/CategoryComboController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryComboController.java 2011-12-12 11:37:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryComboController.java 2011-12-19 18:07:12 +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.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryCombos; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -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 @@ -67,7 +69,23 @@ public String getCategoryCombos( IdentifiableObjectParams params, Model model, HttpServletRequest request ) { DataElementCategoryCombos categoryCombos = new DataElementCategoryCombos(); - categoryCombos.setCategoryCombos( new ArrayList( dataElementCategoryService.getAllDataElementCategoryCombos() ) ); + + if ( params.isPaging() ) + { + int total = dataElementCategoryService.getDataElementCategoryComboCount(); + + Pager pager = new Pager( params.getPage(), total ); + categoryCombos.setPager( pager ); + + List categoryComboList = new ArrayList( + dataElementCategoryService.getDataElementCategoryCombosBetween( pager.getOffset(), pager.getPageSize() ) ); + + categoryCombos.setCategoryCombos( categoryComboList ); + } + else + { + categoryCombos.setCategoryCombos( new ArrayList( dataElementCategoryService.getAllDataElementCategoryCombos() ) ); + } if ( params.hasLinks() ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryController.java 2011-12-12 11:37:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryController.java 2011-12-19 18:07:12 +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.dataelement.DataElementCategories; import org.hisp.dhis.dataelement.DataElementCategory; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -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 @@ -67,7 +69,23 @@ public String getCategories( IdentifiableObjectParams params, Model model, HttpServletRequest request ) { DataElementCategories categories = new DataElementCategories(); - categories.setCategories( new ArrayList( dataElementCategoryService.getAllDataElementCategories() ) ); + + if ( params.isPaging() ) + { + int total = dataElementCategoryService.getDataElementCategoryCount(); + + Pager pager = new Pager( params.getPage(), total ); + categories.setPager( pager ); + + List categoryList = new ArrayList( + dataElementCategoryService.getDataElementCategorysBetween( pager.getOffset(), pager.getPageSize() ) ); + + categories.setCategories( categoryList ); + } + else + { + categories.setCategories( new ArrayList( dataElementCategoryService.getAllDataElementCategories() ) ); + } if ( params.hasLinks() ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryOptionComboController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryOptionComboController.java 2011-12-08 17:11:47 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryOptionComboController.java 2011-12-19 18:07:12 +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.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombos; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -41,6 +42,7 @@ import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; +import java.util.List; /** * @author Morten Olav Hansen @@ -62,7 +64,23 @@ public String getCategoryOptionCombos( IdentifiableObjectParams params, Model model, HttpServletRequest request ) { DataElementCategoryOptionCombos categoryOptionCombos = new DataElementCategoryOptionCombos(); - categoryOptionCombos.setCategoryOptionCombos( new ArrayList( dataElementCategoryService.getAllDataElementCategoryOptionCombos() ) ); + + if ( params.isPaging() ) + { + int total = dataElementCategoryService.getDataElementCategoryOptionComboCount(); + + Pager pager = new Pager( params.getPage(), total ); + categoryOptionCombos.setPager( pager ); + + List categoryOptionComboList = new ArrayList( + dataElementCategoryService.getDataElementCategoryOptionCombosBetween( pager.getOffset(), pager.getPageSize() ) ); + + categoryOptionCombos.setCategoryOptionCombos( categoryOptionComboList ); + } + else + { + categoryOptionCombos.setCategoryOptionCombos( new ArrayList( dataElementCategoryService.getAllDataElementCategoryOptionCombos() ) ); + } if ( params.hasLinks() ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryOptionController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryOptionController.java 2011-12-08 17:11:47 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CategoryOptionController.java 2011-12-19 18:07:12 +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.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptions; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -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 @@ -67,7 +69,23 @@ public String getCategoryOptions( IdentifiableObjectParams params, Model model, HttpServletRequest request ) { DataElementCategoryOptions categoryOptions = new DataElementCategoryOptions(); - categoryOptions.setCategoryOptions( new ArrayList( dataElementCategoryService.getAllDataElementCategoryOptions() ) ); + + if ( params.isPaging() ) + { + int total = dataElementCategoryService.getDataElementCategoryOptionCount(); + + Pager pager = new Pager( params.getPage(), total ); + categoryOptions.setPager( pager ); + + List categoryOptionList = new ArrayList( + dataElementCategoryService.getDataElementCategoryOptionsBetween( pager.getOffset(), pager.getPageSize() ) ); + + categoryOptions.setCategoryOptions( categoryOptionList ); + } + else + { + categoryOptions.setCategoryOptions( new ArrayList( dataElementCategoryService.getAllDataElementCategoryOptions() ) ); + } if ( params.hasLinks() ) { === 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-16 17:42:41 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java 2011-12-19 18:07:12 +0000 @@ -90,6 +90,15 @@ Charts charts = new Charts(); charts.setCharts( new ArrayList( chartService.getAllCharts() ) ); + 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/CompleteDataSetRegistrationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java 2011-12-08 14:31:31 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java 2011-12-19 18:07:12 +0000 @@ -27,6 +27,7 @@ * 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; @@ -54,11 +55,20 @@ //------------------------------------------------------------------------------------------------------- @RequestMapping( method = RequestMethod.GET ) - public String getCompleteDataSetRegistrations( Model model, HttpServletRequest request ) + public String getCompleteDataSetRegistrations( IdentifiableObjectParams params, Model model, HttpServletRequest request ) { CompleteDataSetRegistrations completeDataSetRegistrations = new CompleteDataSetRegistrations(); completeDataSetRegistrations.setCompleteDataSetRegistrations( new ArrayList( completeDataSetRegistrationService.getAllCompleteDataSetRegistrations() ) ); + if ( params.isPaging() ) + { + + } + else + { + + } + model.addAttribute( "model", completeDataSetRegistrations ); return "completeDataSetRegistrations"; === 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-12 13:03:59 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java 2011-12-19 18:07:12 +0000 @@ -69,6 +69,15 @@ Constants constants = new Constants(); constants.setConstants( new ArrayList( constantService.getAllConstants() ) ); + 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/DataElementGroupController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java 2011-12-12 13:03:59 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java 2011-12-19 18:07:12 +0000 @@ -72,6 +72,15 @@ DataElementGroups dataElementGroups = new DataElementGroups(); dataElementGroups.setDataElementGroups( new ArrayList( dataElementService.getAllDataElementGroups() ) ); + 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/IndicatorGroupController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java 2011-12-12 11:37:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java 2011-12-19 18:07:12 +0000 @@ -69,6 +69,15 @@ IndicatorGroups indicatorGroups = new IndicatorGroups(); indicatorGroups.setIndicatorGroups( new ArrayList( indicatorService.getAllIndicatorGroups() ) ); + 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/IndicatorGroupSetController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java 2011-12-12 11:37:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java 2011-12-19 18:07:12 +0000 @@ -69,6 +69,15 @@ IndicatorGroupSets indicatorGroupSets = new IndicatorGroupSets(); indicatorGroupSets.setIndicatorGroupSets( new ArrayList( indicatorService.getAllIndicatorGroupSets() ) ); + 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/IndicatorTypeController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java 2011-12-12 11:37:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java 2011-12-19 18:07:12 +0000 @@ -69,6 +69,15 @@ IndicatorTypes indicatorTypes = new IndicatorTypes(); indicatorTypes.setIndicatorTypes( new ArrayList( indicatorService.getAllIndicatorTypes() ) ); + 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/MapController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java 2011-12-16 18:09:38 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java 2011-12-19 18:07:12 +0000 @@ -81,6 +81,15 @@ Maps maps = new Maps(); maps.setMaps( new ArrayList( 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-16 17:14:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java 2011-12-19 18:07:12 +0000 @@ -75,6 +75,15 @@ MessageConversations messageConversations = new MessageConversations(); messageConversations.setMessageConversations( new ArrayList( 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-12 15:06:51 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java 2011-12-19 18:07:12 +0000 @@ -48,6 +48,15 @@ OrganisationUnitGroups organisationUnitGroups = new OrganisationUnitGroups(); organisationUnitGroups.setOrganisationUnitGroups( new ArrayList( organisationUnitGroupService.getAllOrganisationUnitGroups() ) ); + 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/OrganisationUnitGroupSetController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java 2011-12-12 15:06:51 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java 2011-12-19 18:07:12 +0000 @@ -75,6 +75,15 @@ OrganisationUnitGroupSets organisationUnitGroupSets = new OrganisationUnitGroupSets(); organisationUnitGroupSets.setOrganisationUnitGroupSets( new ArrayList( organisationUnitGroupService.getAllOrganisationUnitGroupSets() ) ); + 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/OrganisationUnitLevelController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java 2011-12-12 15:06:51 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java 2011-12-19 18:07:12 +0000 @@ -75,6 +75,15 @@ OrganisationUnitLevels organisationUnitLevels = new OrganisationUnitLevels(); organisationUnitLevels.setOrganisationUnitLevels( new ArrayList( 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/SqlViewController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java 2011-12-12 13:03:59 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java 2011-12-19 18:07:12 +0000 @@ -69,6 +69,15 @@ SqlViews sqlViews = new SqlViews(); sqlViews.setSqlViews( new ArrayList( sqlViewService.getAllSqlViews() ) ); + 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/UserController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java 2011-12-13 18:41:43 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java 2011-12-19 18:07:12 +0000 @@ -69,6 +69,15 @@ Users users = new Users(); users.setUsers( new ArrayList( 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-12 11:37:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleController.java 2011-12-19 18:07:12 +0000 @@ -69,6 +69,15 @@ ValidationRules validationRules = new ValidationRules(); validationRules.setValidationRules( new ArrayList( validationRuleService.getAllValidationRules() ) ); + 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/ValidationRuleGroupController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleGroupController.java 2011-12-12 11:37:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ValidationRuleGroupController.java 2011-12-19 18:07:12 +0000 @@ -69,6 +69,15 @@ ValidationRuleGroups validationRuleGroups = new ValidationRuleGroups(); validationRuleGroups.setValidationRuleGroups( new ArrayList( validationRuleService.getAllValidationRuleGroups() ) ); + if ( params.isPaging() ) + { + + } + else + { + + } + if ( params.hasLinks() ) { WebLinkPopulator listener = new WebLinkPopulator( request );