use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.
the class SwesExtensionsTest method containsExtension_for_enum_schould_return_true.
@Test
public void containsExtension_for_enum_schould_return_true() {
final Extensions extensions = new Extensions();
extensions.addExtension(new SwesExtension<>().setDefinition(DEFINITION_1).setValue(new SweText()));
extensions.addExtension(new SwesExtension<>().setDefinition(DEFINITION_2).setValue(new SweText()));
extensions.addExtension(new SwesExtension<>().setDefinition(DEFINITION_3).setValue(new SweText()));
assertThat(extensions.containsExtension(DEFINITION_1), is(TRUE));
assertThat(extensions.containsExtension(DEFINITION_2), is(TRUE));
assertThat(extensions.containsExtension(DEFINITION_3), is(TRUE));
}
use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.
the class SosDecoderv20 method parseGetFeatureOfInterest.
// private SwesExtensions parseSwesExtensions(final XmlObject[]
// extensionArray) throws OwsExceptionReport
// {
// final SwesExtensions extensions = new SwesExtensions();
// for (final XmlObject xbSwesExtension : extensionArray) {
//
// final Object obj = CodingHelper.decodeXmlElement(xbSwesExtension);
// if (obj instanceof SwesExtension<?>) {
// extensions.addSwesExtension((SwesExtension<?>) obj);
// }
// }
// return extensions;
// }
/**
* parses the passes XmlBeans document and creates a SOS
* getFeatureOfInterest request
*
* @param getFoiDoc
* XmlBeans document representing the getFeatureOfInterest
* request
* @return Returns SOS getFeatureOfInterest request
*
* @throws DecodingException
* * if validation of the request failed
*/
private OwsServiceRequest parseGetFeatureOfInterest(final GetFeatureOfInterestDocument getFoiDoc) throws DecodingException {
final GetFeatureOfInterestRequest getFoiRequest = new GetFeatureOfInterestRequest();
final GetFeatureOfInterestType getFoiType = getFoiDoc.getGetFeatureOfInterest();
getFoiRequest.setService(getFoiType.getService());
getFoiRequest.setVersion(getFoiType.getVersion());
getFoiRequest.setFeatureIdentifiers(Arrays.asList(getFoiType.getFeatureOfInterestArray()));
getFoiRequest.setObservedProperties(Arrays.asList(getFoiType.getObservedPropertyArray()));
getFoiRequest.setProcedures(Arrays.asList(getFoiType.getProcedureArray()));
getFoiRequest.setSpatialFilters(parseSpatialFilters4GetFeatureOfInterest(getFoiType.getSpatialFilterArray()));
getFoiRequest.setExtensions(parseExtensibleRequest(getFoiType));
return getFoiRequest;
}
use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.
the class SwesDecoderv20 method parseDescribeSensor.
/**
* parses the passes XmlBeans document and creates a SOS describeSensor
* request
*
* @param xbDescSenDoc
* XmlBeans document representing the describeSensor request
* @return Returns SOS describeSensor request
*
* @throws DecodingException
* * if validation of the request failed
*/
private OwsServiceRequest parseDescribeSensor(final DescribeSensorDocument xbDescSenDoc) throws DecodingException {
final DescribeSensorRequest descSensorRequest = new DescribeSensorRequest();
final DescribeSensorType xbDescSensor = xbDescSenDoc.getDescribeSensor();
descSensorRequest.setService(xbDescSensor.getService());
descSensorRequest.setVersion(xbDescSensor.getVersion());
descSensorRequest.setProcedure(xbDescSensor.getProcedure());
descSensorRequest.setProcedureDescriptionFormat(xbDescSensor.getProcedureDescriptionFormat());
if (xbDescSensor.isSetValidTime()) {
descSensorRequest.setValidTime(getValidTime(xbDescSensor.getValidTime()));
}
// extensions
descSensorRequest.setExtensions(parseExtensibleRequest(xbDescSensor));
return descSensorRequest;
}
use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.
the class SwesDecoderv20 method parseInsertSensor.
private OwsServiceRequest parseInsertSensor(final InsertSensorDocument xbInsSensDoc) throws DecodingException {
final InsertSensorRequest request = new InsertSensorRequest();
final InsertSensorType xbInsertSensor = xbInsSensDoc.getInsertSensor();
request.setService(xbInsertSensor.getService());
request.setVersion(xbInsertSensor.getVersion());
// format
request.setProcedureDescriptionFormat(xbInsertSensor.getProcedureDescriptionFormat());
// observable properties
if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getObservablePropertyArray())) {
request.setObservableProperty(Arrays.asList(xbInsertSensor.getObservablePropertyArray()));
}
// related features
if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getRelatedFeatureArray())) {
request.setRelatedFeature(parseRelatedFeature(xbInsertSensor.getRelatedFeatureArray()));
}
// metadata
if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getMetadataArray())) {
request.setMetadata(parseMetadata(xbInsertSensor.getMetadataArray()));
}
// extensions
request.setExtensions(parseExtensibleRequest(xbInsertSensor));
try {
final XmlObject xbProcedureDescription = XmlObject.Factory.parse(getNodeFromNodeList(xbInsertSensor.getProcedureDescription().getDomNode().getChildNodes()));
checkFormatWithNamespace(xbInsertSensor.getProcedureDescriptionFormat(), XmlHelper.getNamespace(xbProcedureDescription));
final Decoder<?, XmlObject> decoder = getDecoder(new XmlNamespaceDecoderKey(xbInsertSensor.getProcedureDescriptionFormat(), xbProcedureDescription.getClass()));
if (decoder != null) {
final Object decodedProcedureDescription = decoder.decode(xbProcedureDescription);
if (decodedProcedureDescription instanceof SosProcedureDescription) {
request.setProcedureDescription((SosProcedureDescription) decodedProcedureDescription);
} else if (decodedProcedureDescription instanceof AbstractFeature) {
request.setProcedureDescription(new SosProcedureDescription<>((AbstractFeature) decodedProcedureDescription));
}
}
} catch (final XmlException xmle) {
throw new DecodingException("Error while parsing procedure description of InsertSensor request!", xmle);
}
return request;
}
use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.
the class SwesDecoderv20 method parseDeleteSensor.
private OwsServiceRequest parseDeleteSensor(final DeleteSensorDocument xbDelSenDoc) throws DecodingException {
final DeleteSensorRequest request = new DeleteSensorRequest();
DeleteSensorType deleteSensor = xbDelSenDoc.getDeleteSensor();
request.setService(deleteSensor.getService());
request.setVersion(deleteSensor.getVersion());
request.setProcedureIdentifier(deleteSensor.getProcedure());
// extensions
request.setExtensions(parseExtensibleRequest(deleteSensor));
return request;
}
Aggregations