------------------------------------------------------------ revno: 19360 committer: Lars Helge Overland <larshe...@gmail.com> branch nick: dhis2 timestamp: Thu 2015-06-11 13:38:56 +0200 message: Data element service and store. Changed from using Collection to List as return type. No point in upcasting the return type. modified: dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/util/FilterUtils.java dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/paging/Paging.java
-- 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/dataelement/DataElementService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2015-03-13 15:48:26 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2015-06-11 11:38:56 +0000 @@ -116,7 +116,7 @@ * @return List of DataElements with a given key, or all dataelements if no * match. */ - Collection<DataElement> searchDataElementsByName( String key ); + List<DataElement> searchDataElementsByName( String key ); /** * Returns a DataElement with a given short name. @@ -129,26 +129,26 @@ /** * Returns all DataElements. * - * @return a collection of all DataElements, or an empty collection if there + * @return a list of all DataElements, or an empty collection if there * are no DataElements. */ - Collection<DataElement> getAllDataElements(); + List<DataElement> getAllDataElements(); /** * Returns all DataElements with corresponding identifiers. Returns all * DataElements if the given argument is null. * * @param identifiers the collection of identifiers. - * @return a collection of DataElements. + * @return a list of DataElements. */ - Collection<DataElement> getDataElements( Collection<Integer> identifiers ); + List<DataElement> getDataElements( Collection<Integer> identifiers ); /** * Returns all DataElements with corresponding identifiers. Returns all * DataElements if the given argument is null. * * @param uids the collection of uids. - * @return a collection of DataElements. + * @return a list of DataElements. */ List<DataElement> getDataElementsByUid( Collection<String> uids ); @@ -158,34 +158,34 @@ * * @return all DataElements with types that are possible to aggregate. */ - Collection<DataElement> getAggregateableDataElements(); + List<DataElement> getAggregateableDataElements(); /** * Returns all DataElements with a given aggregation operator. * * @param aggregationOperator the aggregation operator of the DataElements * to return. - * @return a collection of all DataElements with the given aggregation + * @return a list of all DataElements with the given aggregation * operator, or an empty collection if no DataElements have the * aggregation operator. */ - Collection<DataElement> getDataElementsByAggregationOperator( String aggregationOperator ); - - /** - * Returns all DataElements with the given domain type. - * - * @param domainType the DataElementDomainType. - * @return all DataElements with the given domainType. - */ - Collection<DataElement> getDataElementsByDomainType( DataElementDomain domainType ); - - /** - * Returns all DataElements with the given domain type. - * - * @param domainType the DataElementDomainType. - * @return all DataElements with the given domainType. - */ - Collection<DataElement> getDataElementsByDomainType( DataElementDomain domainType, int first, int max ); + List<DataElement> getDataElementsByAggregationOperator( String aggregationOperator ); + + /** + * Returns all DataElements with the given domain type. + * + * @param domainType the DataElementDomainType. + * @return all DataElements with the given domainType. + */ + List<DataElement> getDataElementsByDomainType( DataElementDomain domainType ); + + /** + * Returns all DataElements with the given domain type. + * + * @param domainType the DataElementDomainType. + * @return all DataElements with the given domainType. + */ + List<DataElement> getDataElementsByDomainType( DataElementDomain domainType, int first, int max ); /** * Returns all DataElements with the given type. @@ -194,15 +194,15 @@ * @return all DataElements with the given type. */ - Collection<DataElement> getDataElementsByType( String type ); + List<DataElement> getDataElementsByType( String type ); /** * Returns the DataElements with the given PeriodType. * * @param periodType the PeriodType. - * @return a Collection of DataElements. + * @return a list of DataElements. */ - Collection<DataElement> getDataElementsByPeriodType( PeriodType periodType ); + List<DataElement> getDataElementsByPeriodType( PeriodType periodType ); /** * Returns all DataElements with the given category combo. @@ -210,7 +210,7 @@ * @param categoryCombo the DataElementCategoryCombo. * @return all DataElements with the given category combo. */ - Collection<DataElement> getDataElementByCategoryCombo( DataElementCategoryCombo categoryCombo ); + List<DataElement> getDataElementByCategoryCombo( DataElementCategoryCombo categoryCombo ); /** * Returns a Map with DataElementCategoryCombo as key and a Collection of @@ -239,28 +239,28 @@ * @return all DataElements which are associated with one or more * DataElementGroupSets. */ - Collection<DataElement> getDataElementsWithGroupSets(); + List<DataElement> getDataElementsWithGroupSets(); /** * Returns all DataElements which are not member of any DataElementGroups. * * @return all DataElements which are not member of any DataElementGroups. */ - Collection<DataElement> getDataElementsWithoutGroups(); + List<DataElement> getDataElementsWithoutGroups(); /** * Returns all DataElements which are not assigned to any DataSets. * * @return all DataElements which are not assigned to any DataSets. */ - Collection<DataElement> getDataElementsWithoutDataSets(); + List<DataElement> getDataElementsWithoutDataSets(); /** * Returns all DataElements which are assigned to at least one DataSet. * * @return all DataElements which are assigned to at least one DataSet. */ - Collection<DataElement> getDataElementsWithDataSets(); + List<DataElement> getDataElementsWithDataSets(); /** * Returns all DataElements which are assigned to any of the given DataSets. @@ -268,7 +268,7 @@ * @param dataSets the collection of DataSets. * @return all DataElements which are assigned to any of the given DataSets. */ - Collection<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets ); + List<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets ); /** * Returns all DataElements which have the given aggregation level assigned. @@ -276,13 +276,13 @@ * @param aggregationLevel the aggregation level. * @return all DataElements which have the given aggregation level assigned. */ - Collection<DataElement> getDataElementsByAggregationLevel( int aggregationLevel ); - - Collection<DataElement> getDataElementsLikeName( String name ); - - Collection<DataElement> getDataElementsBetween( int first, int max ); - - Collection<DataElement> getDataElementsBetweenByName( String name, int first, int max ); + List<DataElement> getDataElementsByAggregationLevel( int aggregationLevel ); + + List<DataElement> getDataElementsLikeName( String name ); + + List<DataElement> getDataElementsBetween( int first, int max ); + + List<DataElement> getDataElementsBetweenByName( String name, int first, int max ); int getDataElementCount(); @@ -350,7 +350,7 @@ * @param identifiers the id collection. * @return data elements with identifiers in the given collection. */ - Collection<DataElementGroup> getDataElementGroups( Collection<Integer> identifiers ); + List<DataElementGroup> getDataElementGroups( Collection<Integer> identifiers ); /** * Returns the data element groups with the given uids. @@ -382,7 +382,7 @@ * @return a collection of all DataElementGroups, or an empty collection if * no DataElementGroups exist. */ - Collection<DataElementGroup> getAllDataElementGroups(); + List<DataElementGroup> getAllDataElementGroups(); /** @@ -410,7 +410,7 @@ * @return a collection of all DataElementGroups that contain the given * DataElement. */ - Collection<DataElementGroup> getGroupsContainingDataElement( DataElement dataElement ); + List<DataElementGroup> getGroupsContainingDataElement( DataElement dataElement ); /** * Returns data elements with identifier in the given id. @@ -418,7 +418,7 @@ * @param groupId is the id of data element group. * @return data elements with identifier in the given id. */ - Collection<DataElement> getDataElementsByGroupId( int groupId ); + Set<DataElement> getDataElementsByGroupId( int groupId ); /** * Defines the given data elements as zero is significant. All other data @@ -432,30 +432,30 @@ /** * Returns all DataElement which zeroIsSignificant property is true or false * - * @param zeroIsSignificant is zeroIsSignificant property + * @param list is zeroIsSignificant property * @return a collection of all DataElement */ - Collection<DataElement> getDataElementsByZeroIsSignificant( boolean zeroIsSignificant ); + List<DataElement> getDataElementsByZeroIsSignificant( boolean zeroIsSignificant ); /** * Returns all DataElement which zeroIsSignificant property is true or false * * @param zeroIsSignificant is zeroIsSignificant property * @param dataElementGroup is group contain data elements - * @return a collection of all DataElement + * @return a set of data elements. */ - Collection<DataElement> getDataElementsByZeroIsSignificantAndGroup( boolean zeroIsSignificant, + Set<DataElement> getDataElementsByZeroIsSignificantAndGroup( boolean zeroIsSignificant, DataElementGroup dataElementGroup ); - Collection<DataElementGroup> getDataElementGroupsBetween( int first, int max ); + List<DataElementGroup> getDataElementGroupsBetween( int first, int max ); - Collection<DataElementGroup> getDataElementGroupsBetweenByName( String name, int first, int max ); + List<DataElementGroup> getDataElementGroupsBetweenByName( String name, int first, int max ); int getDataElementGroupCount(); int getDataElementGroupCountByName( String name ); - Collection<DataElement> getDataElements( DataSet dataSet, String key, Integer max ); + List<DataElement> getDataElements( DataSet dataSet, String key, Integer max ); // ------------------------------------------------------------------------- // DataElementGroupSet @@ -475,21 +475,21 @@ DataElementGroupSet getDataElementGroupSetByName( String name ); - Collection<DataElementGroupSet> getCompulsoryDataElementGroupSets(); - - Collection<DataElementGroupSet> getCompulsoryDataElementGroupSetsWithMembers(); - - Collection<DataElementGroupSet> getCompulsoryDataElementGroupSetsNotAssignedTo( DataElement dataElement ); - - Collection<DataElementGroupSet> getAllDataElementGroupSets(); - - Collection<DataElementGroupSet> getDataElementGroupSets( Collection<Integer> identifiers ); + List<DataElementGroupSet> getCompulsoryDataElementGroupSets(); + + List<DataElementGroupSet> getCompulsoryDataElementGroupSetsWithMembers(); + + List<DataElementGroupSet> getCompulsoryDataElementGroupSetsNotAssignedTo( DataElement dataElement ); + + List<DataElementGroupSet> getAllDataElementGroupSets(); + + List<DataElementGroupSet> getDataElementGroupSets( Collection<Integer> identifiers ); List<DataElementGroupSet> getDataElementGroupSetsByUid( Collection<String> uids ); - Collection<DataElementGroupSet> getDataElementGroupSetsBetween( int first, int max ); + List<DataElementGroupSet> getDataElementGroupSetsBetween( int first, int max ); - Collection<DataElementGroupSet> getDataElementGroupSetsBetweenByName( String name, int first, int max ); + List<DataElementGroupSet> getDataElementGroupSetsBetweenByName( String name, int first, int max ); int getDataElementGroupSetCount(); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2015-03-08 14:00:13 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2015-06-11 11:38:56 +0000 @@ -29,6 +29,7 @@ */ import java.util.Collection; +import java.util.List; import java.util.Set; import org.hisp.dhis.common.GenericDimensionalObjectStore; @@ -55,7 +56,7 @@ * @param key the name of the DataElement to return. * @return List of DataElements with a given key, or all dataelements if no match. */ - Collection<DataElement> searchDataElementsByName( String key ); + List<DataElement> searchDataElementsByName( String key ); /** * Returns all DataElements with types that are possible to aggregate. The @@ -63,7 +64,7 @@ * * @return all DataElements with types that are possible to aggregate. */ - Collection<DataElement> getAggregateableDataElements(); + List<DataElement> getAggregateableDataElements(); /** * Returns all DataElements with a given aggregation operator. @@ -74,7 +75,7 @@ * operator, or an empty collection if no DataElements have the * aggregation operator. */ - Collection<DataElement> getDataElementsByAggregationOperator( String aggregationOperator ); + List<DataElement> getDataElementsByAggregationOperator( String aggregationOperator ); /** * Returns all DataElements with the given domain type. @@ -82,7 +83,7 @@ * @param domainType the domainType. * @return all DataElements with the given domainType. */ - Collection<DataElement> getDataElementsByDomainType( DataElementDomain domainType ); + List<DataElement> getDataElementsByDomainType( DataElementDomain domainType ); /** * Returns all DataElements with the given domain type. @@ -90,7 +91,7 @@ * @param domainType the domainType. * @return all DataElements with the given domainType. */ - Collection<DataElement> getDataElementsByDomainType( DataElementDomain domainType, int first, int max ); + List<DataElement> getDataElementsByDomainType( DataElementDomain domainType, int first, int max ); /** * Returns all DataElements with the given type. @@ -99,7 +100,7 @@ * @return all DataElements with the given type. */ - Collection<DataElement> getDataElementsByType( String type ); + List<DataElement> getDataElementsByType( String type ); /** * Returns all DataElements with the given category combo. @@ -107,7 +108,7 @@ * @param categoryCombo the DataElementCategoryCombo. * @return all DataElements with the given category combo. */ - Collection<DataElement> getDataElementByCategoryCombo( DataElementCategoryCombo categoryCombo ); + List<DataElement> getDataElementByCategoryCombo( DataElementCategoryCombo categoryCombo ); /** * Returns all DataElements which are associated with one or more @@ -116,7 +117,7 @@ * @return all DataElements which are associated with one or more * DataElementGroupSets. */ - Collection<DataElement> getDataElementsWithGroupSets(); + List<DataElement> getDataElementsWithGroupSets(); /** * Defines the given data elements as zero is significant. @@ -130,28 +131,28 @@ * @param zeroIsSignificant is zeroIsSignificant property * @return a collection of all DataElement */ - Collection<DataElement> getDataElementsByZeroIsSignificant( boolean zeroIsSignificant ); + List<DataElement> getDataElementsByZeroIsSignificant( boolean zeroIsSignificant ); /** * Returns all DataElements which are not member of any DataElementGroups. * * @return all DataElements which are not member of any DataElementGroups. */ - Collection<DataElement> getDataElementsWithoutGroups(); + List<DataElement> getDataElementsWithoutGroups(); /** * Returns all DataElements which are not assigned to any DataSets. * * @return all DataElements which are not assigned to any DataSets. */ - Collection<DataElement> getDataElementsWithoutDataSets(); + List<DataElement> getDataElementsWithoutDataSets(); /** * Returns all DataElements which are assigned to at least one DataSet. * * @return all DataElements which are assigned to at least one DataSet. */ - Collection<DataElement> getDataElementsWithDataSets(); + List<DataElement> getDataElementsWithDataSets(); /** * Returns all DataElements which are assigned to any of the given DataSets. @@ -159,7 +160,7 @@ * @param dataSets the collection of DataSets. * @return all DataElements which are assigned to any of the given DataSets. */ - Collection<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets ); + List<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets ); /** * Returns all DataElements which have the given aggregation level assigned. @@ -167,7 +168,7 @@ * @param aggregationLevel the aggregation level. * @return all DataElements which have the given aggregation level assigned. */ - Collection<DataElement> getDataElementsByAggregationLevel( int aggregationLevel ); + List<DataElement> getDataElementsByAggregationLevel( int aggregationLevel ); /** * Returns a mapping of data element uid and associated category option combo @@ -178,7 +179,7 @@ */ ListMap<String, String> getDataElementCategoryOptionComboMap( Set<String> dataElementUids ); - Collection<DataElement> get( DataSet dataSet, String key, Integer max ); + List<DataElement> get( DataSet dataSet, String key, Integer max ); int getCountByDomainType( DataElementDomain domainType ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2015-05-28 18:21:56 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2015-06-11 11:38:56 +0000 @@ -131,15 +131,15 @@ } @Override - public Collection<DataElement> getAllDataElements() + public List<DataElement> getAllDataElements() { return i18n( i18nService, dataElementStore.getAll() ); } @Override - public Collection<DataElement> getDataElements( final Collection<Integer> identifiers ) + public List<DataElement> getDataElements( final Collection<Integer> identifiers ) { - Collection<DataElement> dataElements = getAllDataElements(); + List<DataElement> dataElements = getAllDataElements(); return identifiers == null ? dataElements : FilterUtils.filter( dataElements, new Filter<DataElement>() { @@ -167,16 +167,16 @@ } @Override - public Collection<DataElement> getDataElementsByZeroIsSignificant( boolean zeroIsSignificant ) + public List<DataElement> getDataElementsByZeroIsSignificant( boolean zeroIsSignificant ) { return dataElementStore.getDataElementsByZeroIsSignificant( zeroIsSignificant ); } @Override - public Collection<DataElement> getDataElementsByZeroIsSignificantAndGroup( boolean zeroIsSignificant, + public Set<DataElement> getDataElementsByZeroIsSignificantAndGroup( boolean zeroIsSignificant, DataElementGroup dataElementGroup ) { - Collection<DataElement> dataElements = new HashSet<>(); + Set<DataElement> dataElements = new HashSet<>(); for ( DataElement element : dataElementGroup.getMembers() ) { @@ -190,7 +190,7 @@ } @Override - public Collection<DataElement> getAggregateableDataElements() + public List<DataElement> getAggregateableDataElements() { return i18n( i18nService, dataElementStore.getAggregateableDataElements() ); } @@ -209,7 +209,7 @@ } @Override - public Collection<DataElement> searchDataElementsByName( String key ) + public List<DataElement> searchDataElementsByName( String key ) { return i18n( i18nService, dataElementStore.searchDataElementsByName( key ) ); } @@ -228,21 +228,21 @@ } @Override - public Collection<DataElement> getDataElementsByAggregationOperator( String aggregationOperator ) + public List<DataElement> getDataElementsByAggregationOperator( String aggregationOperator ) { return i18n( i18nService, dataElementStore.getDataElementsByAggregationOperator( aggregationOperator ) ); } @Override - public Collection<DataElement> getDataElementsByType( String type ) + public List<DataElement> getDataElementsByType( String type ) { return i18n( i18nService, dataElementStore.getDataElementsByType( type ) ); } @Override - public Collection<DataElement> getDataElementsByPeriodType( final PeriodType periodType ) + public List<DataElement> getDataElementsByPeriodType( final PeriodType periodType ) { - Collection<DataElement> dataElements = getAllDataElements(); + List<DataElement> dataElements = getAllDataElements(); return FilterUtils.filter( dataElements, new Filter<DataElement>() { @@ -255,19 +255,19 @@ } @Override - public Collection<DataElement> getDataElementsByDomainType( DataElementDomain domainType ) + public List<DataElement> getDataElementsByDomainType( DataElementDomain domainType ) { return i18n( i18nService, dataElementStore.getDataElementsByDomainType( domainType ) ); } @Override - public Collection<DataElement> getDataElementsByDomainType( DataElementDomain domainType, int first, int max ) + public List<DataElement> getDataElementsByDomainType( DataElementDomain domainType, int first, int max ) { return i18n( i18nService, dataElementStore.getDataElementsByDomainType( domainType, first, max ) ); } @Override - public Collection<DataElement> getDataElementByCategoryCombo( DataElementCategoryCombo categoryCombo ) + public List<DataElement> getDataElementByCategoryCombo( DataElementCategoryCombo categoryCombo ) { return i18n( i18nService, dataElementStore.getDataElementByCategoryCombo( categoryCombo ) ); } @@ -314,31 +314,31 @@ } @Override - public Collection<DataElement> getDataElementsWithGroupSets() + public List<DataElement> getDataElementsWithGroupSets() { return i18n( i18nService, dataElementStore.getDataElementsWithGroupSets() ); } @Override - public Collection<DataElement> getDataElementsWithoutGroups() + public List<DataElement> getDataElementsWithoutGroups() { return i18n( i18nService, dataElementStore.getDataElementsWithoutGroups() ); } @Override - public Collection<DataElement> getDataElementsWithoutDataSets() + public List<DataElement> getDataElementsWithoutDataSets() { return i18n( i18nService, dataElementStore.getDataElementsWithoutDataSets() ); } @Override - public Collection<DataElement> getDataElementsWithDataSets() + public List<DataElement> getDataElementsWithDataSets() { return i18n( i18nService, dataElementStore.getDataElementsWithDataSets() ); } @Override - public Collection<DataElement> getDataElementsLikeName( String name ) + public List<DataElement> getDataElementsLikeName( String name ) { return getObjectsByName( i18nService, dataElementStore, name ); } @@ -362,25 +362,25 @@ } @Override - public Collection<DataElement> getDataElementsBetween( int first, int max ) + public List<DataElement> getDataElementsBetween( int first, int max ) { return getObjectsBetween( i18nService, dataElementStore, first, max ); } @Override - public Collection<DataElement> getDataElementsBetweenByName( String name, int first, int max ) + public List<DataElement> getDataElementsBetweenByName( String name, int first, int max ) { return getObjectsBetweenByName( i18nService, dataElementStore, name, first, max ); } @Override - public Collection<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets ) + public List<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets ) { return i18n( i18nService, dataElementStore.getDataElementsByDataSets( dataSets ) ); } @Override - public Collection<DataElement> getDataElementsByAggregationLevel( int aggregationLevel ) + public List<DataElement> getDataElementsByAggregationLevel( int aggregationLevel ) { return i18n( i18nService, dataElementStore.getDataElementsByAggregationLevel( aggregationLevel ) ); } @@ -405,7 +405,7 @@ } @Override - public Collection<DataElement> getDataElements( DataSet dataSet, String key, Integer max ) + public List<DataElement> getDataElements( DataSet dataSet, String key, Integer max ) { return i18n( i18nService, dataElementStore.get( dataSet, key, max ) ); } @@ -454,9 +454,9 @@ } @Override - public Collection<DataElementGroup> getDataElementGroups( final Collection<Integer> identifiers ) + public List<DataElementGroup> getDataElementGroups( final Collection<Integer> identifiers ) { - Collection<DataElementGroup> groups = getAllDataElementGroups(); + List<DataElementGroup> groups = getAllDataElementGroups(); return identifiers == null ? groups : FilterUtils.filter( groups, new Filter<DataElementGroup>() { @@ -481,7 +481,7 @@ } @Override - public Collection<DataElementGroup> getAllDataElementGroups() + public List<DataElementGroup> getAllDataElementGroups() { return i18n( i18nService, dataElementGroupStore.getAll() ); } @@ -520,9 +520,9 @@ } @Override - public Collection<DataElementGroup> getGroupsContainingDataElement( DataElement dataElement ) + public List<DataElementGroup> getGroupsContainingDataElement( DataElement dataElement ) { - Collection<DataElementGroup> groups = getAllDataElementGroups(); + List<DataElementGroup> groups = getAllDataElementGroups(); Iterator<DataElementGroup> iterator = groups.iterator(); @@ -538,7 +538,7 @@ } @Override - public Collection<DataElement> getDataElementsByGroupId( int groupId ) + public Set<DataElement> getDataElementsByGroupId( int groupId ) { return i18n( i18nService, dataElementGroupStore.get( groupId ).getMembers() ); } @@ -556,13 +556,13 @@ } @Override - public Collection<DataElementGroup> getDataElementGroupsBetween( int first, int max ) + public List<DataElementGroup> getDataElementGroupsBetween( int first, int max ) { return getObjectsBetween( i18nService, dataElementGroupStore, first, max ); } @Override - public Collection<DataElementGroup> getDataElementGroupsBetweenByName( String name, int first, int max ) + public List<DataElementGroup> getDataElementGroupsBetweenByName( String name, int first, int max ) { return getObjectsBetweenByName( i18nService, dataElementGroupStore, name, first, max ); } @@ -629,9 +629,9 @@ } @Override - public Collection<DataElementGroupSet> getCompulsoryDataElementGroupSets() + public List<DataElementGroupSet> getCompulsoryDataElementGroupSets() { - Collection<DataElementGroupSet> groupSets = new ArrayList<>(); + List<DataElementGroupSet> groupSets = new ArrayList<>(); for ( DataElementGroupSet groupSet : getAllDataElementGroupSets() ) { @@ -645,7 +645,7 @@ } @Override - public Collection<DataElementGroupSet> getCompulsoryDataElementGroupSetsWithMembers() + public List<DataElementGroupSet> getCompulsoryDataElementGroupSetsWithMembers() { return FilterUtils.filter( getAllDataElementGroupSets(), new Filter<DataElementGroupSet>() { @@ -658,9 +658,9 @@ } @Override - public Collection<DataElementGroupSet> getCompulsoryDataElementGroupSetsNotAssignedTo( DataElement dataElement ) + public List<DataElementGroupSet> getCompulsoryDataElementGroupSetsNotAssignedTo( DataElement dataElement ) { - Collection<DataElementGroupSet> groupSets = new ArrayList<>(); + List<DataElementGroupSet> groupSets = new ArrayList<>(); for ( DataElementGroupSet groupSet : getCompulsoryDataElementGroupSets() ) { @@ -674,15 +674,15 @@ } @Override - public Collection<DataElementGroupSet> getAllDataElementGroupSets() + public List<DataElementGroupSet> getAllDataElementGroupSets() { return i18n( i18nService, dataElementGroupSetStore.getAll() ); } @Override - public Collection<DataElementGroupSet> getDataElementGroupSets( final Collection<Integer> identifiers ) + public List<DataElementGroupSet> getDataElementGroupSets( final Collection<Integer> identifiers ) { - Collection<DataElementGroupSet> groupSets = getAllDataElementGroupSets(); + List<DataElementGroupSet> groupSets = getAllDataElementGroupSets(); return identifiers == null ? groupSets : FilterUtils.filter( groupSets, new Filter<DataElementGroupSet>() { @@ -713,13 +713,13 @@ } @Override - public Collection<DataElementGroupSet> getDataElementGroupSetsBetween( int first, int max ) + public List<DataElementGroupSet> getDataElementGroupSetsBetween( int first, int max ) { return getObjectsBetween( i18nService, dataElementGroupSetStore, first, max ); } @Override - public Collection<DataElementGroupSet> getDataElementGroupSetsBetweenByName( String name, int first, int max ) + public List<DataElementGroupSet> getDataElementGroupSetsBetweenByName( String name, int first, int max ) { return getObjectsBetweenByName( i18nService, dataElementGroupSetStore, name, first, max ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2015-05-28 14:33:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2015-06-11 11:38:56 +0000 @@ -34,6 +34,7 @@ import java.sql.SQLException; import java.util.Collection; import java.util.HashSet; +import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; @@ -68,14 +69,14 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> searchDataElementsByName( String key ) + public List<DataElement> searchDataElementsByName( String key ) { return getCriteria( Restrictions.ilike( "name", "%" + key + "%" ) ).list(); } @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getAggregateableDataElements() + public List<DataElement> getAggregateableDataElements() { Set<String> types = new HashSet<>(); @@ -87,28 +88,28 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsByAggregationOperator( String aggregationOperator ) + public List<DataElement> getDataElementsByAggregationOperator( String aggregationOperator ) { return getCriteria( Restrictions.eq( "aggregationOperator", aggregationOperator ) ).list(); } @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsByType( String type ) + public List<DataElement> getDataElementsByType( String type ) { return getCriteria( Restrictions.eq( "type", type ) ).list(); } @Override @SuppressWarnings( "unchecked" ) - public Collection<DataElement> getDataElementsByDomainType( DataElementDomain domainType ) + public List<DataElement> getDataElementsByDomainType( DataElementDomain domainType ) { return getCriteria( Restrictions.eq( "domainType", domainType ) ).list(); } @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsByDomainType( DataElementDomain domainType, int first, int max ) + public List<DataElement> getDataElementsByDomainType( DataElementDomain domainType, int first, int max ) { Criteria criteria = getCriteria(); criteria.add( Restrictions.eq( "domainType", domainType ) ); @@ -122,14 +123,14 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementByCategoryCombo( DataElementCategoryCombo categoryCombo ) + public List<DataElement> getDataElementByCategoryCombo( DataElementCategoryCombo categoryCombo ) { return getCriteria( Restrictions.eq( "categoryCombo", categoryCombo ) ).list(); } @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsWithGroupSets() + public List<DataElement> getDataElementsWithGroupSets() { String hql = "from DataElement d where d.groupSets.size > 0"; @@ -160,7 +161,7 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsByZeroIsSignificant( boolean zeroIsSignificant ) + public List<DataElement> getDataElementsByZeroIsSignificant( boolean zeroIsSignificant ) { Criteria criteria = getCriteria(); criteria.add( Restrictions.eq( "zeroIsSignificant", zeroIsSignificant ) ); @@ -171,7 +172,7 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsWithoutGroups() + public List<DataElement> getDataElementsWithoutGroups() { String hql = "from DataElement d where d.groups.size = 0"; @@ -180,7 +181,7 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsWithoutDataSets() + public List<DataElement> getDataElementsWithoutDataSets() { String hql = "from DataElement d where d.dataSets.size = 0 and d.domainType =:domainType"; @@ -189,7 +190,7 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsWithDataSets() + public List<DataElement> getDataElementsWithDataSets() { String hql = "from DataElement d where d.dataSets.size > 0"; @@ -198,7 +199,7 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets ) + public List<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets ) { String hql = "select distinct de from DataElement de join de.dataSets ds where ds.id in (:ids)"; @@ -207,7 +208,7 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> getDataElementsByAggregationLevel( int aggregationLevel ) + public List<DataElement> getDataElementsByAggregationLevel( int aggregationLevel ) { String hql = "from DataElement de join de.aggregationLevels al where al = :aggregationLevel"; @@ -250,7 +251,7 @@ @Override @SuppressWarnings("unchecked") - public Collection<DataElement> get( DataSet dataSet, String key, Integer max ) + public List<DataElement> get( DataSet dataSet, String key, Integer max ) { String hql = "select dataElement from DataSet dataSet inner join dataSet.dataElements as dataElement where dataSet.id = :dataSetId "; === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java 2015-05-28 03:33:28 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java 2015-06-11 11:38:56 +0000 @@ -28,7 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.Collection; import java.util.List; import java.util.Locale; @@ -73,7 +72,7 @@ Paging.getCountByName( i18n( i18nService, store.getAll() ), name ); } - public static <T extends IdentifiableObject> Collection<T> getObjectsBetween( + public static <T extends IdentifiableObject> List<T> getObjectsBetween( I18nService i18nService, GenericIdentifiableObjectStore<T> store, int first, int max ) { return i18nService.currentLocaleIsBase() ? @@ -81,7 +80,7 @@ Paging.getObjectsBetween( i18n( i18nService, store.getAll() ), first, max ); } - public static <T extends IdentifiableObject> Collection<T> getObjectsBetweenByName( + public static <T extends IdentifiableObject> List<T> getObjectsBetweenByName( I18nService i18nService, GenericIdentifiableObjectStore<T> store, String name, int first, int max ) { return i18nService.currentLocaleIsBase() ? @@ -89,7 +88,7 @@ Paging.getObjectsBetweenByName( i18n( i18nService, store.getAll() ), name, first, max ); } - public static <T extends IdentifiableObject> Collection<T> getObjectsByName( + public static <T extends IdentifiableObject> List<T> getObjectsByName( I18nService i18nService, GenericIdentifiableObjectStore<T> store, String name ) { return i18nService.currentLocaleIsBase() ? === modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/util/FilterUtils.java' --- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/util/FilterUtils.java 2015-05-28 18:21:56 +0000 +++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/util/FilterUtils.java 2015-06-11 11:38:56 +0000 @@ -43,17 +43,17 @@ * * @param collection the Collection. * @param filter the Filter. - * @param <T> the type of the Collection members. + * @param <V> the type of the Collection members. * @return the filtered Collection. */ - public static <T> Collection<T> filter( Collection<T> collection, Filter<T> filter ) + public static <T extends Collection<V>, V> T filter( T collection, Filter<V> filter ) { if ( collection == null || filter == null ) { return collection; } - final Iterator<T> iterator = collection.iterator(); + final Iterator<V> iterator = collection.iterator(); while ( iterator.hasNext() ) { === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/paging/Paging.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/paging/Paging.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/paging/Paging.java 2015-06-11 11:38:56 +0000 @@ -224,7 +224,7 @@ return list.subList( first, last ); } - public static <T extends IdentifiableObject> Collection<T> getObjectsByName( Collection<T> objects, String name ) + public static <T extends IdentifiableObject> List<T> getObjectsByName( Collection<T> objects, String name ) { final List<T> list = new ArrayList<>();
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp