Skip to content

Commit

Permalink
Fix inspire converter to reset checked observation to stream
Browse files Browse the repository at this point in the history
  • Loading branch information
CarstenHollmann committed Nov 18, 2022
1 parent 7cac61d commit 447e065
Showing 1 changed file with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,35 +176,40 @@ private void checkData(OwsServiceRequest request, AbstractObservationResponse re
Map<String, List<OmObservation>> map = Maps.newHashMap();
while (response.getObservationCollection().hasNext()) {
OmObservation omObservation = response.getObservationCollection().next();
String observationType = checkForObservationTypeForStreaming(omObservation, request);
if (omObservation.getValue() instanceof StreamingValue<?>) {
if (checkRequestedObservationTypeForOffering(omObservation, request)) {
String observationType = checkForObservationTypeForStreaming(omObservation, request);
while (((StreamingValue<?>) omObservation.getValue()).hasNext()) {
OmObservation observation = ((StreamingValue<?>) omObservation.getValue()).next();
if (InspireOMSOConstants.OBS_TYPE_PROFILE_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_PROFILE_OBSERVATION,
convertToProfileObservations(observation));
} else if (InspireOMSOConstants.OBS_TYPE_TRAJECTORY_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_TRAJECTORY_OBSERVATION,
convertToTrajectoryObservations(observation));
} else if (InspireOMSOConstants.OBS_TYPE_MULTI_POINT_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_MULTI_POINT_OBSERVATION,
convertToMultiPointObservations(observation));
} else if (InspireOMSOConstants.OBS_TYPE_POINT_TIME_SERIES_OBSERVATION
.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_POINT_TIME_SERIES_OBSERVATION,
convertToPointTimeSeriesObservations(observation));
} else if (InspireOMSOConstants.OBS_TYPE_POINT_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_POINT_OBSERVATION,
convertToPointObservations(observation));
}
checkAndPutOrAdd(observation, map, observationType);
}
}
} else {
checkAndPutOrAdd(omObservation, map, observationType);
}
}
response.setObservationCollection(mergeObservations(map));
}

private void checkAndPutOrAdd(OmObservation observation, Map<String, List<OmObservation>> map,
String observationType) throws CodedException {
if (InspireOMSOConstants.OBS_TYPE_PROFILE_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_PROFILE_OBSERVATION,
convertToProfileObservations(observation));
} else if (InspireOMSOConstants.OBS_TYPE_TRAJECTORY_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_TRAJECTORY_OBSERVATION,
convertToTrajectoryObservations(observation));
} else if (InspireOMSOConstants.OBS_TYPE_MULTI_POINT_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_MULTI_POINT_OBSERVATION,
convertToMultiPointObservations(observation));
} else if (InspireOMSOConstants.OBS_TYPE_POINT_TIME_SERIES_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_POINT_TIME_SERIES_OBSERVATION,
convertToPointTimeSeriesObservations(observation));
} else if (InspireOMSOConstants.OBS_TYPE_POINT_OBSERVATION.equals(observationType)) {
putOrAdd(map, InspireOMSOConstants.OBS_TYPE_POINT_OBSERVATION, convertToPointObservations(observation));
}
}

/**
* Merge the observations depending on their observationType
*
Expand Down

0 comments on commit 447e065

Please sign in to comment.