use of net.opengis.sos.x20.GetObservationResponseDocument in project arctic-sea by 52North.
the class GetObservationResponseDocumentDecoder method decode.
@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public GetObservationResponse decode(GetObservationResponseDocument gord) throws DecodingException {
if (gord != null) {
GetObservationResponse response = new GetObservationResponse();
setService(response);
setVersions(response);
GetObservationResponseType gort = gord.getGetObservationResponse();
response.setExtensions(parseExtensibleResponse(gort));
response.setObservationCollection(ObservationStream.of(parseObservtions(gort)));
return response;
}
throw new UnsupportedDecoderInputException(this, gord);
}
use of net.opengis.sos.x20.GetObservationResponseDocument in project arctic-sea by 52North.
the class GetObservationResponseEncoder method createResponse.
@Override
protected XmlObject createResponse(ObservationEncoder<XmlObject, OmObservation> encoder, GetObservationResponse response) throws EncodingException {
try {
GetObservationResponseDocument doc = GetObservationResponseDocument.Factory.newInstance(getXmlOptions());
GetObservationResponseType xbResponse = doc.addNewGetObservationResponse();
ObservationStream observationCollection = response.getObservationCollection();
while (observationCollection.hasNext()) {
xbResponse.addNewObservationData().addNewOMObservation().set(encoder.encode(observationCollection.next()));
}
// in a single observation the gml:ids must be unique
XmlHelper.makeGmlIdsUnique(doc.getDomNode());
return doc;
} catch (OwsExceptionReport ex) {
throw new EncodingException(ex);
}
}
Aggregations