=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2015-10-08 13:50:01 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2015-10-08 14:59:36 +0000 @@ -38,6 +38,7 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; +import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.calendar.Calendar; @@ -100,17 +101,18 @@ */ public static List getUids( Collection objects ) { - List uids = new ArrayList<>(); - - if ( objects != null ) - { - for ( T object : objects ) - { - uids.add( object.getUid() ); - } - } - - return uids; + return objects != null ? objects.stream().map( o -> o.getUid() ).collect( Collectors.toList() ) : null; + } + + /** + * Returns a list of internal identifiers for the given collection of IdentifiableObjects. + * + * @param objects the list of IdentifiableObjects. + * @return a list of uids. + */ + public static List getIdentifiers( Collection objects ) + { + return objects != null ? objects.stream().map( o -> o.getId() ).collect( Collectors.toList() ) : null; } /** @@ -166,27 +168,6 @@ } /** - * Returns a list of internal identifiers for the given collection of IdentifiableObjects. - * - * @param objects the list of IdentifiableObjects. - * @return a list of uids. - */ - public static List getIdentifiers( Collection objects ) - { - List uids = new ArrayList<>(); - - if ( objects != null ) - { - for ( T object : objects ) - { - uids.add( object.getId() ); - } - } - - return uids; - } - - /** * Filters the given list of IdentifiableObjects based on the given key. * * @param identifiableObjects the list of IdentifiableObjects. @@ -332,30 +313,6 @@ } /** - * Returns a list of database identifiers from a list of idObjects - * - * @param identifiableObjects Collection of idObjects - * @return List of database identifiers for idObjects - */ - public static List getIdList( Collection identifiableObjects ) - { - List integers = new ArrayList<>(); - - if ( identifiableObjects != null ) - { - for ( IdentifiableObject identifiableObject : identifiableObjects ) - { - if ( identifiableObject != null ) - { - integers.add( identifiableObject.getId() ); - } - } - } - - return integers; - } - - /** * Returns a mapping between the uid and the name of the given identifiable * objects. * === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-10-01 10:05:20 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-10-08 14:59:36 +0000 @@ -54,7 +54,7 @@ import java.util.List; import java.util.Set; -import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdList; +import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdentifiers; import static org.hisp.dhis.commons.util.TextUtils.getCommaDelimitedString; import static org.hisp.dhis.system.util.DateUtils.getMediumDateString; @@ -331,7 +331,7 @@ private String getEventSelectQuery( EventSearchParams params, List organisationUnits ) { - List orgUnitIds = getIdList( organisationUnits ); + List orgUnitIds = getIdentifiers( organisationUnits ); SqlHelper hlp = new SqlHelper();