use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.
the class RealtimeServiceV2Impl method getServiceAlertsGlobal.
/**
* Returns true if there are vehicles in service for given route+direction
* that will stop at the indicated stop in the future.
*/
/* These methods were used in nyc branch. Not used here so far.
@Override
public boolean getVehiclesInServiceForStopAndRoute(String stopId,
String routeId, long currentTime) {
for (ArrivalAndDepartureBean adBean : getArrivalsAndDeparturesForStop(
stopId, currentTime)) {
TripStatusBean statusBean = adBean.getTripStatus();
if (!_presentationService.include(statusBean)
|| !_presentationService.include(adBean, statusBean))
continue;
// filtered out by user
if (routeId != null
&& !adBean.getTrip().getRoute().getId().equals(routeId))
continue;
return true;
}
return false;
}
*/
/**
* SERVICE ALERTS METHODS
*/
/*
@Override
public List<ServiceAlertBean> getServiceAlertsForRoute(String routeId) {
return getServiceAlertsForRouteAndDirection(routeId, null);
}
@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 = _nycTransitDataService
.getServiceAlerts(query);
return serviceAlerts.getList();
}
*/
@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();
}
use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.
the class ServiceAlertsHelperV2 method addFromQuery.
private void addFromQuery(TransitDataService transitDataService, Map<String, PtSituationElementStructure> ptSituationElements, SituationQueryBean queryBean) {
ListBean<ServiceAlertBean> serviceAlerts = transitDataService.getServiceAlerts(queryBean);
ServiceAlertsHelperV2 helper = new ServiceAlertsHelperV2();
for (ServiceAlertBean bean : serviceAlerts.getList()) {
PtSituationElementStructure ptSit = helper.getServiceAlertBeanAsPtSituationElementStructure(bean);
ptSituationElements.put(ptSit.getSituationNumber().getValue(), ptSit);
}
}
use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.
the class ServiceAlertsHelperV2 method addSituationExchangeToServiceDelivery.
public void addSituationExchangeToServiceDelivery(ServiceDelivery serviceDelivery, Collection<ServiceAlertBean> serviceAlerts) {
Situations situations = new Situations();
for (ServiceAlertBean serviceAlert : serviceAlerts) {
situations.getPtSituationElement().add(getServiceAlertBeanAsPtSituationElementStructure(serviceAlert));
}
if (situations.getPtSituationElement().size() > 0) {
SituationExchangeDeliveryStructure situationExchangeDelivery = new SituationExchangeDeliveryStructure();
situationExchangeDelivery.setSituations(situations);
serviceDelivery.getSituationExchangeDelivery().add(situationExchangeDelivery);
}
}
use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.
the class ServiceAlertsHelperV2 method addSituationElement.
/*
public void addSituationExchangeToServiceDelivery(ServiceDelivery serviceDelivery,
Map<String, ServiceAlertBean> currentServiceAlerts) {
addSituationExchangeToServiceDelivery(serviceDelivery, currentServiceAlerts.values());
}
public void addClosedSituationExchangesToSiri(
ServiceDelivery serviceDelivery, Collection<String> deletedIds) {
Map<String, PtSituationElementStructure> ptSituationElements = new HashMap<String, PtSituationElementStructure>();
for (String id : deletedIds) {
PtSituationElementStructure ptSit = new PtSituationElementStructure();
EntryQualifierStructure value = new EntryQualifierStructure();
value.setValue(id);
ptSit.setSituationNumber(value);
ptSit.setProgress(WorkflowStatusEnumeration.CLOSED);
ptSituationElements.put(id, ptSit);
}
addPtSituationElementsToServiceDelivery(serviceDelivery,
ptSituationElements);
}
*/
private void addSituationElement(TransitDataService transitDataService, Map<String, PtSituationElementStructure> ptSituationElements, List<SituationRefStructure> situationRefs) {
if (situationRefs == null)
return;
for (SituationRefStructure situationRef : situationRefs) {
String situationId = situationRef.getSituationSimpleRef().getValue();
ServiceAlertBean serviceAlert = transitDataService.getServiceAlertForId(situationId);
PtSituationElementStructure e = getServiceAlertBeanAsPtSituationElementStructure(serviceAlert);
ptSituationElements.put(situationId, e);
}
}
use of org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean in project onebusaway-application-modules by camsys.
the class SiriSupportV2 method fillSituations.
private static void fillSituations(MonitoredVehicleJourneyStructure monitoredVehicleJourney, TripStatusBean tripStatus) {
if (tripStatus == null || tripStatus.getSituations() == null || tripStatus.getSituations().isEmpty()) {
return;
}
List<SituationRefStructure> situationRef = monitoredVehicleJourney.getSituationRef();
for (ServiceAlertBean situation : tripStatus.getSituations()) {
SituationRefStructure sitRef = new SituationRefStructure();
SituationSimpleRefStructure sitSimpleRef = new SituationSimpleRefStructure();
sitSimpleRef.setValue(situation.getId());
sitRef.setSituationSimpleRef(sitSimpleRef);
situationRef.add(sitRef);
}
}
Aggregations