Search in sources :

Example 1 with Offering

use of net.opengis.swes.x20.AbstractContentsType.Offering in project arctic-sea by 52North.

the class GetCapabilitiesResponseEncoder method renameContentsElementNames.

private void renameContentsElementNames(final Contents xbContents) {
    for (final Offering offering : xbContents.getContents().getOfferingArray()) {
        final XmlCursor cursor = offering.getAbstractOffering().newCursor();
        cursor.setName(Sos2Constants.QN_OBSERVATION_OFFERING);
        cursor.removeAttribute(W3CConstants.QN_XSI_TYPE);
        if (cursor.toChild(Sos2Constants.QN_SOS_OBSERVED_AREA)) {
            cursor.setName(Sos2Constants.QN_SOS_OBSERVED_AREA);
            cursor.toParent();
        }
        if (cursor.toChild(Sos2Constants.QN_SOS_PHENOMENON_TIME)) {
            cursor.setName(Sos2Constants.QN_SOS_PHENOMENON_TIME);
            cursor.toParent();
        }
        if (cursor.toChild(Sos2Constants.QN_SOS_RESULT_TIME)) {
            cursor.setName(Sos2Constants.QN_SOS_RESULT_TIME);
            cursor.toParent();
        }
        if (cursor.toChild(Sos2Constants.QN_SOS_RESPONSE_FORMAT)) {
            cursor.setName(Sos2Constants.QN_SOS_RESPONSE_FORMAT);
            while (cursor.toNextSibling(Sos2Constants.QN_SOS_RESPONSE_FORMAT)) {
                cursor.setName(Sos2Constants.QN_SOS_RESPONSE_FORMAT);
            }
            cursor.toParent();
        }
        if (cursor.toChild(Sos2Constants.QN_SOS_OBSERVATION_TYPE)) {
            cursor.setName(Sos2Constants.QN_SOS_OBSERVATION_TYPE);
            while (cursor.toNextSibling(Sos2Constants.QN_SOS_OBSERVATION_TYPE)) {
                cursor.setName(Sos2Constants.QN_SOS_OBSERVATION_TYPE);
            }
            cursor.toParent();
        }
        if (cursor.toChild(Sos2Constants.QN_SOS_FEATURE_OF_INTEREST_TYPE)) {
            cursor.setName(Sos2Constants.QN_SOS_FEATURE_OF_INTEREST_TYPE);
            while (cursor.toNextSibling(Sos2Constants.QN_SOS_FEATURE_OF_INTEREST_TYPE)) {
                cursor.setName(Sos2Constants.QN_SOS_FEATURE_OF_INTEREST_TYPE);
            }
        }
        cursor.dispose();
    }
}
Also used : SosOffering(org.n52.shetland.ogc.sos.SosOffering) Offering(net.opengis.swes.x20.AbstractContentsType.Offering) SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering) XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 2 with Offering

use of net.opengis.swes.x20.AbstractContentsType.Offering 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)

Aggregations

Offering (net.opengis.swes.x20.AbstractContentsType.Offering)1 InsertSensorResponseDocument (net.opengis.swes.x20.InsertSensorResponseDocument)1 InsertSensorResponseType (net.opengis.swes.x20.InsertSensorResponseType)1 XmlCursor (org.apache.xmlbeans.XmlCursor)1 Test (org.junit.Test)1 SosObservationOffering (org.n52.shetland.ogc.sos.SosObservationOffering)1 SosOffering (org.n52.shetland.ogc.sos.SosOffering)1 InsertSensorResponse (org.n52.shetland.ogc.sos.response.InsertSensorResponse)1