Class TransitDataServiceImpl
- java.lang.Object
-
- org.onebusaway.transit_data_federation.impl.federated.TransitDataServiceImpl
-
- All Implemented Interfaces:
FederatedService
,TransitDataService
@Component public class TransitDataServiceImpl extends Object implements TransitDataService
-
-
Constructor Summary
Constructors Constructor Description TransitDataServiceImpl()
-
Method Summary
-
-
-
Method Detail
-
set_bundleManagementService
@Autowired public void set_bundleManagementService(BundleManagementService _bundleManagementService)
-
getAgencyIdsWithCoverageArea
public Map<String,List<CoordinateBounds>> getAgencyIdsWithCoverageArea()
TransitDataService
Interface- Specified by:
getAgencyIdsWithCoverageArea
in interfaceFederatedService
-
getAgenciesWithCoverage
public List<AgencyWithCoverageBean> getAgenciesWithCoverage() throws ServiceException
Description copied from interface:TransitDataService
The coverage area for each agency is generally the lat-lon bounds of all stops served by that agency.- Specified by:
getAgenciesWithCoverage
in interfaceTransitDataService
- Returns:
- the list of all transit agencies in the service, along with their coverage information.
- Throws:
ServiceException
-
getAgency
public AgencyBean getAgency(String agencyId) throws ServiceException
- Specified by:
getAgency
in interfaceTransitDataService
- Returns:
- the agency with the specified id, or null if not found
- Throws:
ServiceException
-
getScheduleForStop
public StopScheduleBean getScheduleForStop(String stopId, Date date) throws ServiceException
- Specified by:
getScheduleForStop
in interfaceTransitDataService
- Returns:
- retrieve the full schedule for the stop on the specified date
- Throws:
ServiceException
-
getScheduleForRoute
public RouteScheduleBean getScheduleForRoute(org.onebusaway.gtfs.model.AgencyAndId routeId, org.onebusaway.gtfs.model.calendar.ServiceDate serviceDate)
- Specified by:
getScheduleForRoute
in interfaceTransitDataService
- Returns:
- retrieve the full schedule for the route on the specified date
-
getStops
public StopsBean getStops(SearchQueryBean query) throws ServiceException
- Specified by:
getStops
in interfaceTransitDataService
- Parameters:
query
- determines the query bounds, along with an optional stop code- Returns:
- find all stops within the specified bounds query
- Throws:
ServiceException
-
getStopsByName
public StopsBean getStopsByName(String stopName) throws ServiceException
Description copied from interface:TransitDataService
Search for stops based on stop name- Specified by:
getStopsByName
in interfaceTransitDataService
- Returns:
- Throws:
ServiceException
-
getStop
public StopBean getStop(String stopId) throws ServiceException
- Specified by:
getStop
in interfaceTransitDataService
- Returns:
- the stop with the specified id, or null if not found
- Throws:
ServiceException
-
getStopForServiceDate
public StopBean getStopForServiceDate(String stopId, org.onebusaway.gtfs.model.calendar.ServiceDate serviceDate) throws ServiceException
- Specified by:
getStopForServiceDate
in interfaceTransitDataService
- Returns:
- the stop with the specified id, or null if not found
- Throws:
ServiceException
-
getStopIdsForAgencyId
public ListBean<String> getStopIdsForAgencyId(String agencyId)
- Specified by:
getStopIdsForAgencyId
in interfaceTransitDataService
- Returns:
- the list of all stops operated by the specified agency
-
getStopWithArrivalsAndDepartures
public StopWithArrivalsAndDeparturesBean getStopWithArrivalsAndDepartures(String stopId, ArrivalsAndDeparturesQueryBean query) throws ServiceException
- Specified by:
getStopWithArrivalsAndDepartures
in interfaceTransitDataService
- Returns:
- stop with arrival and departure information for the specified stop and time range, or null if not found
- Throws:
ServiceException
-
getStopsWithArrivalsAndDepartures
public StopsWithArrivalsAndDeparturesBean getStopsWithArrivalsAndDepartures(Collection<String> stopIds, ArrivalsAndDeparturesQueryBean query) throws ServiceException
- Specified by:
getStopsWithArrivalsAndDepartures
in interfaceTransitDataService
- Returns:
- stops with arrival and departure information for the specified stops and time range
- Throws:
ServiceException
NoSuchStopServiceException
- if one of the specified stops could not be found
-
getArrivalAndDepartureForStop
public ArrivalAndDepartureBean getArrivalAndDepartureForStop(ArrivalAndDepartureForStopQueryBean query) throws ServiceException
- Specified by:
getArrivalAndDepartureForStop
in interfaceTransitDataService
- Throws:
ServiceException
-
registerAlarmForArrivalAndDepartureAtStop
public String registerAlarmForArrivalAndDepartureAtStop(ArrivalAndDepartureForStopQueryBean query, RegisterAlarmQueryBean alarm)
- Specified by:
registerAlarmForArrivalAndDepartureAtStop
in interfaceTransitDataService
-
cancelAlarmForArrivalAndDepartureAtStop
public void cancelAlarmForArrivalAndDepartureAtStop(String alarmId)
- Specified by:
cancelAlarmForArrivalAndDepartureAtStop
in interfaceTransitDataService
-
getRouteForId
public RouteBean getRouteForId(String routeId) throws ServiceException
- Specified by:
getRouteForId
in interfaceTransitDataService
- Returns:
- the route with specified id, or null if not found
- Throws:
ServiceException
-
getRouteIdsForAgencyId
public ListBean<String> getRouteIdsForAgencyId(String agencyId)
- Specified by:
getRouteIdsForAgencyId
in interfaceTransitDataService
- Returns:
- the list of all route ids for the specified agency id
-
getRoutesForAgencyId
public ListBean<RouteBean> getRoutesForAgencyId(String agencyId)
- Specified by:
getRoutesForAgencyId
in interfaceTransitDataService
- Returns:
- the list of all routes for the specified agency id
-
getStopsForRoute
public StopsForRouteBean getStopsForRoute(String routeId)
- Specified by:
getStopsForRoute
in interfaceTransitDataService
- Returns:
- the stops for the specified route, or null if not found
-
getStopsForRouteForServiceDate
public StopsForRouteBean getStopsForRouteForServiceDate(String routeId, org.onebusaway.gtfs.model.calendar.ServiceDate serviceDate)
- Specified by:
getStopsForRouteForServiceDate
in interfaceTransitDataService
- Returns:
- the stops for the specified route and service date, or null if not found
-
getTrip
public TripBean getTrip(String tripId) throws ServiceException
- Specified by:
getTrip
in interfaceTransitDataService
- Returns:
- the trip with the specifid id, or null if not found
- Throws:
ServiceException
-
getSingleTripDetails
public TripDetailsBean getSingleTripDetails(TripDetailsQueryBean query) throws ServiceException
- Specified by:
getSingleTripDetails
in interfaceTransitDataService
- Parameters:
query
- details about which trip to query, and what to include in the response- Returns:
- trip details for trip matching the specified query, or null if not found
- Throws:
ServiceException
-
getTripDetails
public ListBean<TripDetailsBean> getTripDetails(TripDetailsQueryBean query) throws ServiceException
- Specified by:
getTripDetails
in interfaceTransitDataService
- Parameters:
query
- details about which trips to query, and what to include in the response- Returns:
- trip details for trips matching the specified query, or empty if not found
- Throws:
ServiceException
-
getTripsForBounds
public ListBean<TripDetailsBean> getTripsForBounds(TripsForBoundsQueryBean query)
- Specified by:
getTripsForBounds
in interfaceTransitDataService
- Parameters:
query
- determines the time and location of the query- Returns:
- trips details for the trips matching the specified bounds query
-
getTripsForRoute
public ListBean<TripDetailsBean> getTripsForRoute(TripsForRouteQueryBean query)
- Specified by:
getTripsForRoute
in interfaceTransitDataService
- Parameters:
query
- determines the time and location of the query- Returns:
- trips details for the trips matching the specified bounds query
-
getTripsForAgency
public ListBean<TripDetailsBean> getTripsForAgency(TripsForAgencyQueryBean query)
- Specified by:
getTripsForAgency
in interfaceTransitDataService
- Parameters:
query
- determines the time and location of the query- Returns:
- trips details for the trips matching the specified bounds query
-
getBlockForId
public BlockBean getBlockForId(String blockId)
- Specified by:
getBlockForId
in interfaceTransitDataService
-
getBlockInstance
public BlockInstanceBean getBlockInstance(String blockId, long serviceDate)
- Specified by:
getBlockInstance
in interfaceTransitDataService
-
getScheduledBlockLocationFromScheduledTime
public ScheduledBlockLocationBean getScheduledBlockLocationFromScheduledTime(String blockId, long serviceDate, int scheduledTime)
- Specified by:
getScheduledBlockLocationFromScheduledTime
in interfaceTransitDataService
-
getActiveBlocksForRoute
public List<BlockInstanceBean> getActiveBlocksForRoute(org.onebusaway.gtfs.model.AgencyAndId route, long timeFrom, long timeTo)
- Specified by:
getActiveBlocksForRoute
in interfaceTransitDataService
-
getVehicleForAgency
public VehicleStatusBean getVehicleForAgency(String vehicleId, long time)
Description copied from interface:TransitDataService
Vehicle Methods- Specified by:
getVehicleForAgency
in interfaceTransitDataService
-
getAllVehiclesForAgency
public ListBean<VehicleStatusBean> getAllVehiclesForAgency(String agencyId, long time)
- Specified by:
getAllVehiclesForAgency
in interfaceTransitDataService
-
getVehicleLocationRecordForVehicleId
public VehicleLocationRecordBean getVehicleLocationRecordForVehicleId(String vehicleId, long targetTime)
- Specified by:
getVehicleLocationRecordForVehicleId
in interfaceTransitDataService
-
getVehiclePositionForVehicleId
public VehicleLocationRecordBean getVehiclePositionForVehicleId(String vehicleId)
- Specified by:
getVehiclePositionForVehicleId
in interfaceTransitDataService
-
getTripDetailsForVehicleAndTime
public TripDetailsBean getTripDetailsForVehicleAndTime(TripForVehicleQueryBean query)
- Specified by:
getTripDetailsForVehicleAndTime
in interfaceTransitDataService
- Parameters:
query
- determines the vehicle and time of the trip query- Returns:
- trip details for the trip matching the specified query, or null if not found
-
getRoutes
public RoutesBean getRoutes(SearchQueryBean query) throws ServiceException
- Specified by:
getRoutes
in interfaceTransitDataService
- Parameters:
query
- specifies the bounds of the query and an optional route name query- Returns:
- return all routes matching the specified query
- Throws:
ServiceException
-
getShapeForId
public EncodedPolylineBean getShapeForId(String shapeId)
- Specified by:
getShapeForId
in interfaceTransitDataService
- Returns:
- an encoded polyline of the shape with the specified id, or null if not found
-
getShapeIdsForAgencyId
public ListBean<String> getShapeIdsForAgencyId(String agencyId)
- Specified by:
getShapeIdsForAgencyId
in interfaceTransitDataService
- Returns:
- the list of all shape ids associated with the specified agency
-
getCurrentVehicleEstimates
public ListBean<CurrentVehicleEstimateBean> getCurrentVehicleEstimates(CurrentVehicleEstimateQueryBean query)
- Specified by:
getCurrentVehicleEstimates
in interfaceTransitDataService
-
getHistoricalRidershipForStop
public List<OccupancyStatusBean> getHistoricalRidershipForStop(HistoricalOccupancyByStopQueryBean query)
Description copied from interface:TransitDataService
Historical Data- Specified by:
getHistoricalRidershipForStop
in interfaceTransitDataService
-
getAllHistoricalRiderships
public List<OccupancyStatusBean> getAllHistoricalRiderships(long serviceDate)
- Specified by:
getAllHistoricalRiderships
in interfaceTransitDataService
-
getHistoricalRidershipsForTrip
public List<OccupancyStatusBean> getHistoricalRidershipsForTrip(org.onebusaway.gtfs.model.AgencyAndId tripId, long serviceDate)
- Specified by:
getHistoricalRidershipsForTrip
in interfaceTransitDataService
-
getHistoricalRidershipsForRoute
public List<OccupancyStatusBean> getHistoricalRidershipsForRoute(org.onebusaway.gtfs.model.AgencyAndId routeId, long serviceDate)
- Specified by:
getHistoricalRidershipsForRoute
in interfaceTransitDataService
-
getHistoricalRiderships
public List<OccupancyStatusBean> getHistoricalRiderships(org.onebusaway.gtfs.model.AgencyAndId routeId, org.onebusaway.gtfs.model.AgencyAndId tripId, org.onebusaway.gtfs.model.AgencyAndId stopId, long serviceDate)
- Specified by:
getHistoricalRiderships
in interfaceTransitDataService
-
getVehicleLocationRecords
public ListBean<VehicleLocationRecordBean> getVehicleLocationRecords(VehicleLocationRecordQueryBean query)
- Specified by:
getVehicleLocationRecords
in interfaceTransitDataService
- Returns:
-
getVehicleOccupancyRecordForVehicleIdAndRoute
public VehicleOccupancyRecord getVehicleOccupancyRecordForVehicleIdAndRoute(org.onebusaway.gtfs.model.AgencyAndId vehicleId, String routeId, String directionId)
- Specified by:
getVehicleOccupancyRecordForVehicleIdAndRoute
in interfaceTransitDataService
-
submitVehicleLocation
public void submitVehicleLocation(VehicleLocationRecordBean record)
- Specified by:
submitVehicleLocation
in interfaceTransitDataService
-
resetVehicleLocation
public void resetVehicleLocation(String vehicleId)
- Specified by:
resetVehicleLocation
in interfaceTransitDataService
-
createServiceAlert
public ServiceAlertBean createServiceAlert(String agencyId, ServiceAlertBean situation)
Service Alert Methods- Specified by:
createServiceAlert
in interfaceTransitDataService
-
updateServiceAlert
public void updateServiceAlert(ServiceAlertBean situation)
- Specified by:
updateServiceAlert
in interfaceTransitDataService
-
getServiceAlertForId
public ServiceAlertBean getServiceAlertForId(String situationId)
- Specified by:
getServiceAlertForId
in interfaceTransitDataService
-
removeServiceAlert
public void removeServiceAlert(String situationId)
- Specified by:
removeServiceAlert
in interfaceTransitDataService
-
getAllServiceAlertsForAgencyId
public ListBean<ServiceAlertBean> getAllServiceAlertsForAgencyId(String agencyId)
- Specified by:
getAllServiceAlertsForAgencyId
in interfaceTransitDataService
-
getAllServiceAlertRecordsForAgencyId
public ListBean<ServiceAlertRecordBean> getAllServiceAlertRecordsForAgencyId(String agencyId)
- Specified by:
getAllServiceAlertRecordsForAgencyId
in interfaceTransitDataService
-
removeAllServiceAlertsForAgencyId
public void removeAllServiceAlertsForAgencyId(String agencyId)
- Specified by:
removeAllServiceAlertsForAgencyId
in interfaceTransitDataService
-
getServiceAlerts
public ListBean<ServiceAlertBean> getServiceAlerts(SituationQueryBean query)
- Specified by:
getServiceAlerts
in interfaceTransitDataService
-
reportProblemWithStop
public void reportProblemWithStop(StopProblemReportBean problem)
Description copied from interface:TransitDataService
Report a problem with a particular stop.- Specified by:
reportProblemWithStop
in interfaceTransitDataService
- Parameters:
problem
- the problem summary bean
-
reportProblemWithTrip
public void reportProblemWithTrip(TripProblemReportBean problem)
Description copied from interface:TransitDataService
Report a problem with a particular trip.- Specified by:
reportProblemWithTrip
in interfaceTransitDataService
- Parameters:
problem
- the problem summary bean
-
getStopProblemReportSummaries
public ListBean<StopProblemReportSummaryBean> getStopProblemReportSummaries(StopProblemReportQueryBean query)
- Specified by:
getStopProblemReportSummaries
in interfaceTransitDataService
-
getTripProblemReportSummaries
public ListBean<TripProblemReportSummaryBean> getTripProblemReportSummaries(TripProblemReportQueryBean query)
- Specified by:
getTripProblemReportSummaries
in interfaceTransitDataService
- Returns:
-
getTripProblemReportSummariesByGrouping
public ListBean<TripProblemReportSummaryBean> getTripProblemReportSummariesByGrouping(TripProblemReportQueryBean query, ETripProblemGroupBy groupBy)
- Specified by:
getTripProblemReportSummariesByGrouping
in interfaceTransitDataService
- Returns:
-
getStopProblemReports
public ListBean<StopProblemReportBean> getStopProblemReports(StopProblemReportQueryBean query)
- Specified by:
getStopProblemReports
in interfaceTransitDataService
-
getTripProblemReports
public ListBean<TripProblemReportBean> getTripProblemReports(TripProblemReportQueryBean query)
- Specified by:
getTripProblemReports
in interfaceTransitDataService
-
getAllStopProblemReportsForStopId
public List<StopProblemReportBean> getAllStopProblemReportsForStopId(String stopId)
- Specified by:
getAllStopProblemReportsForStopId
in interfaceTransitDataService
-
getAllTripProblemReportsForTripId
public List<TripProblemReportBean> getAllTripProblemReportsForTripId(String tripId)
- Specified by:
getAllTripProblemReportsForTripId
in interfaceTransitDataService
- Returns:
-
getStopProblemReportForStopIdAndId
public StopProblemReportBean getStopProblemReportForStopIdAndId(String stopId, long id)
- Specified by:
getStopProblemReportForStopIdAndId
in interfaceTransitDataService
-
getTripProblemReportForTripIdAndId
public TripProblemReportBean getTripProblemReportForTripIdAndId(String tripId, long id)
- Specified by:
getTripProblemReportForTripIdAndId
in interfaceTransitDataService
-
deleteStopProblemReportForStopIdAndId
public void deleteStopProblemReportForStopIdAndId(String stopId, long id)
- Specified by:
deleteStopProblemReportForStopIdAndId
in interfaceTransitDataService
-
updateTripProblemReport
public void updateTripProblemReport(TripProblemReportBean tripProblemReport)
- Specified by:
updateTripProblemReport
in interfaceTransitDataService
-
deleteTripProblemReportForTripIdAndId
public void deleteTripProblemReportForTripIdAndId(String tripId, long id)
- Specified by:
deleteTripProblemReportForTripIdAndId
in interfaceTransitDataService
-
getAllTripProblemReportLabels
public List<String> getAllTripProblemReportLabels()
- Specified by:
getAllTripProblemReportLabels
in interfaceTransitDataService
-
getActiveBundleId
public String getActiveBundleId()
Description copied from interface:TransitDataService
Return an id for the currently loaded bundle. Assumes bundle meta data is loaded.- Specified by:
getActiveBundleId
in interfaceTransitDataService
- Returns:
- a string representing the current bundle.
-
getBundleMetadata
public BundleMetadata getBundleMetadata()
- Specified by:
getBundleMetadata
in interfaceTransitDataService
-
getPredictionRecordsForTrip
public List<TimepointPredictionRecord> getPredictionRecordsForTrip(String agencyId, TripStatusBean tripStatus)
Description copied from interface:TransitDataService
Retrieve a list of time predictions for the given trip as represented by the TripStatusBean.- Specified by:
getPredictionRecordsForTrip
in interfaceTransitDataService
tripStatus
- the query parameters of the trip- Returns:
- a list of TimepointPredictionRecords.
-
routeHasUpcomingScheduledService
public Boolean routeHasUpcomingScheduledService(String agencyId, long time, String routeId, String directionId)
Description copied from interface:TransitDataService
Check to see if scheduled service is expected.- Specified by:
routeHasUpcomingScheduledService
in interfaceTransitDataService
-
stopHasUpcomingScheduledService
public Boolean stopHasUpcomingScheduledService(String agencyId, long time, String stopId, String routeId, String directionId)
Description copied from interface:TransitDataService
Check to see if scheduled service is expected.- Specified by:
stopHasUpcomingScheduledService
in interfaceTransitDataService
-
getSearchSuggestions
public List<String> getSearchSuggestions(String agencyId, String input)
Description copied from interface:TransitDataService
Given search string input, match against GTFS route short names and return a list of potential matches.- Specified by:
getSearchSuggestions
in interfaceTransitDataService
-
stopHasRevenueServiceOnRoute
public Boolean stopHasRevenueServiceOnRoute(String agencyId, String stopId, String routeId, String directionId)
Description copied from interface:TransitDataService
Given a stop, route, and direction, test if that stop has revenue service on the given route in the given direction.- Specified by:
stopHasRevenueServiceOnRoute
in interfaceTransitDataService
- Parameters:
agencyId
- Agency ID of stop; used only for routing requests to federated backendsstopId
- Agency-and-ID of stop being testedrouteId
- Agency-and-ID of route to filter fordirectionId
- Direction ID to filter for- Returns:
- true if the stop being tested ever permits boarding or alighting from the specified route in the specified direction in the currently-loaded bundle; false otherwise
-
stopHasRevenueService
public Boolean stopHasRevenueService(String agencyId, String stopId)
Description copied from interface:TransitDataService
Given a stop, test if that stop has revenue service.- Specified by:
stopHasRevenueService
in interfaceTransitDataService
- Parameters:
agencyId
- Agency ID of stop; used only for routing requests to federated backendsstopId
- Agency-and-ID of stop being tested- Returns:
- true if the stop being tested ever permits boarding or alighting from any route in any direction in the currently-loaded bundle; false otherwise
-
getAllRevenueStops
public List<StopBean> getAllRevenueStops(AgencyWithCoverageBean agency)
Description copied from interface:TransitDataService
Get all stops that have revenue service for the listed agency.- Specified by:
getAllRevenueStops
in interfaceTransitDataService
-
getAllConsolidatedStops
public ListBean<ConsolidatedStopMapBean> getAllConsolidatedStops()
Description copied from interface:TransitDataService
Get consolidated stops for agency- Specified by:
getAllConsolidatedStops
in interfaceTransitDataService
-
copyServiceAlert
public ServiceAlertBean copyServiceAlert(String agencyId, ServiceAlertBean situation)
- Specified by:
copyServiceAlert
in interfaceTransitDataService
-
-