if (stop.getMtaStopId() != null) { if (existingStops.contains(stop.getMtaStopId())) { es.publishMessage(getTopic(), "Agency: " + dao.getAllAgencies().iterator().next().getId() + dao.getAllAgencies().iterator().next().getName() + " has duplicate stop id: " + stop.getMtaStopId()); _log.error("*** MtaStopId {} already exists", stop.getMtaStopId()); stopsToDelete.add(stop); existingStops.add(stop.getMtaStopId()); Stop refStop = referenceStops.get(stop.getMtaStopId()); if (refStop != null) { stop.setName(refStop.getName()); stop.setId(new AgencyAndId(stop.getId().getAgencyId(), stop.getMtaStopId()));
@Override public void run(TransformContext context, GtfsMutableRelationalDao dao) { Map<Route, Route> shuttleRoutes = new HashMap<>(); for (Trip trip : dao.getAllTrips()) { if (trip.getTripHeadsign().endsWith(SHUTTLE_HEADSIGN_SUFFIX)) { Route shuttleRoute = shuttleRoutes.computeIfAbsent(trip.getRoute(), r -> getShuttleRoute(dao, r)); trip.setRoute(shuttleRoute); dao.updateEntity(trip); } } // Shuttle stops share mta_stop_id with non-shuttle version Map<String, String> parentStopByMtaStopId = new HashMap<>(); for (Stop stop : dao.getAllStops()) { if (!stop.getName().endsWith(SHUTTLE_STOP_SUFFIX) && stop.getParentStation() != null) { parentStopByMtaStopId.put(stop.getMtaStopId(), stop.getParentStation()); } } for (Stop stop : dao.getAllStops()) { if (stop.getName().endsWith(SHUTTLE_STOP_SUFFIX)) { String parent = parentStopByMtaStopId.get(stop.getMtaStopId()); if (parent == null) { _log.info("No parent for shuttle stop {}", stop.getId()); } stop.setParentStation(parent); dao.updateEntity(stop); } } }
if (stopTimes != null && stopTimes.size() > 0) { Stop stop = stopTimes.get(stopTimes.size()-1).getStop(); Stop gtfsStop = reference.getStopForId(new AgencyAndId(getReferenceAgencyId(reference), stop.getMtaStopId())); if (gtfsStop == null && !missingStops.contains(stop.getMtaStopId())) { _log.info("Stop {} is missing reference stop {} for agency {}", stop.getId(), stop.getMtaStopId(), getReferenceAgencyId(reference)); missingStops.add(stop.getMtaStopId());