Search in sources :

Example 1 with InsertSensorResponseDocument

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;
}
Also used : InsertSensorResponseType(net.opengis.swes.x20.InsertSensorResponseType) InsertSensorResponseDocument(net.opengis.swes.x20.InsertSensorResponseDocument) DecodingException(org.n52.svalbard.decode.exception.DecodingException) InsertSensorResponse(org.n52.shetland.ogc.sos.response.InsertSensorResponse) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)

Example 2 with InsertSensorResponseDocument

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));
}
Also used : InsertSensorResponseType(net.opengis.swes.x20.InsertSensorResponseType) InsertSensorResponseDocument(net.opengis.swes.x20.InsertSensorResponseDocument) InsertSensorResponse(org.n52.shetland.ogc.sos.response.InsertSensorResponse) Test(org.junit.Test)

Example 3 with InsertSensorResponseDocument

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;
}
Also used : InsertSensorResponseType(net.opengis.swes.x20.InsertSensorResponseType) InsertSensorResponseDocument(net.opengis.swes.x20.InsertSensorResponseDocument)

Aggregations

InsertSensorResponseDocument (net.opengis.swes.x20.InsertSensorResponseDocument)3 InsertSensorResponseType (net.opengis.swes.x20.InsertSensorResponseType)3 InsertSensorResponse (org.n52.shetland.ogc.sos.response.InsertSensorResponse)2 Test (org.junit.Test)1 DecodingException (org.n52.svalbard.decode.exception.DecodingException)1 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)1