Search in sources :

Example 1 with GetObservationResponseDocument

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);
}
Also used : GetObservationResponseType(net.opengis.sos.x20.GetObservationResponseType) GetObservationResponse(org.n52.shetland.ogc.sos.response.GetObservationResponse) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 2 with GetObservationResponseDocument

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);
    }
}
Also used : ObservationStream(org.n52.shetland.ogc.om.ObservationStream) EncodingException(org.n52.svalbard.encode.exception.EncodingException) GetObservationResponseType(net.opengis.sos.x20.GetObservationResponseType) GetObservationResponseDocument(net.opengis.sos.x20.GetObservationResponseDocument) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport)

Aggregations

GetObservationResponseType (net.opengis.sos.x20.GetObservationResponseType)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 GetObservationResponseDocument (net.opengis.sos.x20.GetObservationResponseDocument)1 ObservationStream (org.n52.shetland.ogc.om.ObservationStream)1 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)1 GetObservationResponse (org.n52.shetland.ogc.sos.response.GetObservationResponse)1 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)1 EncodingException (org.n52.svalbard.encode.exception.EncodingException)1