Search in sources :

Example 1 with InsertResultDocument

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

the class InsertResultRequestEncoder method create.

@Override
protected XmlObject create(InsertResultRequest request) throws EncodingException {
    validateInput(request);
    InsertResultDocument doc = InsertResultDocument.Factory.newInstance(getXmlOptions());
    InsertResultType insertResult = doc.addNewInsertResult();
    insertResult.setService(request.getService());
    insertResult.setVersion(request.getVersion());
    insertResult.setTemplate(request.getTemplateIdentifier());
    addResultValues(request, insertResult);
    return doc;
}
Also used : InsertResultType(net.opengis.sos.x20.InsertResultType) InsertResultDocument(net.opengis.sos.x20.InsertResultDocument)

Example 2 with InsertResultDocument

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

the class InsertResultRequestEncoderTest method shouldEncodeInsertResultRequest.

@Test
public void shouldEncodeInsertResultRequest() throws EncodingException {
    String version = Sos2Constants.SERVICEVERSION;
    String service = SosConstants.SOS;
    String templateIdentifier = "test-template-identifier";
    String resultValues = "test-result-values";
    InsertResultRequest request = new InsertResultRequest(service, version);
    request.setTemplateIdentifier(templateIdentifier);
    request.setResultValues(resultValues);
    XmlObject encodedRequest = encoder.create(request);
    Assert.assertThat(encodedRequest, Matchers.instanceOf(InsertResultDocument.class));
    Assert.assertThat(((InsertResultDocument) encodedRequest).getInsertResult(), Matchers.notNullValue());
    InsertResultType xbRequest = ((InsertResultDocument) encodedRequest).getInsertResult();
    Assert.assertThat(xbRequest.getService(), Is.is(service));
    Assert.assertThat(xbRequest.getVersion(), Is.is(version));
    Assert.assertThat(xbRequest.getTemplate(), Is.is(templateIdentifier));
    Assert.assertThat(xbRequest.getResultValues(), Matchers.instanceOf(XmlString.class));
    Assert.assertThat(((XmlString) xbRequest.getResultValues()).getStringValue(), Is.is(resultValues));
}
Also used : InsertResultRequest(org.n52.shetland.ogc.sos.request.InsertResultRequest) XmlString(org.apache.xmlbeans.XmlString) XmlObject(org.apache.xmlbeans.XmlObject) XmlString(org.apache.xmlbeans.XmlString) InsertResultType(net.opengis.sos.x20.InsertResultType) InsertResultDocument(net.opengis.sos.x20.InsertResultDocument) Test(org.junit.Test)

Example 3 with InsertResultDocument

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

the class SosDecoderv20 method parseInsertResult.

private OwsServiceRequest parseInsertResult(final InsertResultDocument insertResultDoc) throws DecodingException {
    final InsertResultType insertResult = insertResultDoc.getInsertResult();
    final InsertResultRequest sosInsertResultRequest = new InsertResultRequest();
    sosInsertResultRequest.setService(insertResult.getService());
    sosInsertResultRequest.setVersion(insertResult.getVersion());
    sosInsertResultRequest.setTemplateIdentifier(insertResult.getTemplate());
    sosInsertResultRequest.setResultValues(parseResultValues(insertResult.getResultValues()));
    sosInsertResultRequest.setExtensions(parseExtensibleRequest(insertResult));
    return sosInsertResultRequest;
}
Also used : InsertResultRequest(org.n52.shetland.ogc.sos.request.InsertResultRequest) InsertResultType(net.opengis.sos.x20.InsertResultType)

Aggregations

InsertResultType (net.opengis.sos.x20.InsertResultType)3 InsertResultDocument (net.opengis.sos.x20.InsertResultDocument)2 InsertResultRequest (org.n52.shetland.ogc.sos.request.InsertResultRequest)2 XmlObject (org.apache.xmlbeans.XmlObject)1 XmlString (org.apache.xmlbeans.XmlString)1 Test (org.junit.Test)1