use of org.onebusaway.exceptions.NoSuchTripServiceException in project onebusaway-application-modules by camsys.
the class TransitDataServiceTemplateImpl method createArrivalAndDepartureQuery.
protected ArrivalAndDepartureQuery createArrivalAndDepartureQuery(ArrivalAndDepartureForStopQueryBean query) {
ArrivalAndDepartureQuery adQuery = new ArrivalAndDepartureQuery();
AgencyAndId stopId = AgencyAndIdLibrary.convertFromString(query.getStopId());
StopEntry stop = _transitGraphDao.getStopEntryForId(stopId, true);
AgencyAndId tripId = AgencyAndIdLibrary.convertFromString(query.getTripId());
TripEntry trip = _transitGraphDao.getTripEntryForId(tripId);
if (trip == null)
throw new NoSuchTripServiceException(query.getTripId());
adQuery.setStop(stop);
adQuery.setStopSequence(query.getStopSequence());
adQuery.setTrip(trip);
adQuery.setServiceDate(query.getServiceDate());
adQuery.setVehicleId(AgencyAndIdLibrary.convertFromString(query.getVehicleId()));
adQuery.setTime(query.getTime());
return adQuery;
}
use of org.onebusaway.exceptions.NoSuchTripServiceException in project onebusaway-application-modules by camsys.
the class TripAction method execute.
@Override
@Actions({ @Action(value = "/where/trip"), @Action(value = "/where/iphone/trip") })
public String execute() throws ServiceException {
if (_id == null)
return INPUT;
if (_time == null)
_time = new Date();
TripDetailsQueryBean query = new TripDetailsQueryBean();
query.setTripId(_id);
if (_serviceDate != null)
query.setServiceDate(_serviceDate.getTime());
query.setVehicleId(_vehicleId);
query.setTime(_time.getTime());
_tripDetails = _service.getSingleTripDetails(query);
if (_tripDetails == null)
throw new NoSuchTripServiceException(_id);
TripStopTimesBean stopTimes = _tripDetails.getSchedule();
_timeZone = TimeZone.getTimeZone(stopTimes.getTimeZone());
_actualServiceDate = getActualServiceDate();
return SUCCESS;
}
Aggregations