use of org.onebusaway.nextbus.model.transiTime.ScheduleRoute in project onebusaway-application-modules by camsys.
the class ScheduleHorizAction method getModel.
public Body<List<ScheduleRoute>> getModel() {
Body<List<ScheduleRoute>> body = new Body<List<ScheduleRoute>>();
List<AgencyAndId> routeIds = new ArrayList<AgencyAndId>();
if (isValid(body, routeIds)) {
String serviceUrl = getServiceUrl() + agencyId + SCHEDULE_COMMAND + "?";
String route = "r=" + getIdNoAgency(routeId);
String uri = serviceUrl + route + "&format=" + REQUEST_TYPE;
try {
int timeout = _configUtil.getHttpTimeoutSeconds();
JsonArray scheduleJson = _httpUtil.getJsonObject(uri, timeout).getAsJsonArray("schedule");
Type listType = new TypeToken<List<ScheduleRoute>>() {
}.getType();
List<ScheduleRoute> schedules = new Gson().fromJson(scheduleJson, listType);
modifyJSONObject(schedules);
body.getResponse().add(schedules);
} catch (Exception e) {
_log.error(e.getMessage());
}
}
return body;
}
Aggregations