use of org.onebusaway.exceptions.NoSuchStopServiceException in project onebusaway-application-modules by camsys.
the class ScheduleAction method execute.
@Override
@Actions({ @Action(value = "/where/schedule") })
public String execute() throws Exception {
if (_date == null)
_date = new Date();
if (_id == null)
return INPUT;
_result = _service.getScheduleForStop(_id, _date);
if (_result == null)
throw new NoSuchStopServiceException(_id);
StopCalendarDaysBean days = _result.getCalendarDays();
String tzName = days.getTimeZone();
_timeZone = TimeZone.getTimeZone(tzName);
if (_timeZone == null)
_timeZone = TimeZone.getDefault();
filterResults();
return SUCCESS;
}
use of org.onebusaway.exceptions.NoSuchStopServiceException in project onebusaway-application-modules by camsys.
the class NameBasedNotificationStrategyImpl method summarizeStop.
@Override
public String summarizeStop(String stopIdStr) {
// return the stop name
try {
AgencyAndId routeId = AgencyAndIdLibrary.convertFromString(stopIdStr);
StopBean stop = _tds.getStop(routeId.toString());
if (stop == null || stop.getName() == null)
return stopIdStr;
return stop.getName();
} catch (IllegalStateException ise) {
// invalid id -- return it as is
return stopIdStr;
} catch (NoSuchStopServiceException nsse) {
// something went wrong
_log.error("couldn't find stop for stopId=|" + stopIdStr + "|");
return stopIdStr;
}
}
use of org.onebusaway.exceptions.NoSuchStopServiceException in project onebusaway-application-modules by camsys.
the class UserReportingServiceImpl method getRecordAsBean.
private StopProblemReportBean getRecordAsBean(StopProblemReportRecord record) {
AgencyAndId stopId = record.getStopId();
StopProblemReportBean bean = new StopProblemReportBean();
bean.setCode(record.getCode());
bean.setId(record.getId());
bean.setStatus(record.getStatus());
bean.setStopId(AgencyAndIdLibrary.convertToString(stopId));
bean.setTime(record.getTime());
bean.setUserComment(record.getUserComment());
if (record.getUserLat() != null)
bean.setUserLat(record.getUserLat());
if (record.getUserLon() != null)
bean.setUserLon(record.getUserLon());
if (record.getUserLocationAccuracy() != null)
bean.setUserLocationAccuracy(record.getUserLocationAccuracy());
if (stopId != null) {
try {
bean.setStop(_stopBeanService.getStopForId(stopId));
} catch (NoSuchStopServiceException ex) {
}
}
return bean;
}
use of org.onebusaway.exceptions.NoSuchStopServiceException in project onebusaway-application-modules by camsys.
the class UserReportingServiceImpl method getRecordAsBean.
private TripProblemReportBean getRecordAsBean(TripProblemReportRecord record) {
AgencyAndId stopId = record.getStopId();
AgencyAndId tripId = record.getTripId();
TripProblemReportBean bean = new TripProblemReportBean();
bean.setCode(record.getCode());
bean.setId(record.getId());
bean.setServiceDate(record.getServiceDate());
bean.setStatus(record.getStatus());
bean.setLabel(record.getLabel());
bean.setStopId(AgencyAndIdLibrary.convertToString(stopId));
bean.setTime(record.getTime());
bean.setTripId(AgencyAndIdLibrary.convertToString(tripId));
bean.setUserComment(record.getUserComment());
bean.setUserLat(record.getUserLat());
bean.setUserLon(record.getUserLon());
bean.setUserLocationAccuracy(record.getUserLocationAccuracy());
bean.setUserOnVehicle(record.isUserOnVehicle());
bean.setUserVehicleNumber(record.getUserVehicleNumber());
bean.setPredicted(record.isPredicted());
bean.setVehicleId(AgencyAndIdLibrary.convertToString(record.getVehicleId()));
bean.setDistanceAlongBlock(record.getDistanceAlongBlock());
bean.setScheduleDeviation(record.getScheduleDeviation());
bean.setVehicleLat(record.getVehicleLat());
bean.setVehicleLon(record.getVehicleLon());
if (stopId != null) {
try {
bean.setStop(_stopBeanService.getStopForId(stopId));
} catch (NoSuchStopServiceException ex) {
}
}
if (tripId != null) {
bean.setTrip(_tripBeanService.getTripForId(tripId));
}
if (tripId != null && stopId != null) {
TripEntry trip = _graph.getTripEntryForId(tripId);
StopEntry stop = _graph.getStopEntryForId(stopId);
if (trip != null && stop != null) {
AgencyAndId vehicleId = record.getMatchedVehicleId();
if (vehicleId == null)
vehicleId = record.getVehicleId();
ArrivalAndDepartureQuery query = new ArrivalAndDepartureQuery();
query.setStop(stop);
query.setStopSequence(-1);
query.setTrip(trip);
query.setServiceDate(record.getServiceDate());
query.setVehicleId(vehicleId);
query.setTime(record.getTime());
ArrivalAndDepartureInstance instance = _arrivalAndDepartureService.getArrivalAndDepartureForStop(query);
if (instance != null) {
StopTimeInstance sti = instance.getStopTimeInstance();
StopTimeInstanceBean stopTimeBean = _stopTimeBeanService.getStopTimeInstanceAsBean(sti);
bean.setStopTime(stopTimeBean);
}
}
}
return bean;
}
use of org.onebusaway.exceptions.NoSuchStopServiceException in project onebusaway-application-modules by camsys.
the class StopBeanServiceImpl method getStopForId.
@Cacheable
public StopBean getStopForId(AgencyAndId id) {
StopEntry stop = _transitGraphDao.getStopEntryForId(id);
StopNarrative narrative = _narrativeService.getStopForId(id);
if (stop == null) {
// try looking up consolidated id
AgencyAndId consolidatedId = _consolidatedStopsService.getConsolidatedStopIdForHiddenStopId(id);
if (consolidatedId != null)
return getStopForId(consolidatedId);
throw new NoSuchStopServiceException(AgencyAndIdLibrary.convertToString(id));
}
StopBean sb = new StopBean();
fillStopBean(stop, narrative, sb);
fillRoutesForStopBean(stop, sb);
return sb;
}
Aggregations