Search in sources :

Example 1 with Agency

use of org.onebusaway.nextbus.model.nextbus.Agency in project onebusaway-application-modules by camsys.

the class AgencyListAction method getModel.

@Override
public Body<Agency> getModel() {
    Body<Agency> body = new Body<Agency>();
    try {
        List<AgencyWithCoverageBean> agencies = _service.getAgenciesWithCoverage();
        for (AgencyWithCoverageBean agencyBean : agencies) {
            Agency agency = new Agency();
            agency.setTag(agencyBean.getAgency().getId());
            agency.setTitle(agencyBean.getAgency().getName());
            agency.setRegionTitle(agencyBean.getAgency().getName());
            body.getResponse().add(agency);
        }
    } catch (ServiceException e) {
        body.getErrors().add(new BodyError(ErrorMsg.SERVICE_ERROR.getDescription()));
    }
    return body;
}
Also used : Agency(org.onebusaway.nextbus.model.nextbus.Agency) ServiceException(org.onebusaway.exceptions.ServiceException) BodyError(org.onebusaway.nextbus.model.nextbus.BodyError) AgencyWithCoverageBean(org.onebusaway.transit_data.model.AgencyWithCoverageBean) Body(org.onebusaway.nextbus.model.nextbus.Body)

Aggregations

ServiceException (org.onebusaway.exceptions.ServiceException)1 Agency (org.onebusaway.nextbus.model.nextbus.Agency)1 Body (org.onebusaway.nextbus.model.nextbus.Body)1 BodyError (org.onebusaway.nextbus.model.nextbus.BodyError)1 AgencyWithCoverageBean (org.onebusaway.transit_data.model.AgencyWithCoverageBean)1