Search in sources :

Example 56 with FilterFactoryImpl

use of org.geotools.filter.FilterFactoryImpl in project ddf by codice.

the class CswQueryFilterTransformer method transform.

@Override
public QueryRequest transform(QueryRequest queryRequest, Map<String, Serializable> properties) {
    Query query = queryRequest.getQuery();
    Filter filter = (Filter) query.accept(filterVisitor, new FilterFactoryImpl());
    Query transformedQuery = new QueryImpl(filter, query.getStartIndex(), query.getPageSize(), query.getSortBy(), query.requestsTotalResultsCount(), query.getTimeoutMillis());
    return new QueryRequestImpl(transformedQuery, queryRequest.isEnterprise(), queryRequest.getSourceIds(), queryRequest.getProperties());
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) Query(ddf.catalog.operation.Query) Filter(org.opengis.filter.Filter) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) FilterFactoryImpl(org.geotools.filter.FilterFactoryImpl)

Example 57 with FilterFactoryImpl

use of org.geotools.filter.FilterFactoryImpl in project ddf by codice.

the class SourceIdFilterVisitorTest method testSourceIdsAreRemovedFromFilter.

@Test
public void testSourceIdsAreRemovedFromFilter() {
    Filter filter = buildFilter(SOURCE_IDS);
    Filter result = (Filter) filter.accept(sourceIdFilter, new FilterFactoryImpl());
    SourceIdFilterVisitor visitor = new SourceIdFilterVisitor();
    result.accept(visitor, new FilterFactoryImpl());
    assertThat(visitor.getSourceIds(), equalTo(Collections.emptyList()));
}
Also used : Filter(org.opengis.filter.Filter) FilterFactoryImpl(org.geotools.filter.FilterFactoryImpl) SourceIdFilterVisitor(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.SourceIdFilterVisitor) Test(org.junit.Test)

Example 58 with FilterFactoryImpl

use of org.geotools.filter.FilterFactoryImpl in project ddf by codice.

the class SourceIdFilterVisitorTest method testFilterWithoutSourceIdsIsUnchanged.

@Test
public void testFilterWithoutSourceIdsIsUnchanged() {
    Filter result = (Filter) filterWithoutSourceIds.accept(sourceIdFilter, new FilterFactoryImpl());
    assertThat(result, equalTo(filterWithoutSourceIds));
    assertThat(sourceIdFilter.getSourceIds(), equalTo(Collections.emptyList()));
}
Also used : Filter(org.opengis.filter.Filter) FilterFactoryImpl(org.geotools.filter.FilterFactoryImpl) Test(org.junit.Test)

Aggregations

FilterFactoryImpl (org.geotools.filter.FilterFactoryImpl)58 Test (org.junit.Test)50 FilterFactory (org.opengis.filter.FilterFactory)42 Filter (org.opengis.filter.Filter)39 QueryImpl (ddf.catalog.operation.impl.QueryImpl)35 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)33 SourceResponse (ddf.catalog.operation.SourceResponse)21 Metacard (ddf.catalog.data.Metacard)18 SolrProviderTest (ddf.catalog.source.solr.SolrProviderTest)17 Date (java.util.Date)12 ArrayList (java.util.ArrayList)11 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)9 QueryResponse (ddf.catalog.operation.QueryResponse)9 Result (ddf.catalog.data.Result)8 CreateResponse (ddf.catalog.operation.CreateResponse)8 QueryRequest (ddf.catalog.operation.QueryRequest)8 CreateRequestImpl (ddf.catalog.operation.impl.CreateRequestImpl)8 Calendar (java.util.Calendar)6 DateTime (org.joda.time.DateTime)6 Ignore (org.junit.Ignore)6