Search in sources :

Example 36 with ServiceAlertBean

use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.

the class SituationsPresentation method getReadSituations.

public List<ServiceAlertBean> getReadSituations() {
    List<ServiceAlertBean> situations = new ArrayList<ServiceAlertBean>();
    Map<String, Long> readServiceAlerts = _user.getReadServiceAlerts();
    for (ServiceAlertBean situation : _situations) {
        if (readServiceAlerts.containsKey(situation.getId()))
            situations.add(situation);
    }
    Collections.sort(situations, _comparator);
    return situations;
}
Also used : ArrayList(java.util.ArrayList) ServiceAlertBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)

Example 37 with ServiceAlertBean

use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.

the class SituationsPresentation method getUnreadSituations.

public List<ServiceAlertBean> getUnreadSituations() {
    List<ServiceAlertBean> situations = new ArrayList<ServiceAlertBean>();
    Map<String, Long> readServiceAlerts = _user.getReadServiceAlerts();
    for (ServiceAlertBean situation : _situations) {
        if (isSituationUnread(readServiceAlerts, situation))
            situations.add(situation);
    }
    Collections.sort(situations, _comparator);
    return situations;
}
Also used : ArrayList(java.util.ArrayList) ServiceAlertBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)

Example 38 with ServiceAlertBean

use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.

the class RealtimeServiceImpl method getServiceAlertsGlobal.

@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();
}
Also used : SituationQueryBean(org.onebusaway.transit_data.model.service_alerts.SituationQueryBean) ServiceAlertBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)

Example 39 with ServiceAlertBean

use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.

the class ArrivalsAndDeparturesAction method getServiceAlertsForStopRoute.

private List<ServiceAlertBean> getServiceAlertsForStopRoute(String stopId, String routeId) {
    SituationQueryBean query = new SituationQueryBean();
    SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean();
    query.getAffects().add(affects);
    affects.setStopId(stopId);
    affects.setRouteId(routeId);
    ListBean<ServiceAlertBean> alerts = _transitDataService.getServiceAlerts(query);
    if (alerts != null) {
        return alerts.getList();
    }
    return Collections.emptyList();
}
Also used : SituationQueryBean(org.onebusaway.transit_data.model.service_alerts.SituationQueryBean) ServiceAlertBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)

Example 40 with ServiceAlertBean

use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.

the class ArrivalsAndDeparturesAction method getServiceAlertsForStop.

private List<ServiceAlertBean> getServiceAlertsForStop(String stopId) {
    SituationQueryBean query = new SituationQueryBean();
    SituationQueryBean.AffectsBean affects = new SituationQueryBean.AffectsBean();
    query.getAffects().add(affects);
    affects.setStopId(stopId);
    ListBean<ServiceAlertBean> alerts = _transitDataService.getServiceAlerts(query);
    if (alerts != null) {
        return alerts.getList();
    }
    return Collections.emptyList();
}
Also used : SituationQueryBean(org.onebusaway.transit_data.model.service_alerts.SituationQueryBean) ServiceAlertBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)

Aggregations

ServiceAlertBean (org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)54 ArrayList (java.util.ArrayList)22 SituationQueryBean (org.onebusaway.transit_data.model.service_alerts.SituationQueryBean)11 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)8 StopBean (org.onebusaway.transit_data.model.StopBean)8 SituationAffectsBean (org.onebusaway.transit_data.model.service_alerts.SituationAffectsBean)8 HashMap (java.util.HashMap)7 List (java.util.List)5 RouteBean (org.onebusaway.transit_data.model.RouteBean)5 TripBean (org.onebusaway.transit_data.model.trips.TripBean)5 Test (org.junit.Test)4 NaturalLanguageStringBean (org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean)4 TripStatusBean (org.onebusaway.transit_data.model.trips.TripStatusBean)4 PtSituationElementStructure (uk.org.siri.siri.PtSituationElementStructure)4 PtSituationElementStructure (uk.org.siri.siri_2.PtSituationElementStructure)4 HashSet (java.util.HashSet)3 ArrivalAndDepartureBean (org.onebusaway.transit_data.model.ArrivalAndDepartureBean)3 StopsForRouteBean (org.onebusaway.transit_data.model.StopsForRouteBean)3 BlockTripBean (org.onebusaway.transit_data.model.blocks.BlockTripBean)3 TimeRangeBean (org.onebusaway.transit_data.model.service_alerts.TimeRangeBean)3