@Override public void run(TransformContext context, GtfsMutableRelationalDao dao) { GtfsMutableRelationalDao reference = (GtfsMutableRelationalDao) context.getReferenceReader().getEntityStore(); RemoveEntityLibrary removeEntityLibrary = new RemoveEntityLibrary(); //trips updated, array of mta_ids that we've updated HashMap<String, Trip> tripsUpdated = new HashMap<>(); //trips to remove, list of trips that have duplicate mta_ids ArrayList<Trip> tripsToRemove = new ArrayList<>(); _log.info("Total dao {}", dao.getAllTrips().size()); _log.info("Stop times: {}" , dao.getAllStopTimes().size()); for (Trip trip : dao.getAllTrips()) { if (trip.getMtaTripId() != null) { if (tripsUpdated.containsKey(trip.getMtaTripId())) { tripsToRemove.add(trip); for (StopTime stopTime : dao.getStopTimesForTrip(trip)){ stopTime.setTrip(tripsUpdated.get(trip.getMtaTripId())); } } else { tripsUpdated.put(trip.getMtaTripId(), trip); trip.setId(new AgencyAndId(trip.getId().getAgencyId(), trip.getMtaTripId())); } } } for (Trip tripToRemove : tripsToRemove) { //removeEntityLibrary.removeTrip(dao, tripToRemove); dao.removeEntity(tripToRemove); } _log.info("Total dao {}", dao.getAllTrips().size()); _log.info("Stop times: {}" , dao.getAllStopTimes().size()); }
if (trip.getMtaTripId() != null) { if (tripsMap.containsKey(trip.getMtaTripId())) { ArrayList<Trip> trips = tripsMap.get(trip.getMtaTripId()); trips.add(trip); tripsMap.put(trip.getMtaTripId(), trips); } else { ArrayList<Trip> trips = new ArrayList<>(); trips.add(trip); tripsMap.put(trip.getMtaTripId(), trips); trip.setId(new AgencyAndId(trip.getId().getAgencyId(), trip.getMtaTripId())); countUnique++; if (trip.getMtaTripId() != null) { if (tripsUpdated.containsKey(trip.getMtaTripId())) { tripsToRemove.add(trip); } else { tripsUpdated.put(trip.getMtaTripId(), trip); trip.setId(new AgencyAndId(trip.getId().getAgencyId(), trip.getMtaTripId()));
atisTrips.put(trip.getMtaTripId(), trip);
_log.error("No stoptimes for trip {} mta id", trip.toString(), trip.getMtaTripId()); if (trip.getTripHeadsign() == null && trip.getRouteShortName() == null) {