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;
}
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));
}
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;
}
Aggregations