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