Search in sources :

Example 1 with NotYetSupportedDecodingException

use of org.n52.svalbard.decode.exception.NotYetSupportedDecodingException 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;
}
Also used : GetObservation(net.opengis.sos.x10.GetObservationDocument.GetObservation) GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) Set(java.util.Set) GetFeatureOfInterest(net.opengis.sos.x10.GetFeatureOfInterestDocument.GetFeatureOfInterest) FeatureOfInterest(net.opengis.sos.x10.GetObservationDocument.GetObservation.FeatureOfInterest) SpatialFilter(org.n52.shetland.ogc.filter.SpatialFilter) XmlObject(org.apache.xmlbeans.XmlObject) OwsServiceCommunicationObject(org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject) NotYetSupportedDecodingException(org.n52.svalbard.decode.exception.NotYetSupportedDecodingException)

Aggregations

Set (java.util.Set)1 GetFeatureOfInterest (net.opengis.sos.x10.GetFeatureOfInterestDocument.GetFeatureOfInterest)1 GetObservation (net.opengis.sos.x10.GetObservationDocument.GetObservation)1 FeatureOfInterest (net.opengis.sos.x10.GetObservationDocument.GetObservation.FeatureOfInterest)1 XmlObject (org.apache.xmlbeans.XmlObject)1 SpatialFilter (org.n52.shetland.ogc.filter.SpatialFilter)1 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)1 GetObservationRequest (org.n52.shetland.ogc.sos.request.GetObservationRequest)1 NotYetSupportedDecodingException (org.n52.svalbard.decode.exception.NotYetSupportedDecodingException)1