use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class SimpleBinding method getServiceOperator.
protected ServiceOperator getServiceOperator(OwsServiceRequest request) throws OwsExceptionReport {
checkServiceOperatorKeyTypes(request);
String service = request.getService();
String version = request.getVersion();
if (request instanceof GetCapabilitiesRequest) {
GetCapabilitiesRequest gcr = (GetCapabilitiesRequest) request;
if (gcr.isSetAcceptVersions()) {
return gcr.getAcceptVersions().stream().map(v -> new OwsServiceKey(service, v)).map(this::getServiceOperator).filter(Objects::nonNull).findFirst().orElseThrow(() -> new InvalidServiceOrVersionException(service, version));
} else {
Set<String> supportedVersions = serviceOperatorRepository.getSupportedVersions(service);
String newest = supportedVersions.stream().max(Comparables.version()).orElseThrow(() -> new InvalidServiceParameterException(service));
return getServiceOperator(new OwsServiceKey(service, newest));
}
} else {
return getServiceOperator(new OwsServiceKey(service, version));
}
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class AbstractOperationHandler method getRequestMethodsForServiceURL.
private Stream<OwsRequestMethod> getRequestMethodsForServiceURL(OwsOperationKey operation) {
Map<String, Set<OwsValue>> mediaTypesByMethod = new HashMap<>(HTTPMethods.METHODS.size());
this.bindingRepository.getBindings().values().stream().forEach(binding -> HTTPMethods.METHODS.stream().filter(isMethodSupported(binding, operation)).forEach(method -> mediaTypesByMethod.computeIfAbsent(method, Functions.forSupplier(HashSet::new)).addAll(getMediaTypes(binding))));
return mediaTypesByMethod.entrySet().stream().map(e -> new OwsRequestMethod(this.serviceURL, e.getKey(), createContentTypeDomains(e.getValue())));
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class ODataFesParserTest method testFeatureOfInterestGeoIntersectsPolygon.
@Test
public void testFeatureOfInterestGeoIntersectsPolygon() throws Exception {
Filter<?> filter = parser.decode(String.format("geo.intersects(featureOfInterest,'SRID=%s;%s')", polygon.getSRID(), wktGeometry));
assertThat(filter, is(instanceOf(SpatialFilter.class)));
SpatialFilter sf = (SpatialFilter) filter;
errors.checkThat(sf.getSrid(), is(4326));
errors.checkThat(sf.getGeometry().isEnvelope(), is(false));
errors.checkThat(sf.getGeometry().isGeometry(), is(true));
errors.checkThat(sf.getGeometry().getGeometry().get(), is(instanceOf(Polygon.class)));
errors.checkThat(sf.getValueReference(), is("om:featureOfInterest/*/sams:shape"));
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class ODataFesParserTest method testEndswith.
@Test
public void testEndswith() throws DecodingException {
Filter<?> filter = parser.decode("endswith(textValue,'asdf')");
assertThat(filter, is(instanceOf(ComparisonFilter.class)));
ComparisonFilter cf = (ComparisonFilter) filter;
errors.checkThat(cf.getOperator(), is(ComparisonOperator.PropertyIsLike));
errors.checkThat(cf.getValue(), is("%asdf"));
errors.checkThat(cf.getValueReference(), is("om:result"));
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class ODataFesParserTest method testStartswith.
@Test
public void testStartswith() throws DecodingException {
Filter<?> filter = parser.decode("startswith(textValue,'asdf')");
assertThat(filter, is(instanceOf(ComparisonFilter.class)));
ComparisonFilter cf = (ComparisonFilter) filter;
errors.checkThat(cf.getOperator(), is(ComparisonOperator.PropertyIsLike));
errors.checkThat(cf.getValue(), is("asdf%"));
errors.checkThat(cf.getValueReference(), is("om:result"));
}
Aggregations