use of net.opengis.sos.x10.GetObservationDocument.GetObservation in project arctic-sea by 52North.
the class SosDecoderv100 method parseGetObservation.
/**
* parses the XmlBean representing the getObservation request and creates a
* SoSGetObservation request
*
* @param getObsDoc
* XmlBean created from the incoming request stream
* @return Returns SosGetObservationRequest representing the request
*
* @throws DecodingException
* * If parsing the XmlBean failed
*/
private OwsServiceRequest parseGetObservation(GetObservationDocument getObsDoc) throws DecodingException {
GetObservationRequest getObsRequest = new GetObservationRequest();
GetObservation getObs = getObsDoc.getGetObservation();
getObsRequest.setService(getObs.getService());
getObsRequest.setVersion(getObs.getVersion());
getObsRequest.setOfferings(Arrays.asList(getObs.getOffering()));
getObsRequest.setObservedProperties(Arrays.asList(getObs.getObservedPropertyArray()));
getObsRequest.setProcedures(Arrays.asList(getObs.getProcedureArray()));
getObsRequest.setTemporalFilters(parseTemporalFilters4GetObservation(getObs.getEventTimeArray()));
getObsRequest.setSrsName(getObs.getSrsName());
if (getObs.isSetFeatureOfInterest()) {
FeatureOfInterest featureOfInterest = getObs.getFeatureOfInterest();
if (featureOfInterest.isSetSpatialOps()) {
Object filter = decodeXmlElement(featureOfInterest.getSpatialOps());
if (filter instanceof SpatialFilter) {
getObsRequest.setSpatialFilter((SpatialFilter) filter);
}
} else if (featureOfInterest.getObjectIDArray() != null) {
Set<String> featureIdentifiers = Sets.newHashSet();
for (String string : featureOfInterest.getObjectIDArray()) {
featureIdentifiers.add(string);
}
getObsRequest.setFeatureIdentifiers(Lists.newArrayList(featureIdentifiers));
}
}
// TODO implement result filtering
if (getObs.isSetResult()) {
throw new NotYetSupportedDecodingException("Result filtering");
}
// return error message
if (getObs.isSetResponseFormat()) {
getObsRequest.setResponseFormat(decodeResponseFormat(getObs.getResponseFormat()));
} else {
getObsRequest.setResponseFormat(OmConstants.CONTENT_TYPE_OM.toString());
}
if (getObs.isSetResultModel()) {
getObsRequest.setResultModel(OMHelper.getObservationTypeFor(getObs.getResultModel()));
}
return getObsRequest;
}
use of net.opengis.sos.x10.GetObservationDocument.GetObservation in project arctic-sea by 52North.
the class SosDecoderv100 method decode.
@Override
public OwsServiceCommunicationObject decode(XmlObject xmlObject) throws DecodingException {
OwsServiceCommunicationObject request = null;
LOGGER.debug("REQUESTTYPE:" + xmlObject.getClass());
/*
* Add O&M 1.0.0 namespace to GetObservation document. XmlBeans removes
* the namespace from the document because there are no om:... elements
* in the document. But the validation fails if the <resultModel>
* element is set with e.g. om:Measurement.
*/
if (xmlObject instanceof GetObservationDocument) {
XmlCursor cursor = xmlObject.newCursor();
cursor.toFirstChild();
cursor.insertNamespace(OmConstants.NS_OM_PREFIX, OmConstants.NS_OM);
cursor.dispose();
}
// validate document
XmlHelper.validateDocument(xmlObject);
if (xmlObject instanceof GetCapabilitiesDocument) {
// getCapabilities request
GetCapabilitiesDocument getCapsDoc = (GetCapabilitiesDocument) xmlObject;
request = parseGetCapabilities(getCapsDoc);
} else if (xmlObject instanceof DescribeSensorDocument) {
// DescribeSensor request (still SOS 1.0 NS_URI
DescribeSensorDocument descSensorDoc = (DescribeSensorDocument) xmlObject;
request = parseDescribeSensor(descSensorDoc);
} else if (xmlObject instanceof GetObservationDocument) {
// getObservation request
GetObservationDocument getObsDoc = (GetObservationDocument) xmlObject;
request = parseGetObservation(getObsDoc);
} else if (xmlObject instanceof GetFeatureOfInterestDocument) {
// getFeatureOfInterest request
GetFeatureOfInterestDocument getFoiDoc = (GetFeatureOfInterestDocument) xmlObject;
request = parseGetFeatureOfInterest(getFoiDoc);
} else if (xmlObject instanceof GetObservationByIdDocument) {
// getObservationById request
GetObservationByIdDocument getObsByIdDoc = (GetObservationByIdDocument) xmlObject;
request = parseGetObservationById(getObsByIdDoc);
} else {
throw new UnsupportedDecoderXmlInputException(this, xmlObject);
}
return request;
}
Aggregations