Search in sources :

Example 1 with DisplayRoute

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

the class RouteListAction method getModel.

@Override
public Body<DisplayRoute> getModel() {
    Body<DisplayRoute> body = new Body<DisplayRoute>();
    if (isValid(body)) {
        List<RouteBean> routeBeans = _transitDataService.getRoutesForAgencyId(agencyId).getList();
        Collections.sort(routeBeans, new Comparator<RouteBean>() {

            AlphanumComparator alphaComparator = new AlphanumComparator();

            public int compare(RouteBean arg0, RouteBean arg1) {
                return alphaComparator.compare(arg0.getId(), arg1.getId());
            }
        });
        for (RouteBean routeBean : routeBeans) {
            DisplayRoute route = new DisplayRoute();
            route.setTag(getIdNoAgency(routeBean.getId()));
            route.setTitle(routeBean.getShortName() + " " + routeBean.getLongName());
            body.getResponse().add(route);
        }
    }
    return body;
}
Also used : RouteBean(org.onebusaway.transit_data.model.RouteBean) AlphanumComparator(org.onebusaway.util.comparators.AlphanumComparator) Body(org.onebusaway.nextbus.model.nextbus.Body) DisplayRoute(org.onebusaway.nextbus.model.nextbus.DisplayRoute)

Aggregations

Body (org.onebusaway.nextbus.model.nextbus.Body)1 DisplayRoute (org.onebusaway.nextbus.model.nextbus.DisplayRoute)1 RouteBean (org.onebusaway.transit_data.model.RouteBean)1 AlphanumComparator (org.onebusaway.util.comparators.AlphanumComparator)1