@Override public Object invoke(FederatedServiceCollection collection, Method method, Object[] args) throws ServiceException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { if (args.length == 0) { throw new ServiceException("unexpected number of arguments"); } SituationQueryBean query = (SituationQueryBean) args[0]; Set<String> agencyIds = new HashSet<String>(); if (query.getAffects() != null) { for (SituationQueryBean.AffectsBean affects : query.getAffects()) { if (affects.getAgencyId() != null) { agencyIds.add(affects.getAgencyId()); } addAgencyId(affects.getRouteId(), agencyIds); addAgencyId(affects.getTripId(), agencyIds); addAgencyId(affects.getStopId(), agencyIds); } } FederatedService service = collection.getServiceForAgencyIds(agencyIds); return method.invoke(service, args); }
SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean(); query.getAffects().add(affects); affects.setRouteId(routeId.toString()); ListBean<ServiceAlertBean> serviceAlertsForRoute = transitDataService.getServiceAlerts(query); if (serviceAlertsForRoute != null) {
@Override public List<ServiceAlertBean> getServiceAlertsGlobal() { SituationQueryBean query = new SituationQueryBean(); SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean(); affects.setAgencyId("__ALL_OPERATORS__"); query.getAffects().add(affects); ListBean<ServiceAlertBean> serviceAlerts = _transitDataService.getServiceAlerts(query); return serviceAlerts.getList(); }
for (SituationQueryBean.AffectsBean affects : query.getAffects()) { AgencyAndId routeId = AgencyAndId.convertFromString(affects.getRouteId()); AgencyAndId tripId = AgencyAndId.convertFromString(affects.getTripId()); AgencyAndId stopId = AgencyAndId.convertFromString(affects.getStopId()); AffectsType type = getAffectsType(affects.getAgencyId(), affects.getRouteId(), affects.getDirectionId(), affects.getTripId(), affects.getStopId()); switch (type) { case AGENCY: { affects.getAgencyId(), serviceAlertIds); break; routeId, affects.getDirectionId()); getServiceAlertIdsForKey(_cache.getServiceAlertIdsByRouteAndDirectionId(), routeAndDirectionRef, serviceAlertIds); routeId, affects.getDirectionId(), stopId); getServiceAlertIdsForKey(_cache.getServiceAlertIdsByRouteDirectionAndStopCall(), ref, serviceAlertIds);
List<String> stopIdStrings = new ArrayList<String>(); stopIdStrings.add(stopIdString); SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean(); query.getAffects().add(affects); affects.setStopId(stopIdString);
@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(); }
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); } } }
/** * SERVICE ALERTS METHODS */ @Override public List<ServiceAlertBean> getServiceAlertsForAgency(String agencyId) { SituationQueryBean query = new SituationQueryBean(); SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean(); query.getAffects().add(affects); affects.setAgencyId(agencyId); ListBean<ServiceAlertBean> serviceAlerts = _transitDataService.getServiceAlerts(query); return serviceAlerts.getList(); }