if (feedEntity.hasTripUpdate()) { updates.add(feedEntity.getTripUpdate());
if (entity.hasTripUpdate()) { GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); long tripUpdateTimestamp = tripUpdate.getTimestamp(); if (entity.hasVehicle()) { GtfsRealtime.VehiclePosition vehiclePosition = entity.getVehicle(); long vehicleTimestamp = vehiclePosition.getTimestamp(); if (entity.hasAlert()) { checkAlertE001(entity, e001List);
if (entity.hasTripUpdate()) { GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); checkE041(entity, tripUpdate, e041List); List<StopTime> gtfsStopTimes = null;
if (!fe.hasTripUpdate()) { continue; TripUpdate tu = fe.getTripUpdate(); if (!fe.hasVehicle()) { continue; VehiclePosition vp = fe.getVehicle();
if (entity.hasTripUpdate()) { GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); if (!tripUpdate.getTrip().hasTripId()) { checkW006(entity, tripUpdate.getTrip(), errorListW006); if (entity.hasVehicle() && entity.getVehicle().hasTrip()) { GtfsRealtime.TripDescriptor trip = entity.getVehicle().getTrip(); if (!trip.hasTripId()) { checkW006(entity, trip, errorListW006); RuleUtils.addOccurrence(E003, "vehicle_id " + entity.getVehicle().getVehicle().getId() + " trip_id " + tripId, errorListE003, _log); RuleUtils.addOccurrence(E016, "vehicle_id " + entity.getVehicle().getVehicle().getId() + " trip_id " + tripId, errorListE016, _log); checkE023(entity.getVehicle(), trip, gtfsMetadata, errorListE023); checkE020(entity.getVehicle(), trip, errorListE020); checkE004(entity.getVehicle(), trip, gtfsMetadata, errorListE004); checkE021(entity.getVehicle(), trip, errorListE021); checkE024(entity.getVehicle(), trip, gtfsMetadata, errorListE024); checkE035(entity, trip, gtfsMetadata, errorListE035); checkW009(entity, trip, errorListW009); if (entity.hasAlert()) { GtfsRealtime.Alert alert = entity.getAlert(); List<GtfsRealtime.EntitySelector> entitySelectors = alert.getInformedEntityList(); if (entitySelectors != null && entitySelectors.size() > 0) {
if (entity.hasTripUpdate() && hasTripId(entity.getTripUpdate())) { tripUpdateCount++; String tripId = entity.getTripUpdate().getTrip().getTripId(); String vehicleId = ""; if (entity.getTripUpdate().hasVehicle() && entity.getTripUpdate().getVehicle().hasId()) { vehicleId = entity.getTripUpdate().getVehicle().getId(); if (entity.hasVehicle() && hasVehicleId(entity.getVehicle())) { vehiclePositionCount++; String vehicleId = entity.getVehicle().getVehicle().getId(); String tripId = ""; if (entity.getVehicle().hasTrip() && entity.getVehicle().getTrip().hasTripId()) { tripId = entity.getVehicle().getTrip().getTripId();
if (!entity.hasVehicle()) continue; VehiclePosition vehicle = entity.getVehicle();
private void handleAlerts(FeedMessage alerts) { for (FeedEntity entity : alerts.getEntityList()) { Alert alert = entity.getAlert(); if (alert == null) { _log.warn("epxected a FeedEntity with an Alert"); AgencyAndId id = createId(entity.getId()); if (entity.getIsDeleted()) { _alertsById.remove(id); _serviceAlertService.removeServiceAlert(id);
for (FeedEntity entity : feed.getEntityList()) if (entity.hasTripUpdate()) TripUpdate update = entity.getTripUpdate(); List<StopTimeUpdate> stopTimes = update.getStopTimeUpdateList(); for(StopTimeUpdate stopTime : stopTimes)
if (entity.hasTripUpdate()) { GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); if (entity.hasVehicle()) { GtfsRealtime.VehiclePosition vehiclePosition = entity.getVehicle();
if (entity.hasTripUpdate()) { GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); if (entity.hasVehicle()) { GtfsRealtime.VehiclePosition v = entity.getVehicle(); RuleUtils.addOccurrence(W002, "entity ID " + entity.getId(), w002List, _log); } else { if (vehicleIds.contains(v.getVehicle().getId())) { RuleUtils.addOccurrence(E052, "entity ID " + entity.getId() + " has vehicle.id " + v.getVehicle().getId(), e052List, _log); } else { vehicleIds.add(v.getVehicle().getId());
tripUpdate.setVehicle(vehicleDescriptor); FeedEntity.Builder feedEntity = FeedEntity.newBuilder(); feedEntity.setTripUpdate(tripUpdate); feedEntity.setId(vehicleDescriptor.getId());
if (entity.hasTripUpdate()) { GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); if (entity.hasVehicle()) { GtfsRealtime.VehiclePosition vehiclePosition = entity.getVehicle(); if (vehiclePosition.hasTrip() && gtfsMetadata.getExactTimesZeroTripIds().contains(vehiclePosition.getTrip().getTripId())) { RuleUtils.addOccurrence(W005, "entity ID" + entity.getId() + "with trip_id " + vehiclePosition.getTrip().getTripId(), errorListW005, _log);
return null; VehiclePositionModel vpm = new VehiclePositionModel(); if (entity.hasVehicle()) { if (entity.getVehicle().hasTimestamp()) { timestamp = entity.getVehicle().getTimestamp() * 1000; if (entity.getVehicle().hasTrip()) { TripDescriptor td = entity.getVehicle().getTrip(); if (td.hasTripId()) { vpm.setTripId(td.getTripId()); if (entity.getVehicle().hasVehicle()) { VehicleDescriptor vd = entity.getVehicle().getVehicle(); if (vd.hasId()) { vpm.setVehicleId(vd.getId()); if (entity.getVehicle().hasPosition()) { Position p = entity.getVehicle().getPosition(); vpm.setLat(p.getLatitude()); vpm.setLon(p.getLongitude()); if (entity.getVehicle().hasTrip()) { if (vpm.getTripId() == null) { if (entity.getVehicle().getTrip().hasTripId()) { vpm.setTripId(entity.getVehicle().getTrip().getTripId()); if (entity.getVehicle().getTrip().hasRouteId()) { vpm.setRouteId(entity.getVehicle().getTrip().getRouteId());
String entityId = entity.getId(); if (entity.hasTripUpdate()) { GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); List<GtfsRealtime.TripUpdate.StopTimeUpdate> stopTimeUpdateList = tripUpdate.getStopTimeUpdateList(); for (GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate : stopTimeUpdateList) { if (entity.hasVehicle()) { GtfsRealtime.VehiclePosition v = entity.getVehicle(); if (v.hasStopId()) { if (!gtfsMetadata.getStopIds().contains(v.getStopId())) { if (entity.hasAlert()) { List<GtfsRealtime.EntitySelector> informedEntityList = entity.getAlert().getInformedEntityList(); for (GtfsRealtime.EntitySelector entitySelector : informedEntityList) { if (entitySelector.hasStopId()) {
FeedEntity.Builder feedEntity = FeedEntity.newBuilder(); feedEntity.setAlert(alert); feedEntity.setId(id(serviceAlert.getAgencyId(), serviceAlert.getServiceAlertId()));
if (entity.hasIsDeleted() && entity.getIsDeleted()) { String vehicleId = _vehicleIdsByEntityIds.get(entity.getId()); if (vehicleId == null) { _log.warn("unknown entity id in deletion request: " + entity.getId()); continue; continue; if (!entity.hasVehicle()) { continue; VehiclePosition vehicle = entity.getVehicle(); String vehicleId = getVehicleId(vehicle); if (vehicleId == null) { continue; _vehicleIdsByEntityIds.put(entity.getId(), vehicleId); if (!vehicle.hasPosition()) { continue;
@Override public AlertModel readFeedEntity(FeedEntity entity, long timestamp) { if (entity.hasAlert()) { AlertModel alrt = new AlertModel(); alrt.setTimestamp(new Date(timestamp)); Alert alert = entity.getAlert(); for (TimeRange tr : alert.getActivePeriodList()) { TimeRangeModel timeRange = readTimeRange(tr);
@Override public TripUpdateModel readFeedEntity(FeedEntity entity, long timestamp) { if (entity.hasTripUpdate()) { TripUpdateModel tu = new TripUpdateModel(); TripDescriptor t = entity.getTripUpdate().getTrip(); if (entity.getTripUpdate().hasTimestamp()) { timestamp = entity.getTripUpdate().getTimestamp() * 1000; if (entity.getTripUpdate().hasDelay()) { tu.setDelay(entity.getTripUpdate().getDelay()); VehicleDescriptor vehicle = entity.getTripUpdate().getVehicle(); if (vehicle != null) { tu.setVehicleId(vehicle.getId()); for (StopTimeUpdate stu : entity.getTripUpdate().getStopTimeUpdateList()) { StopTimeUpdateModel stopTimeUpdate = readStopTimeUpdate(stu, tu.getScheduleRelationship());