AbstractJdbcEventAnalyticsManager { protected abstract String getWhereClause( EventQueryParams params ); AbstractJdbcEventAnalyticsManager( @Qualifier( "readOnlyJdbcTemplate" ) JdbcTemplate jdbcTemplate,
        StatementBuilder statementBuilder, ProgramIndicatorService programIndicatorService,
        ProgramIndicatorSubqueryBuilder programIndicatorSubqueryBuilder ); Grid getAggregatedEventData( EventQueryParams params, Grid grid, int maxLimit );  }
@Test public void verifyGetWhereClauseWithAttributeOrgUnitTypeAndCoordinatesReturnsFetchesCoordinatesFromOrgUnite() { DataElement deA = createDataElement( 'A', ValueType.ORGANISATION_UNIT, AggregationType.NONE ); DimensionalObject periods = new BaseDimensionalObject( DimensionalObject.PERIOD_DIM_ID, DimensionType.PERIOD, Lists.newArrayList( MonthlyPeriodType.getPeriodFromIsoString( "201701" ) ) ); DimensionalObject orgUnits = new BaseDimensionalObject( DimensionalObject.ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, "ouA", Lists.newArrayList( createOrganisationUnit( 'A' ) ) ); QueryItem qiA = new QueryItem( deA, null, deA.getValueType(), deA.getAggregationType(), null ); EventQueryParams params = new EventQueryParams.Builder() .addDimension( periods ) .addDimension( orgUnits ) .addItem( qiA ) .withCoordinateField( deA.getUid() ) .withSkipData( true ) .withSkipMeta( false ) .withStartDate(new Date() ) .withEndDate( new Date() ) .withCoordinatesOnly( true ) .build(); final String whereClause = this.subject.getWhereClause( params ); assertThat( whereClause, containsString( "and ax.\"" + deA.getUid() + "_geom" + "\" is not null" ) ); }