use of org.onebusaway.transit_data.model.service_alerts.SituationQueryBean.AffectsBean in project onebusaway-application-modules by camsys.
the class StatusProviderImpl method getAgencyServiceAlertStatus.
@Override
public StatusGroup getAgencyServiceAlertStatus() {
StatusGroup group = new StatusGroup();
group.setTitle("Agency Advisories");
group.setScope("Schedule and real-time availability at the agency level");
group.setSource("Sound Transit administrators -- manual entry");
List<AgencyWithCoverageBean> agencies = _transitDataService.getAgenciesWithCoverage();
for (AgencyWithCoverageBean agency : agencies) {
String agencyId = agency.getAgency().getId();
String agencyName = agency.getAgency().getName();
// Use query to limit to agency and no other parameters
SituationQueryBean query = new SituationQueryBean();
AffectsBean ab = new AffectsBean();
ab.setAgencyId(agencyId);
query.setAffects(Collections.singletonList(ab));
ListBean<ServiceAlertBean> alerts = _transitDataService.getServiceAlerts(query);
List<ServiceAlertBean> beans = filterByTime(alerts.getList(), System.currentTimeMillis());
for (ServiceAlertBean bean : beans) {
StatusItem item = new StatusItem();
item.setDescription(bean.getDescriptions().get(0).getValue());
item.setTitle(agencyName + ": " + bean.getSummaries().get(0).getValue());
item.setStatus(StatusItem.Status.ALERT);
group.addItem(item);
}
}
return group;
}
Aggregations