Search in sources :

Example 1 with TripDetailsV2Bean

use of org.onebusaway.api.model.transit.TripDetailsV2Bean in project onebusaway-application-modules by camsys.

the class TripDetailsAction method show.

public DefaultHttpHeaders show() throws ServiceException {
    if (!isVersion(V2))
        return setUnknownVersionResponse();
    if (hasErrors())
        return setValidationErrorsResponse();
    TripDetailsQueryBean query = new TripDetailsQueryBean();
    query.setTripId(_id);
    if (_serviceDate != null)
        query.setServiceDate(_serviceDate.getTime());
    query.setTime(_time.getTime());
    query.setVehicleId(_vehicleId);
    TripDetailsInclusionBean inclusion = query.getInclusion();
    inclusion.setIncludeTripBean(_includeTrip);
    inclusion.setIncludeTripSchedule(_includeSchedule);
    inclusion.setIncludeTripStatus(_includeStatus);
    TripDetailsBean trip = _service.getSingleTripDetails(query);
    if (trip == null)
        return setResourceNotFoundResponse();
    BeanFactoryV2 factory = getBeanFactoryV2();
    EntryWithReferencesBean<TripDetailsV2Bean> response = factory.getResponse(trip);
    return setOkResponse(response);
}
Also used : TripDetailsV2Bean(org.onebusaway.api.model.transit.TripDetailsV2Bean) TripDetailsQueryBean(org.onebusaway.transit_data.model.trips.TripDetailsQueryBean) TripDetailsInclusionBean(org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean) TripDetailsBean(org.onebusaway.transit_data.model.trips.TripDetailsBean) BeanFactoryV2(org.onebusaway.api.model.transit.BeanFactoryV2)

Example 2 with TripDetailsV2Bean

use of org.onebusaway.api.model.transit.TripDetailsV2Bean in project onebusaway-application-modules by camsys.

the class TripForVehicleAction method show.

public DefaultHttpHeaders show() throws ServiceException {
    if (!isVersion(V2))
        return setUnknownVersionResponse();
    if (hasErrors())
        return setValidationErrorsResponse();
    TripForVehicleQueryBean query = new TripForVehicleQueryBean();
    query.setVehicleId(_id);
    query.setTime(_time);
    TripDetailsInclusionBean inclusion = query.getInclusion();
    inclusion.setIncludeTripBean(_includeTrip);
    inclusion.setIncludeTripSchedule(_includeSchedule);
    inclusion.setIncludeTripStatus(_includeStatus);
    TripDetailsBean trip = _service.getTripDetailsForVehicleAndTime(query);
    if (trip == null)
        return setResourceNotFoundResponse();
    BeanFactoryV2 factory = getBeanFactoryV2();
    EntryWithReferencesBean<TripDetailsV2Bean> response = factory.getResponse(trip);
    return setOkResponse(response);
}
Also used : TripForVehicleQueryBean(org.onebusaway.transit_data.model.trips.TripForVehicleQueryBean) TripDetailsV2Bean(org.onebusaway.api.model.transit.TripDetailsV2Bean) TripDetailsInclusionBean(org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean) TripDetailsBean(org.onebusaway.transit_data.model.trips.TripDetailsBean) BeanFactoryV2(org.onebusaway.api.model.transit.BeanFactoryV2)

Aggregations

BeanFactoryV2 (org.onebusaway.api.model.transit.BeanFactoryV2)2 TripDetailsV2Bean (org.onebusaway.api.model.transit.TripDetailsV2Bean)2 TripDetailsBean (org.onebusaway.transit_data.model.trips.TripDetailsBean)2 TripDetailsInclusionBean (org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean)2 TripDetailsQueryBean (org.onebusaway.transit_data.model.trips.TripDetailsQueryBean)1 TripForVehicleQueryBean (org.onebusaway.transit_data.model.trips.TripForVehicleQueryBean)1