private AbstractServiceRequest<?> parseGetObservationById(GetObservationByIdDocument getObsByIdDoc) throws OwsExceptionReport { GetObservationByIdRequest getObsByIdRequest = new GetObservationByIdRequest(); GetObservationById getObsById = getObsByIdDoc.getGetObservationById(); getObsByIdRequest.setService(getObsById.getService()); getObsByIdRequest.setVersion(getObsById.getVersion()); if (getObsById.isSetResponseFormat()) { try { String responseFormat = URLDecoder.decode(getObsById.getResponseFormat(), "UTF-8"); // parse responseFormat through MediaType to ensure it's a mime type and eliminate whitespace variations getObsByIdRequest.setResponseFormat(MediaType.normalizeString(responseFormat)); } catch (UnsupportedEncodingException e) { throw new NoApplicableCodeException().causedBy(e).withMessage("Error while decoding response format!"); } } else { getObsByIdRequest.setResponseFormat(OmConstants.CONTENT_TYPE_OM.toString()); } Enum responseMode = getObsById.getResponseMode(); if (responseMode != null && responseMode.toString().equalsIgnoreCase(SosConstants.RESPONSE_MODE_INLINE)) { getObsByIdRequest.setResponseMode(SosConstants.RESPONSE_MODE_INLINE); } if (getObsById.isSetResultModel()) { getObsByIdRequest.setResultModel(OMHelper.getObservationTypeFor(getObsById.getResultModel())); } getObsByIdRequest.setObservationIdentifier(Arrays.asList(getObsById.getObservationId())); return getObsByIdRequest; }
private OwsServiceRequest parseGetObservationById(GetObservationByIdDocument getObsByIdDoc) throws DecodingException { GetObservationByIdRequest getObsByIdRequest = new GetObservationByIdRequest(); GetObservationById getObsById = getObsByIdDoc.getGetObservationById(); getObsByIdRequest.setService(getObsById.getService()); getObsByIdRequest.setVersion(getObsById.getVersion()); if (getObsById.isSetResponseFormat()) { getObsByIdRequest.setResponseFormat(decodeResponseFormat(getObsById.getResponseFormat())); } else { getObsByIdRequest.setResponseFormat(OmConstants.CONTENT_TYPE_OM.toString()); } net.opengis.sos.x10.ResponseModeType.Enum responseMode = getObsById.getResponseMode(); if (responseMode != null && responseMode.toString().equalsIgnoreCase(SosConstants.RESPONSE_MODE_INLINE)) { getObsByIdRequest.setResponseMode(SosConstants.RESPONSE_MODE_INLINE); } if (getObsById.isSetResultModel()) { getObsByIdRequest.setResultModel(OMHelper.getObservationTypeFor(getObsById.getResultModel())); } getObsByIdRequest.setObservationIdentifier(Arrays.asList(getObsById.getObservationId())); return getObsByIdRequest; }