use of net.opengis.swes.x20.InsertSensorResponseDocument in project arctic-sea by 52North.
the class InsertSensorResponseDecoder method decode.
@Override
public InsertSensorResponse decode(XmlObject xmlObject) throws DecodingException {
LOGGER.debug("REQUESTTYPE: {}", xmlObject != null ? xmlObject.getClass() : "null recevied");
if (!(xmlObject instanceof InsertSensorResponseDocument)) {
throw new UnsupportedDecoderInputException(this, xmlObject);
}
InsertSensorResponseDocument isrd = (InsertSensorResponseDocument) xmlObject;
InsertSensorResponseType isr = isrd.getInsertSensorResponse();
if (isr == null) {
throw new DecodingException("Received XML document is not valid. Set log level to debug to get more details");
}
InsertSensorResponse decodedResponse = new InsertSensorResponse(SosConstants.SOS, Sos2Constants.SERVICEVERSION);
decodedResponse.setAssignedOffering(isr.getAssignedOffering());
decodedResponse.setAssignedProcedure(isr.getAssignedProcedure());
return decodedResponse;
}
use of net.opengis.swes.x20.InsertSensorResponseDocument in project arctic-sea by 52North.
the class InsertSensorResponseDecoderTest method shouldCreateInsertSensorResponse.
@Test
public void shouldCreateInsertSensorResponse() throws DecodingException {
String offering = "test-offering";
String procedure = "test-procedure";
InsertSensorResponseDocument isrd = InsertSensorResponseDocument.Factory.newInstance();
InsertSensorResponseType response = isrd.addNewInsertSensorResponse();
response.setAssignedOffering(offering);
response.setAssignedProcedure(procedure);
InsertSensorResponse decodedResponse = new InsertSensorResponseDecoder().decode(isrd);
assertThat(decodedResponse.getAssignedOffering(), is(offering));
assertThat(decodedResponse.getAssignedProcedure(), is(procedure));
}
use of net.opengis.swes.x20.InsertSensorResponseDocument in project arctic-sea by 52North.
the class InsertSensorResponseEncoder method create.
@Override
protected XmlObject create(InsertSensorResponse response) throws EncodingException {
InsertSensorResponseDocument document = InsertSensorResponseDocument.Factory.newInstance(getXmlOptions());
InsertSensorResponseType isr = document.addNewInsertSensorResponse();
isr.setAssignedProcedure(response.getAssignedProcedure());
isr.setAssignedOffering(response.getAssignedOffering());
return document;
}
Aggregations