private void handleStopGroupBean(String stopIdString, SituationQueryBean query, RouteBean route, StopGroupBean stopGroup) { List<StopGroupBean> subGroups = stopGroup.getSubGroups(); if (subGroups != null && !subGroups.isEmpty()) { for (StopGroupBean stopSubGroup : subGroups) { handleStopGroupBean(stopIdString, query, route, stopSubGroup); } } String direction = stopGroup.getId(); for (String groupStopId : stopGroup.getStopIds()) { if (groupStopId.equals(stopIdString)) { SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean(); query.getAffects().add(affects); affects.setRouteId(route.getId()); affects.setDirectionId(direction); } } }
@Override public List<ServiceAlertBean> getServiceAlertsForRouteAndDirection( String routeId, String directionId) { SituationQueryBean query = new SituationQueryBean(); SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean(); query.getAffects().add(affects); affects.setRouteId(routeId); if (directionId != null) { affects.setDirectionId(directionId); } else { /* * TODO * The route index is not currently being populated correctly; query by route and direction, * and supply both directions if not present */ SituationQueryBean.AffectsBean affects1 = new SituationQueryBean.AffectsBean(); query.getAffects().add(affects1); affects1.setRouteId(routeId); affects1.setDirectionId("0"); SituationQueryBean.AffectsBean affects2 = new SituationQueryBean.AffectsBean(); query.getAffects().add(affects2); affects2.setRouteId(routeId); affects2.setDirectionId("1"); } ListBean<ServiceAlertBean> serviceAlerts = _transitDataService.getServiceAlerts(query); return serviceAlerts.getList(); }