use of net.opengis.sos.x20.InsertResultTemplateResponseDocument in project arctic-sea by 52North.
the class InsertResultTemplateResponseDecoder method decode.
@Override
public InsertResultTemplateResponse decode(XmlObject xmlObject) throws DecodingException {
LOGGER.debug("REQUESTTYPE: {}", xmlObject != null ? xmlObject.getClass() : "null recevied");
if (!(xmlObject instanceof InsertResultTemplateResponseDocument)) {
throw new UnsupportedDecoderInputException(this, xmlObject);
}
InsertResultTemplateResponseDocument isrd = (InsertResultTemplateResponseDocument) xmlObject;
InsertResultTemplateResponseType isr = isrd.getInsertResultTemplateResponse();
if (isr == null) {
throw new DecodingException("Received XML document is not valid. Set log level to debug to get more details");
}
InsertResultTemplateResponse decodedResponse = new InsertResultTemplateResponse(SosConstants.SOS, Sos2Constants.SERVICEVERSION);
decodedResponse.setAcceptedTemplate(isr.getAcceptedTemplate());
return decodedResponse;
}
use of net.opengis.sos.x20.InsertResultTemplateResponseDocument in project arctic-sea by 52North.
the class InsertResultTemplateResponseEncoder method create.
@Override
protected XmlObject create(InsertResultTemplateResponse response) throws EncodingException {
InsertResultTemplateResponseDocument doc = InsertResultTemplateResponseDocument.Factory.newInstance(getXmlOptions());
InsertResultTemplateResponseType irtr = doc.addNewInsertResultTemplateResponse();
irtr.setAcceptedTemplate(response.getAcceptedTemplate());
return doc;
}
use of net.opengis.sos.x20.InsertResultTemplateResponseDocument in project arctic-sea by 52North.
the class InsertResultTemplateResponseDecoderTest method shouldCreateInsertSensorResponse.
@Test
public void shouldCreateInsertSensorResponse() throws DecodingException {
String templateId = "test-template-id";
InsertResultTemplateResponseDocument isrd = InsertResultTemplateResponseDocument.Factory.newInstance();
isrd.addNewInsertResultTemplateResponse().setAcceptedTemplate(templateId);
InsertResultTemplateResponse decodedResponse = new InsertResultTemplateResponseDecoder().decode(isrd);
assertThat(decodedResponse.getAcceptedTemplate(), is(templateId));
}
Aggregations