Search in sources :

Example 1 with ResultStructure

use of net.opengis.sos.x20.GetResultTemplateResponseType.ResultStructure in project arctic-sea by 52North.

the class SosDecoderv20 method parseGetResultTemplateResponse.

private OwsServiceResponse parseGetResultTemplateResponse(final GetResultTemplateResponseDocument getResultTemplateResponseDoc) throws DecodingException {
    final GetResultTemplateResponse sosGetResultTemplateResponse = new GetResultTemplateResponse();
    final GetResultTemplateResponseType getResultTemplateResponse = getResultTemplateResponseDoc.getGetResultTemplateResponse();
    final SosResultEncoding resultEncoding = parseResultEncoding(getResultTemplateResponse.getResultEncoding().getAbstractEncoding());
    final SosResultStructure resultStructure = parseResultStructure(getResultTemplateResponse.getResultStructure().getAbstractDataComponent());
    sosGetResultTemplateResponse.setResultEncoding(resultEncoding);
    sosGetResultTemplateResponse.setResultStructure(resultStructure);
    return sosGetResultTemplateResponse;
}
Also used : GetResultTemplateResponseType(net.opengis.sos.x20.GetResultTemplateResponseType) GetResultTemplateResponse(org.n52.shetland.ogc.sos.response.GetResultTemplateResponse) SosResultEncoding(org.n52.shetland.ogc.sos.SosResultEncoding) SosResultStructure(org.n52.shetland.ogc.sos.SosResultStructure)

Example 2 with ResultStructure

use of net.opengis.sos.x20.GetResultTemplateResponseType.ResultStructure in project arctic-sea by 52North.

the class GetResultTemplateResponseEncoder method createResultStructure.

private ResultStructure createResultStructure(SosResultStructure resultStructure) throws EncodingException {
    // TODO move encoding to SWECommonEncoder
    final DataRecordDocument dataRecordDoc;
    if (resultStructure.isEncoded()) {
        try {
            dataRecordDoc = DataRecordDocument.Factory.parse(resultStructure.getXml().get());
        } catch (XmlException ex) {
            throw unsupportedResultStructure(ex);
        }
    } else {
        XmlObject xml = encodeSwe(EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT), resultStructure.get().get());
        if (xml instanceof DataRecordDocument) {
            dataRecordDoc = (DataRecordDocument) xml;
        } else {
            throw unsupportedResultStructure();
        }
    }
    ResultStructure xbResultStructure = ResultStructure.Factory.newInstance(getXmlOptions());
    xbResultStructure.addNewAbstractDataComponent().set(dataRecordDoc.getDataRecord());
    XmlHelper.substituteElement(xbResultStructure.getAbstractDataComponent(), dataRecordDoc.getDataRecord());
    return xbResultStructure;
}
Also used : ResultStructure(net.opengis.sos.x20.GetResultTemplateResponseType.ResultStructure) SosResultStructure(org.n52.shetland.ogc.sos.SosResultStructure) XmlException(org.apache.xmlbeans.XmlException) XmlObject(org.apache.xmlbeans.XmlObject) DataRecordDocument(net.opengis.swe.x20.DataRecordDocument)

Aggregations

SosResultStructure (org.n52.shetland.ogc.sos.SosResultStructure)2 GetResultTemplateResponseType (net.opengis.sos.x20.GetResultTemplateResponseType)1 ResultStructure (net.opengis.sos.x20.GetResultTemplateResponseType.ResultStructure)1 DataRecordDocument (net.opengis.swe.x20.DataRecordDocument)1 XmlException (org.apache.xmlbeans.XmlException)1 XmlObject (org.apache.xmlbeans.XmlObject)1 SosResultEncoding (org.n52.shetland.ogc.sos.SosResultEncoding)1 GetResultTemplateResponse (org.n52.shetland.ogc.sos.response.GetResultTemplateResponse)1