EventQueryParams extends DataQueryParams { @Override public String getKey() { QueryKey key = new QueryKey() .add( super.getKey() ); items.forEach( e -> key.add( "item", "[" + e.getKey() + "]" ) ); itemFilters.forEach( e -> key.add( "itemFilter", "[" + e.getKey() + "]" ) ); itemProgramIndicators.forEach( e -> key.add( "itemProgramIndicator", e.getUid() ) ); asc.forEach( e -> e.getUid() ); desc.forEach( e -> e.getUid() ); return key .addIgnoreNull( "value", value, () -> value.getUid() ) .addIgnoreNull( "programIndicator", programIndicator, () -> programIndicator.getUid() ) .addIgnoreNull( "organisationUnitMode", organisationUnitMode ) .addIgnoreNull( "page", page ) .addIgnoreNull( "pageSize", pageSize ) .addIgnoreNull( "sortOrder", sortOrder ) .addIgnoreNull( "limit", limit ) .addIgnoreNull( "outputType", outputType ) .addIgnoreNull( "eventStatus", eventStatus ) .addIgnoreNull( "collapseDataDimensions", collapseDataDimensions ) .addIgnoreNull( "coordinatesOnly", coordinatesOnly ) .addIgnoreNull( "geometryOnly", geometryOnly ) .addIgnoreNull( "aggregateData", aggregateData ) .addIgnoreNull( "clusterSize", clusterSize ) .addIgnoreNull( "coordinateField", coordinateField ) .addIgnoreNull( "bbox", bbox ) .addIgnoreNull( "includeClusterPoints", includeClusterPoints ) .addIgnoreNull( "programStatus", programStatus ) .addIgnoreNull( "includeMetadataDetails", includeMetadataDetails ) .addIgnoreNull( "dataIdScheme", dataIdScheme ) .build(); } 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 testGetKey() { QueryItem qiA = new QueryItem( deA, null, deA.getValueType(), deA.getAggregationType(), osA ); QueryItem qiB = new QueryItem( deB, null, deB.getValueType(), deB.getAggregationType(), osB ); EventQueryParams paramsA = new EventQueryParams.Builder() .addDimension( new BaseDimensionalObject( PERIOD_DIM_ID, DimensionType.PERIOD, Lists.newArrayList( peA, peB, peC ) ) ) .addDimension( new BaseDimensionalObject( ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, Lists.newArrayList( ouA, ouB ) ) ) .addItem( qiA ) .addItem( qiB ) .build(); EventQueryParams paramsB = new EventQueryParams.Builder() .addDimension( new BaseDimensionalObject( PERIOD_DIM_ID, DimensionType.PERIOD, Lists.newArrayList( peA, peB ) ) ) .addDimension( new BaseDimensionalObject( ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, Lists.newArrayList( ouA ) ) ) .addItem( qiA ) .addItem( qiB ) .withGeometryOnly( true ) .build(); assertNotNull( paramsA.getKey() ); assertEquals( 40, paramsA.getKey().length() ); assertNotNull( paramsB.getKey() ); assertEquals( 40, paramsB.getKey().length() ); assertNotEquals( paramsA.getKey(), paramsB.getKey() ); }