------------------------------------------------------------ revno: 20664 committer: Lars Helge Overland <larshe...@gmail.com> branch nick: dhis2 timestamp: Tue 2015-10-13 09:58:48 +0200 message: Analytics, removed use of UniqueArrayList, slow. modified: dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.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-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-10-08 13:50:01 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-10-13 07:58:48 +0000 @@ -79,6 +79,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.Future; +import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -116,7 +117,6 @@ import org.hisp.dhis.common.NameableObjectUtils; import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.commons.collection.ListUtils; -import org.hisp.dhis.commons.collection.UniqueArrayList; import org.hisp.dhis.commons.util.DebugUtils; import org.hisp.dhis.constant.ConstantService; import org.hisp.dhis.dataelement.DataElement; @@ -1159,9 +1159,9 @@ if ( ORGUNIT_DIM_ID.equals( dimension ) ) { - List<NameableObject> ous = new UniqueArrayList<>(); - List<Integer> levels = new UniqueArrayList<>(); - List<OrganisationUnitGroup> groups = new UniqueArrayList<>(); + List<NameableObject> ous = new ArrayList<>(); + List<Integer> levels = new ArrayList<>(); + List<OrganisationUnitGroup> groups = new ArrayList<>(); for ( String ou : items ) { @@ -1208,7 +1208,9 @@ } } - List<NameableObject> orgUnits = new UniqueArrayList<>(); + ous = ous.stream().distinct().collect( Collectors.toList() ); // Remove duplicates + + List<NameableObject> orgUnits = new ArrayList<>(); List<OrganisationUnit> ousList = NameableObjectUtils.asTypedList( ous ); if ( !levels.isEmpty() ) @@ -1235,6 +1237,8 @@ throw new IllegalQueryException( "Dimension ou is present in query without any valid dimension options" ); } + orgUnits = orgUnits.stream().distinct().collect( Collectors.toList() ); // Remove duplicates + DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.ORGANISATIONUNIT, null, DISPLAY_NAME_ORGUNIT, orgUnits ); return object;
_______________________________________________ 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