private Agency doMap(org.onebusaway.gtfs.model.Agency rhs) { Agency lhs = new Agency(); lhs.setId(rhs.getId()); lhs.setName(rhs.getName()); lhs.setUrl(rhs.getUrl()); lhs.setTimezone(rhs.getTimezone()); lhs.setLang(rhs.getLang()); lhs.setPhone(rhs.getPhone()); lhs.setFareUrl(rhs.getFareUrl()); lhs.setBrandingUrl(rhs.getBrandingUrl()); return lhs; } }
private void setTimeZonesForAgencies(CalendarServiceData data) { for (Agency agency : _dao.getAllAgencies()) { TimeZone timeZone = TimeZone.getTimeZone(agency.getTimezone()); if (timeZone.getID().equals("GMT") && !agency.getTimezone().toUpperCase().equals("GMT")) { throw new UnknownAgencyTimezoneException(agency.getName(), agency.getTimezone()); } data.putTimeZoneForAgencyId(agency.getId(), timeZone); } }
private void setTimeZonesForAgencies(CalendarServiceData data) { for (Agency agency : _dao.getAllAgencies()) { TimeZone timeZone = TimeZone.getTimeZone(agency.getTimezone()); if (timeZone.getID().equals("GMT") && !agency.getTimezone().toUpperCase().equals("GMT")) { throw new UnknownAgencyTimezoneException(agency.getName(), agency.getTimezone()); } data.putTimeZoneForAgencyId(agency.getId(), timeZone); } }
@Cacheable public TimeZone getTimeZoneForAgencyId(String agencyId) { Agency agency = _dao.getAgencyForId(agencyId); if (agency == null) throw new NoSuchAgencyServiceException(agencyId); return TimeZone.getTimeZone(agency.getTimezone()); }
@Override public void run(TransformContext context, GtfsMutableRelationalDao dao) { _dao = dao; Agency agency = dao.getAllAgencies().iterator().next(); _agencyId = agency.getId(); _agencyTimeZone = TimeZone.getTimeZone(agency.getTimezone()); _tripResolutionService = new WSFTripResolutionService(_dao, _agencyId, _agencyTimeZone); try { _scheduleService = new WSFScheduleService(apiAccessCode); setAllBlockIds(); } catch (Exception e) { _log.error("Error initializing WSFBlockResolutionStrategy: " + e); return; } }
timeZoneText = agency.getTimezone(); break;
TimeZone tz = TimeZone.getTimeZone(agency.getTimezone()); LocalizedServiceId lsid = new LocalizedServiceId(trip.getServiceId(), tz);
private TripEntryImpl processTrip(TransitGraphImpl graph, Trip trip) { List<StopTime> stopTimes = _gtfsDao.getStopTimesForTrip(trip); // A trip without stop times is a trip we don't care about if (stopTimes.isEmpty()) return null; ShapePoints shapePoints = null; if (trip.getShapeId() != null) shapePoints = _shapePointsHelper.getShapePointsForShapeId(trip.getShapeId()); Agency agency = trip.getRoute().getAgency(); TimeZone tz = TimeZone.getTimeZone(agency.getTimezone()); LocalizedServiceId lsid = new LocalizedServiceId(trip.getServiceId(), tz); TripEntryImpl tripEntry = new TripEntryImpl(); tripEntry.setId(trip.getId()); tripEntry.setDirectionId(unique(trip.getDirectionId())); tripEntry.setServiceId(unique(lsid)); // Only set the shape id for a trip if there are actually shape points to // back it up if (!(shapePoints == null || shapePoints.isEmpty())) tripEntry.setShapeId(unique(trip.getShapeId())); List<StopTimeEntryImpl> stopTimesForTrip = _stopTimeEntriesFactory.processStopTimes( graph, stopTimes, tripEntry, shapePoints); double tripDistance = getTripDistance(stopTimesForTrip, shapePoints); tripEntry.setTotalTripDistance(tripDistance); tripEntry.setStopTimes(cast(stopTimesForTrip)); graph.putTripEntry(tripEntry); return tripEntry; }
@Cacheable public AgencyBean getAgencyForId(String id) { Agency agency = _gtfsDao.getAgencyForId(id); if (agency == null) return null; AgencyBean bean = new AgencyBean(); bean.setId(agency.getId()); bean.setLang(agency.getLang()); bean.setName(agency.getName()); bean.setPhone(agency.getPhone()); bean.setTimezone(agency.getTimezone()); bean.setUrl(agency.getUrl()); AgencyNarrative narrative = _narrativeService.getAgencyForId(agency.getId()); if (narrative != null) { bean.setDisclaimer(narrative.getDisclaimer()); } return bean; } }
private TripEntryImpl processTrip(TransitGraphImpl graph, Trip trip) { List<StopTime> stopTimes = _gtfsDao.getStopTimesForTrip(trip); // A trip without stop times is a trip we don't care about if (stopTimes.isEmpty()) return null; ShapePoints shapePoints = null; if (trip.getShapeId() != null) shapePoints = _shapePointsService.getShapePointsForShapeId(trip.getShapeId()); Agency agency = trip.getRoute().getAgency(); TimeZone tz = TimeZone.getTimeZone(agency.getTimezone()); LocalizedServiceId lsid = new LocalizedServiceId(trip.getServiceId(), tz); TripEntryImpl tripEntry = new TripEntryImpl(); tripEntry.setId(trip.getId()); tripEntry.setRouteId(unique(trip.getRoute().getId())); tripEntry.setDirectionId(unique(trip.getDirectionId())); tripEntry.setServiceId(unique(lsid)); // Only set the shape id for a trip if there are actually shape points to // back it up if (!(shapePoints == null || shapePoints.isEmpty())) tripEntry.setShapeId(unique(trip.getShapeId())); List<StopTimeEntryImpl> stopTimesForTrip = _stopTimeEntriesFactory.processStopTimes( graph, stopTimes, tripEntry, shapePoints); double tripDistance = getTripDistance(stopTimesForTrip, shapePoints); tripEntry.setTotalTripDistance(tripDistance); tripEntry.setStopTimes(cast(stopTimesForTrip)); graph.putTripEntry(tripEntry); return tripEntry; }
public void generateAgencyNarratives(NarrativeProviderImpl provider) { for (Agency agency : _gtfsDao.getAllAgencies()) { AgencyNarrative.Builder narrative = AgencyNarrative.builder(); narrative.setLang(deduplicate(agency.getLang())); narrative.setName(deduplicate(agency.getName())); narrative.setPhone(deduplicate(agency.getPhone())); narrative.setTimezone(deduplicate(agency.getTimezone())); narrative.setUrl(deduplicate(agency.getUrl())); narrative.setEmail(agency.getEmail()); narrative.setFareUrl(agency.getFareUrl()); String disclaimer = _modifications.getModificationForTypeAndId( AgencyNarrative.class, agency.getId(), "disclaimer"); if (disclaimer != null) narrative.setDisclaimer(disclaimer); Boolean privateService = _modifications.getModificationForTypeAndId( AgencyNarrative.class, agency.getId(), "privatService"); if (privateService != null) narrative.setPrivateService(privateService); provider.setNarrativeForAgency(agency.getId(), narrative.create()); } }
public void generateAgencyNarratives(NarrativeProviderImpl provider) { for (Agency agency : _gtfsDao.getAllAgencies()) { AgencyNarrative.Builder narrative = AgencyNarrative.builder(); narrative.setLang(deduplicate(agency.getLang())); narrative.setName(deduplicate(agency.getName())); narrative.setPhone(deduplicate(agency.getPhone())); narrative.setEmail(deduplicate(agency.getEmail())); narrative.setTimezone(deduplicate(agency.getTimezone())); narrative.setUrl(deduplicate(agency.getUrl())); narrative.setEmail(agency.getEmail()); narrative.setFareUrl(agency.getFareUrl()); String disclaimer = _modifications.getModificationForTypeAndId( AgencyNarrative.class, agency.getId(), "disclaimer"); if (disclaimer != null) narrative.setDisclaimer(disclaimer); Boolean privateService = _modifications.getModificationForTypeAndId( AgencyNarrative.class, agency.getId(), "privatService"); if (privateService != null) narrative.setPrivateService(privateService); provider.setNarrativeForAgency(agency.getId(), narrative.create()); } }