EventQueryParams extends DataQueryParams { public List<QueryItem> getDuplicateQueryItems() { Set<QueryItem> dims = new HashSet<>(); List<QueryItem> duplicates = new ArrayList<>(); for ( QueryItem dim : items ) { if ( !dims.add( dim ) ) { duplicates.add( dim ); } } return duplicates; } private  EventQueryParams(); static EventQueryParams fromDataQueryParams( DataQueryParams dataQueryParams ); @Override String getKey(); List<QueryItem> getDuplicateQueryItems(); List<QueryItem> getItemsAndItemFilters(); Set<DimensionalItemObject> getDimensionalObjectItems(); Set<Legend> getItemLegends(); Set<Option> getItemOptions(); boolean timeFieldIsValid(); boolean orgUnitFieldIsValid(); ProgramStatus getProgramStatus(); EventQueryParams removeProgramIndicatorItems(); AnalyticsAggregationType getAggregationTypeFallback(); @Override boolean isAggregationType( AggregationType type ); boolean isOrganisationUnitMode( OrganisationUnitSelectionMode mode ); boolean hasItemsOrItemFilters(); boolean isLastPeriodAggregationType(); boolean isFirstPeriodAggregationType(); boolean isFirstOrLastPeriodAggregationType(); boolean hasNonDefaultBoundaries(); boolean hasAnalyticsVariables(); boolean useIndividualQuery(); Set<OrganisationUnit> getOrganisationUnitChildren(); boolean isSorting(); boolean isPaging(); int getPageWithDefault(); int getPageSizeWithDefault(); int getOffset(); boolean hasSortOrder(); boolean hasLimit(); boolean hasEventStatus(); boolean hasValueDimension(); @Override boolean hasProgramIndicatorDimension(); boolean hasEventProgramIndicatorDimension(); boolean hasEnrollmentProgramIndicatorDimension(); boolean hasSinglePeriod(); boolean hasFilterPeriods(); boolean isProgramRegistration(); boolean hasClusterSize(); boolean hasProgramStatus(); boolean hasBbox(); boolean hasDataIdScheme(); int getSortOrderAsInt(); @Override String toString(); List<QueryItem> getItems(); List<QueryItem> getItemFilters(); DimensionalItemObject getValue(); List<ProgramIndicator> getItemProgramIndicators(); ProgramIndicator getProgramIndicator(); List<DimensionalItemObject> getAsc(); @Override List<DimensionalObject> getDimensions(); List<DimensionalItemObject> getDesc(); OrganisationUnitSelectionMode getOrganisationUnitMode(); Integer getPage(); Integer getPageSize(); SortOrder getSortOrder(); Integer getLimit(); EventOutputType getOutputType(); EventStatus getEventStatus(); boolean isCollapseDataDimensions(); boolean isCoordinatesOnly(); boolean isGeometryOnly(); boolean isAggregateData(); Long getClusterSize(); String getCoordinateField(); String getBbox(); boolean isIncludeClusterPoints(); @Override boolean isIncludeMetadataDetails(); IdScheme getDataIdScheme(); static final String EVENT_COORDINATE_FIELD; static final String ENROLLMENT_COORDINATE_FIELD; }
@Test public void testGetDuplicateQueryItems() { QueryItem iA = new QueryItem( createDataElement( 'A', new CategoryCombo() ) ); QueryItem iB = new QueryItem( createDataElement( 'B', new CategoryCombo() ) ); QueryItem iC = new QueryItem( createDataElement( 'B', new CategoryCombo() ) ); QueryItem iD = new QueryItem( createDataElement( 'D', new CategoryCombo() ) ); EventQueryParams params = new EventQueryParams.Builder() .addItem( iA ) .addItem( iB ) .addItem( iC ) .addItem( iD ).build(); List<QueryItem> duplicates = params.getDuplicateQueryItems(); assertEquals( 1, duplicates.size() ); assertTrue( duplicates.contains( iC ) ); }