Search in sources :

Example 1 with InsertResultTemplateType

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

the class SosDecoderv20 method parseInsertResultTemplate.

private OwsServiceRequest parseInsertResultTemplate(final InsertResultTemplateDocument insertResultTemplateDoc) throws DecodingException {
    InsertResultTemplateRequest sosInsertResultTemplate = new InsertResultTemplateRequest();
    InsertResultTemplateType insertResultTemplate = insertResultTemplateDoc.getInsertResultTemplate();
    sosInsertResultTemplate.setService(insertResultTemplate.getService());
    sosInsertResultTemplate.setVersion(insertResultTemplate.getVersion());
    ResultTemplateType resultTemplate = insertResultTemplate.getProposedTemplate().getResultTemplate();
    sosInsertResultTemplate.setIdentifier(resultTemplate.getIdentifier());
    OmObservationConstellation sosObservationConstellation = parseObservationTemplate(resultTemplate.getObservationTemplate());
    sosObservationConstellation.addOffering(resultTemplate.getOffering());
    sosInsertResultTemplate.setObservationTemplate(sosObservationConstellation);
    try {
        sosInsertResultTemplate.setResultStructure(parseResultStructure(XmlObject.Factory.parse(resultTemplate.getResultStructure().xmlText())));
        sosInsertResultTemplate.setResultEncoding(parseResultEncoding(XmlObject.Factory.parse(resultTemplate.getResultEncoding().xmlText())));
    } catch (XmlException e) {
        throw new DecodingException(e, "Error while parsing InsertResultTemplate request!");
    }
    sosInsertResultTemplate.setExtensions(parseExtensibleRequest(insertResultTemplate));
    return sosInsertResultTemplate;
}
Also used : InsertResultTemplateType(net.opengis.sos.x20.InsertResultTemplateType) XmlException(org.apache.xmlbeans.XmlException) DecodingException(org.n52.svalbard.decode.exception.DecodingException) OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) ResultTemplateType(net.opengis.sos.x20.ResultTemplateType) GetResultTemplateType(net.opengis.sos.x20.GetResultTemplateType) InsertResultTemplateType(net.opengis.sos.x20.InsertResultTemplateType) InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest)

Example 2 with InsertResultTemplateType

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

the class InsertResultTemplateRequestEncoder method create.

@Override
protected XmlObject create(InsertResultTemplateRequest request) throws EncodingException {
    validateInput(request);
    InsertResultTemplateDocument doc = InsertResultTemplateDocument.Factory.newInstance(getXmlOptions());
    InsertResultTemplateType insertResultTemplate = doc.addNewInsertResultTemplate();
    insertResultTemplate.setService(request.getService());
    insertResultTemplate.setVersion(request.getVersion());
    // reduced element hierarchy and switched to sos:ResultTemplate level
    ResultTemplateType resultTemplate = insertResultTemplate.addNewProposedTemplate().addNewResultTemplate();
    addIdentifier(resultTemplate, request);
    addOffering(resultTemplate, request);
    addObservationTemplate(resultTemplate, request);
    addResultStructure(resultTemplate, request.getResultStructure().get().get());
    addResultEncoding(resultTemplate, request.getResultEncoding().get().get());
    return doc;
}
Also used : InsertResultTemplateType(net.opengis.sos.x20.InsertResultTemplateType) ResultTemplateType(net.opengis.sos.x20.ResultTemplateType) InsertResultTemplateType(net.opengis.sos.x20.InsertResultTemplateType) InsertResultTemplateDocument(net.opengis.sos.x20.InsertResultTemplateDocument)

Example 3 with InsertResultTemplateType

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

the class InsertResultTemplateRequestEncoderTest method shouldSetRequestDefaults.

@Test
public void shouldSetRequestDefaults() throws EncodingException {
    InsertResultTemplateType encodedRequest = ((InsertResultTemplateDocument) encoder.create(request)).getInsertResultTemplate();
    Assert.assertThat(encodedRequest.getService(), Is.is(SosConstants.SOS));
    Assert.assertThat(encodedRequest.getVersion(), Is.is(Sos2Constants.SERVICEVERSION));
}
Also used : InsertResultTemplateType(net.opengis.sos.x20.InsertResultTemplateType) InsertResultTemplateDocument(net.opengis.sos.x20.InsertResultTemplateDocument) Test(org.junit.Test)

Aggregations

InsertResultTemplateType (net.opengis.sos.x20.InsertResultTemplateType)3 InsertResultTemplateDocument (net.opengis.sos.x20.InsertResultTemplateDocument)2 ResultTemplateType (net.opengis.sos.x20.ResultTemplateType)2 GetResultTemplateType (net.opengis.sos.x20.GetResultTemplateType)1 XmlException (org.apache.xmlbeans.XmlException)1 Test (org.junit.Test)1 OmObservationConstellation (org.n52.shetland.ogc.om.OmObservationConstellation)1 InsertResultTemplateRequest (org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest)1 DecodingException (org.n52.svalbard.decode.exception.DecodingException)1