use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class GetCapabilitiesResponseEncoder method createInsertionCapabilities.
private XmlObject createInsertionCapabilities(SosInsertionCapabilities caps) {
InsertionCapabilitiesDocument doc = InsertionCapabilitiesDocument.Factory.newInstance(getXmlOptions());
InsertionCapabilitiesType xbCaps = doc.addNewInsertionCapabilities();
caps.getFeatureOfInterestTypes().stream().filter(foiType -> !foiType.equals(SosConstants.NOT_DEFINED)).forEachOrdered(foiType -> xbCaps.addFeatureOfInterestType(foiType));
caps.getObservationTypes().stream().filter(oType -> !oType.equals(SosConstants.NOT_DEFINED)).forEachOrdered(oType -> xbCaps.addObservationType(oType));
caps.getProcedureDescriptionFormats().stream().filter(pdf -> !pdf.equals(SosConstants.NOT_DEFINED)).forEachOrdered(pdf -> xbCaps.addProcedureDescriptionFormat(pdf));
caps.getSupportedEncodings().stream().filter(se -> !se.equals(SosConstants.NOT_DEFINED)).forEachOrdered(se -> xbCaps.addSupportedEncoding(se));
return doc;
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class FesEncoderv20 method setTemporalFilterCapabilities.
/**
* Sets the TemporalFilterCapabilities.
*
* @param temporalCapabilitiesType FES TemporalCapabilities.
* @param sosFilterCaps SOS temporal filter information
*
* @throws org.n52.svalbard.encode.exception.EncodingException if one of the temporal operators is not supported
*/
private void setTemporalFilterCapabilities(TemporalCapabilitiesType temporalCapabilitiesType, org.n52.shetland.ogc.filter.FilterCapabilities sosFilterCaps) throws EncodingException {
// set TemporalOperands
if (sosFilterCaps.getTemporalOperands() != null && !sosFilterCaps.getTemporalOperands().isEmpty()) {
TemporalOperandsType tempOperands = temporalCapabilitiesType.addNewTemporalOperands();
sosFilterCaps.getTemporalOperands().forEach(operand -> tempOperands.addNewTemporalOperand().setName(operand));
}
// set TemporalOperators
if (sosFilterCaps.getTemporalOperators() != null && !sosFilterCaps.getTemporalOperators().isEmpty()) {
TemporalOperatorsType temporalOps = temporalCapabilitiesType.addNewTemporalOperators();
Set<TimeOperator> keys = sosFilterCaps.getTemporalOperators().keySet();
for (TimeOperator temporalOperator : keys) {
TemporalOperatorType operator = temporalOps.addNewTemporalOperator();
operator.setName(getEnum4TemporalOperator(temporalOperator));
TemporalOperandsType bboxGeomOps = operator.addNewTemporalOperands();
sosFilterCaps.getTemporalOperators().get(temporalOperator).forEach(operand -> bboxGeomOps.addNewTemporalOperand().setName(operand));
}
}
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class FesEncoderv20 method setConformance.
/**
* Sets the FES conformance classes in the filter capabilities section.
*
* @param conformance XML FES conformence
* @param sosConformance Service conformance
*
* @throws EncodingException If an error occurs
*/
private void setConformance(final ConformanceType conformance, Collection<OwsDomain> sosConformance) throws EncodingException {
for (OwsDomain owsDomainType : sosConformance) {
XmlObject encodeObjectToXml = encodeObjectToXml(OWSConstants.NS_OWS, owsDomainType);
conformance.addNewConstraint().set(encodeObjectToXml);
}
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class FesEncoderv20Test method should_return_BBoxType_for_spatialFilter.
// @Test
// deactivated until test fails on build server.
public final void should_return_BBoxType_for_spatialFilter() throws EncodingException {
final SpatialFilter filter = new SpatialFilter();
filter.setOperator(SpatialOperator.BBOX);
filter.setGeometry(new GeometryFactory().toGeometry(new Envelope(1, 2, 3, 4)));
filter.setValueReference("valueReference");
final XmlObject encode = fesEncoder.encode(filter);
assertThat(encode, is(instanceOf(BBOXType.class)));
final BBOXType xbBBox = (BBOXType) encode;
assertThat(xbBBox.isSetExpression(), is(TRUE));
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class JSONDecoder method decodeJsonToObjectList.
protected <T> List<T> decodeJsonToObjectList(JsonNode node, Class<T> type) throws DecodingException {
Decoder<T, JsonNode> decoder = getDecoder(type);
if (node.isArray()) {
CompositeException exceptions = new CompositeException();
List<T> list = Streams.stream(node).filter(JsonNode::isObject).map(exceptions.wrapFunction(decoder::decode)).filter(Optional::isPresent).map(Optional::get).collect(toList());
exceptions.throwIfNotEmpty(DecodingException::new);
return list;
} else if (node.isObject()) {
return Collections.singletonList(decoder.decode(node));
} else {
return Collections.emptyList();
}
}
Aggregations