protected Set<String> getResponseFormatForOffering(String offering, String version) { Set<String> responseFormats = getCache().getAllObservationTypesForOffering(offering).stream() .map(observationType -> getResponseFormatsForObservationType(observationType, SosConstants.SOS, version)) .filter(Objects::nonNull).flatMap(Set::stream).collect(toSet()); switch (version) { case Sos1Constants.SERVICEVERSION: return checkForMimeType(responseFormats, true); case Sos2Constants.SERVICEVERSION: return checkForMimeType(responseFormats, false); default: return responseFormats; } }
/** * Check if observationType is valid for observation * * @param observation * {@link OmObservation} to check * @param observationType * The observationType to check * @return <code>true</code>, if observationType is valid for observation */ private boolean checkForObservationType(OmObservation observation, String observationType) { for (String offering : observation.getObservationConstellation().getOfferings()) { if (((SosContentCache) getContentCacheController().getCache()).getAllObservationTypesForOffering(offering).contains(observationType)) { return true; } } return false; }
/** * Check if observationType is valid for observation * * @param observation * {@link OmObservation} to check * @param observationType * The observationType to check * @return <code>true</code>, if observationType is valid for observation */ private boolean checkForObservationType(OmObservation observation, String observationType) { for (String offering : observation.getObservationConstellation().getOfferings()) { if (((SosContentCache) getContentCacheController().getCache()).getAllObservationTypesForOffering(offering).contains(observationType)) { return true; } } return false; }
/** * Check for {@link TrajectoryObservation} * * @param observation * {@link OmObservation} to check * @return <code>true</code>, if observationType of observation is * {@link InspireOMSOConstants#OBS_TYPE_TRAJECTORY_OBSERVATION} */ private boolean checkForTrajectory(OmObservation observation) { for (String offering : observation.getObservationConstellation().getOfferings()) { if (((SosContentCache) getContentCacheController().getCache()).getAllObservationTypesForOffering(offering) .contains(InspireOMSOConstants.OBS_TYPE_TRAJECTORY_OBSERVATION)) { return true; } } return checkForObservationType(observation, InspireOMSOConstants.OBS_TYPE_TRAJECTORY_OBSERVATION); }
/** * Check for {@link TrajectoryObservation} * * @param observation * {@link OmObservation} to check * @return <code>true</code>, if observationType of observation is * {@link InspireOMSOConstants#OBS_TYPE_TRAJECTORY_OBSERVATION} */ private boolean checkForTrajectory(OmObservation observation) { for (String offering : observation.getObservationConstellation().getOfferings()) { if (((SosContentCache) getContentCacheController().getCache()).getAllObservationTypesForOffering(offering) .contains(InspireOMSOConstants.OBS_TYPE_TRAJECTORY_OBSERVATION)) { return true; } } return checkForObservationType(observation, InspireOMSOConstants.OBS_TYPE_TRAJECTORY_OBSERVATION); }