예제 #1
0
  @Override
  public void importGtfsArchive(String archiveFilePath) {
    int count = 0;

    System.out.println("begining inflating");
    UnZip.unZipIt(archiveFilePath, "setup/gtfs");

    System.out.println("begining parsing");
    GtfsParser parser = new GtfsParser();
    parser.parse();

    System.out.println("begining agency import");
    for (Agency agency : parser.getAgencies()) {
      agencyDao.create(agency);
      count++;
    }
    System.out.println("done agency import : " + count);

    System.out.println("begining route import");
    count = 0;
    for (Route route : parser.getRoutes()) {

      boolean created = routeDao.create(route);
      if (created) {
        count++;
      } else {
        System.out.println("fail create route " + route.getRouteId());
      }
    }
    System.out.println("done route import : " + count);

    System.out.println("begining calendar import");
    count = 0;
    for (Calendar calendar : parser.getCalendars()) {

      boolean created = calendarDao.create(calendar);
      if (created) {
        count++;
      } else {
        System.out.println("fail create calendar " + calendar.getCalendarPK().getServiceId());
      }
    }
    System.out.println("done calendar import : " + count + " on " + parser.getCalendars().size());

    System.out.println("begining stop import");
    count = 0;
    for (Stop stop : parser.getStops()) {

      boolean created = stopDao.create(stop);
      if (created) {
        count++;
      } else {
        System.out.println("fail create stop " + stop.getStopId());
      }
    }
    System.out.println("done stop import : " + count);

    System.out.println("begining trip import");
    count = 0;
    for (Trip trip : parser.getTrips()) {
      boolean created = tripDao.create(trip);
      if (created) {
        count++;
      } else {
        System.out.println(
            "fail create trip "
                + trip.getTripPK().getTripId()
                + " - "
                + trip.getTripPK().getServiceId());
      }
    }
    System.out.println("done trip import : " + count);

    System.out.println("begining stoptime import");
    count = 0;
    for (StopTime stopTime : parser.getStopTimes()) {

      boolean created = stopTimeDao.create(stopTime);
      if (created) {
        count++;
      } else {
        System.out.println(
            "fail create stop_time "
                + stopTime.getStopTimePK().getStopId()
                + " - "
                + stopTime.getStopTimePK().getTripId());
      }
    }
    System.out.println("done stoptime import : " + count);
  }
예제 #2
0
 @Override
 public List<Trip> getTripListByHeadsign(String tripHeadsign) {
   return tripDao.getTripListByHeadsign(tripHeadsign);
 }
예제 #3
0
 @Override
 public List<Trip> getTripListByStopId(String stopId) {
   return tripDao.getTripListByStopId(stopId);
 }
예제 #4
0
 @Override
 public List<Trip> getTripListByRouteId(String routeId) {
   return tripDao.getTripListByRouteId(routeId);
 }