use of org.onebusaway.gtfs_realtime.archiver.model.StopUpdate in project onebusaway-application-modules by camsys.
the class LinkAvlRealtimeArchiverTask method deserializeAvlJson.
private LinkAVLData deserializeAvlJson(String avlJson) {
LinkAVLData avlData = new LinkAVLData();
ObjectMapper mapper = new ObjectMapper().enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
mapper.configure(SerializationConfig.Feature.AUTO_DETECT_FIELDS, true);
try {
avlData = mapper.readValue(avlJson, LinkAVLData.class);
} catch (JsonParseException e) {
_log.error("JsonParseException trying to parse feed data.");
} catch (JsonMappingException e) {
_log.error("JsonMappingException: " + e.getMessage());
} catch (IOException e) {
_log.error("IOException trying to parse feed data.");
} catch (Exception e) {
_log.error("Exception trying to parse feed data: " + e.getMessage());
}
avlData.setAvlSource(_avlFeedId);
if (avlData.getTrips() == null)
return avlData;
for (TripInfo tripInfo : avlData.getTrips()) {
tripInfo.setLinkAVLData(avlData);
for (StopUpdate stopUpdate : tripInfo.getStopUpdates()) {
stopUpdate.setTripInfo(tripInfo);
}
}
return avlData;
}
Aggregations