Search in sources :

Example 1 with SourceIdFilterVisitor

use of org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.SourceIdFilterVisitor in project ddf by codice.

the class CswQueryFactory method getQueryRequest.

private QueryRequest getQueryRequest(Query query, boolean isEnterprise, Map<String, Serializable> properties) {
    QueryRequest request;
    SourceIdFilterVisitor sourceIdFilterVisitor = new SourceIdFilterVisitor();
    query.accept(sourceIdFilterVisitor, new FilterFactoryImpl());
    if (isEnterprise && CollectionUtils.isEmpty(sourceIdFilterVisitor.getSourceIds())) {
        request = new QueryRequestImpl(query, true, null, properties);
    } else if (isEnterprise && CollectionUtils.isNotEmpty(sourceIdFilterVisitor.getSourceIds())) {
        request = new QueryRequestImpl(query, false, sourceIdFilterVisitor.getSourceIds(), properties);
    } else {
        request = new QueryRequestImpl(query, false, null, properties);
    }
    return request;
}
Also used : QueryRequest(ddf.catalog.operation.QueryRequest) QueryRequestImpl(ddf.catalog.operation.impl.QueryRequestImpl) FilterFactoryImpl(org.geotools.filter.FilterFactoryImpl) SourceIdFilterVisitor(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.SourceIdFilterVisitor)

Example 2 with SourceIdFilterVisitor

use of org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.SourceIdFilterVisitor 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 3 with SourceIdFilterVisitor

use of org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.SourceIdFilterVisitor in project ddf by codice.

the class SourceIdFilterVisitorTest method setUp.

@Before
public void setUp() {
    sourceIdFilter = new SourceIdFilterVisitor();
    filterBuilder = new GeotoolsFilterBuilder();
    filterWithoutSourceIds = buildFilter(Collections.emptyList());
}
Also used : GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) SourceIdFilterVisitor(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.SourceIdFilterVisitor) Before(org.junit.Before)

Aggregations

SourceIdFilterVisitor (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.SourceIdFilterVisitor)3 FilterFactoryImpl (org.geotools.filter.FilterFactoryImpl)2 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)1 QueryRequest (ddf.catalog.operation.QueryRequest)1 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Filter (org.opengis.filter.Filter)1