use of org.onebusaway.transit_data.model.service_alerts.SituationQueryBean in project onebusaway-application-modules by camsys.
the class MessagesAction method getAllSituations.
private ListBean<ServiceAlertBean> getAllSituations(String agencyId, String routeId) {
SituationQueryBean query = new SituationQueryBean();
SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean();
query.getAffects().add(affects);
affects.setRouteId(routeId);
return _transitDataService.getServiceAlerts(query);
}
use of org.onebusaway.transit_data.model.service_alerts.SituationQueryBean in project onebusaway-application-modules by camsys.
the class ServiceAlertsHelperV2 method addSituationExchangeToServiceDelivery.
/*
public void addSituationExchangeToServiceDelivery(ServiceDelivery serviceDelivery,
List<VehicleActivityStructure> activities,
TransitDataService transitDataService) {
addSituationExchangeToServiceDelivery(serviceDelivery, activities, transitDataService, null);
}
*/
public void addSituationExchangeToServiceDelivery(ServiceDelivery serviceDelivery, List<VehicleActivityStructure> activities, TransitDataService transitDataService, List<AgencyAndId> routeIds) {
if (activities == null)
return;
Map<String, PtSituationElementStructure> ptSituationElements = new HashMap<String, PtSituationElementStructure>();
for (VehicleActivityStructure activity : activities) {
if (activity.getMonitoredVehicleJourney() != null) {
addSituationElement(transitDataService, ptSituationElements, activity.getMonitoredVehicleJourney().getSituationRef());
}
}
addPtSituationElementsToServiceDelivery(serviceDelivery, ptSituationElements);
if (routeIds == null)
return;
List<ServiceAlertBean> serviceAlerts = new ArrayList<ServiceAlertBean>();
for (AgencyAndId routeId : routeIds) {
SituationQueryBean query = new SituationQueryBean();
SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean();
query.getAffects().add(affects);
affects.setRouteId(routeId.toString());
ListBean<ServiceAlertBean> serviceAlertsForRoute = transitDataService.getServiceAlerts(query);
if (serviceAlertsForRoute != null) {
serviceAlerts.addAll(serviceAlertsForRoute.getList());
}
}
if (serviceAlerts.size() == 0)
return;
addSituationExchangeToServiceDelivery(serviceDelivery, serviceAlerts);
}
use of org.onebusaway.transit_data.model.service_alerts.SituationQueryBean in project onebusaway-application-modules by camsys.
the class ArrivalsAndDeparturesAction method getServiceAlertsForRoute.
private List<ServiceAlertBean> getServiceAlertsForRoute(String routeId) {
SituationQueryBean query = new SituationQueryBean();
SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean();
query.getAffects().add(affects);
affects.setRouteId(routeId);
ListBean<ServiceAlertBean> alerts = _transitDataService.getServiceAlerts(query);
if (alerts != null) {
return alerts.getList();
}
return Collections.emptyList();
}
use of org.onebusaway.transit_data.model.service_alerts.SituationQueryBean 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;
}
use of org.onebusaway.transit_data.model.service_alerts.SituationQueryBean in project onebusaway-application-modules by camsys.
the class ServiceAlertsHelper method addSituationExchangeToServiceDelivery.
public void addSituationExchangeToServiceDelivery(ServiceDelivery serviceDelivery, List<VehicleActivityStructure> activities, TransitDataService transitDataService, List<AgencyAndId> routeIds) {
if (activities == null)
return;
Map<String, PtSituationElementStructure> ptSituationElements = new HashMap<String, PtSituationElementStructure>();
for (VehicleActivityStructure activity : activities) {
if (activity.getMonitoredVehicleJourney() != null) {
addSituationElement(transitDataService, ptSituationElements, activity.getMonitoredVehicleJourney().getSituationRef());
}
}
addPtSituationElementsToServiceDelivery(serviceDelivery, ptSituationElements);
if (routeIds == null)
return;
List<ServiceAlertBean> serviceAlerts = new ArrayList<ServiceAlertBean>();
for (AgencyAndId routeId : routeIds) {
SituationQueryBean query = new SituationQueryBean();
SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean();
query.getAffects().add(affects);
affects.setRouteId(routeId.toString());
ListBean<ServiceAlertBean> serviceAlertsForRoute = transitDataService.getServiceAlerts(query);
if (serviceAlertsForRoute != null) {
serviceAlerts.addAll(serviceAlertsForRoute.getList());
}
}
if (serviceAlerts.size() == 0)
return;
addSituationExchangeToServiceDelivery(serviceDelivery, serviceAlerts);
}
Aggregations