public StopWithArrivalsAndDeparturesV2Bean getStopWithArrivalAndDepartures( StopWithArrivalsAndDeparturesBean sad) { StopWithArrivalsAndDeparturesV2Bean bean = new StopWithArrivalsAndDeparturesV2Bean(); bean.setStopId(sad.getStop().getId()); addToReferences(sad.getStop()); List<ArrivalAndDepartureV2Bean> ads = new ArrayList<ArrivalAndDepartureV2Bean>(); for (ArrivalAndDepartureBean ad : sad.getArrivalsAndDepartures()) ads.add(getArrivalAndDeparture(ad)); bean.setArrivalsAndDepartures(ads); List<String> nearbyStopIds = new ArrayList<String>(); for (StopBean nearbyStop : sad.getNearbyStops()) { nearbyStopIds.add(nearbyStop.getId()); addToReferences(nearbyStop); } bean.setNearbyStopIds(nearbyStopIds); List<ServiceAlertBean> situations = sad.getSituations(); if (!CollectionsLibrary.isEmpty(situations)) { List<String> situationIds = new ArrayList<String>(); for (ServiceAlertBean situation : situations) { addToReferences(situation); situationIds.add(situation.getId()); } bean.setSituationIds(situationIds); } return bean; }
public StopWithArrivalsAndDeparturesBean getArrivalsAndDeparturesByStopId( AgencyAndId id, ArrivalsAndDeparturesQueryBean query) { StopBean stop = _stopBeanService.getStopForId(id); if (stop == null) return null; List<ArrivalAndDepartureBean> arrivalsAndDepartures = _arrivalsAndDeparturesBeanService.getArrivalsAndDeparturesByStopId( id, query); List<AgencyAndId> nearbyStopIds = _nearbyStopsBeanService.getNearbyStops( stop, 100); List<StopBean> nearbyStops = new ArrayList<StopBean>(); for (AgencyAndId nearbyStopId : nearbyStopIds) nearbyStops.add(_stopBeanService.getStopForId(nearbyStopId)); List<SituationBean> situations = _serviceAlertsBeanService.getSituationsForStopId( query.getTime(), id); return new StopWithArrivalsAndDeparturesBean(stop, arrivalsAndDepartures, nearbyStops, situations); }
private List<ArrivalAndDepartureBean> getArrivalsAndDeparturesForStop(String stopId, long currentTime) { ArrivalsAndDeparturesQueryBean query = new ArrivalsAndDeparturesQueryBean(); query.setTime(currentTime); query.setMinutesBefore(5); query.setMinutesAfter(65); StopWithArrivalsAndDeparturesBean stopWithArrivalsAndDepartures = _transitDataService.getStopWithArrivalsAndDepartures(stopId, query); return stopWithArrivalsAndDepartures.getArrivalsAndDepartures(); }
List<ArrivalAndDepartureBean> arrivalsAndDepartures = stopWithArrivalsAndDepartures.getArrivalsAndDepartures();
public StopWithArrivalsAndDeparturesV2Bean getStopWithArrivalAndDepartures( StopWithArrivalsAndDeparturesBean sad) { StopWithArrivalsAndDeparturesV2Bean bean = new StopWithArrivalsAndDeparturesV2Bean(); bean.setStopId(sad.getStop().getId()); addToReferences(sad.getStop()); List<ArrivalAndDepartureV2Bean> ads = new ArrayList<ArrivalAndDepartureV2Bean>(); for (ArrivalAndDepartureBean ad : sad.getArrivalsAndDepartures()) ads.add(getArrivalAndDeparture(ad)); bean.setArrivalsAndDepartures(ads); List<String> nearbyStopIds = new ArrayList<String>(); for (StopBean nearbyStop : sad.getNearbyStops()) { nearbyStopIds.add(nearbyStop.getId()); addToReferences(nearbyStop); } bean.setNearbyStopIds(nearbyStopIds); List<ServiceAlertBean> situations = sad.getSituations(); if (!CollectionsLibrary.isEmpty(situations)) { List<String> situationIds = new ArrayList<String>(); for (ServiceAlertBean situation : situations) { addToReferences(situation); situationIds.add(situation.getId()); } bean.setSituationIds(situationIds); } return bean; }
StopWithArrivalsAndDeparturesBean result = transitDataService.getStopWithArrivalsAndDepartures(stop.getId(), query); Collections.sort(result.getArrivalsAndDepartures(), new SortByTime()); if (result.getArrivalsAndDepartures().isEmpty()) { ArrivalAndDepartureBean arrivalAndDeparture = result.getArrivalsAndDepartures().get(0); distanceOfVehicleFromCall = arrivalAndDeparture.getDistanceFromStop();
public StopWithArrivalsAndDeparturesBean getArrivalsAndDeparturesByStopId( AgencyAndId id, ArrivalsAndDeparturesQueryBean query) { StopBean stop = _stopBeanService.getStopForId(id); if (stop == null) return null; List<ArrivalAndDepartureBean> arrivalsAndDepartures = _arrivalsAndDeparturesBeanService.getArrivalsAndDeparturesByStopId( id, query); List<AgencyAndId> nearbyStopIds = _nearbyStopsBeanService.getNearbyStops( stop, 100); List<StopBean> nearbyStops = new ArrayList<StopBean>(); for (AgencyAndId nearbyStopId : nearbyStopIds) nearbyStops.add(_stopBeanService.getStopForId(nearbyStopId)); List<ServiceAlertBean> situations = _serviceAlertsBeanService.getServiceAlertsForStopId( query.getTime(), id); return new StopWithArrivalsAndDeparturesBean(stop, arrivalsAndDepartures, nearbyStops, situations); }