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; }
public void addGlobalServiceAlertsToServiceDelivery(ServiceDelivery serviceDelivery, RealtimeService realtimeService) { List<ServiceAlertBean> serviceAlertBeans = realtimeService.getServiceAlertsGlobal(); if (serviceAlertBeans == null) return; Map<String, PtSituationElementStructure> ptSituationElements = new HashMap<String, PtSituationElementStructure>(); for (ServiceAlertBean serviceAlertBean : serviceAlertBeans) { ptSituationElements.put(serviceAlertBean.getId(), getServiceAlertBeanAsPtSituationElementStructure(serviceAlertBean)); } addPtSituationElementsToServiceDelivery(serviceDelivery, ptSituationElements); }
private boolean isSituationUnread(Map<String, Long> readServiceAlerts, ServiceAlertBean situation) { if (!isSituationInActivePublicationWindow(situation)) return false; Long readTime = readServiceAlerts.get(situation.getId()); if (readTime == null) return true; /** * Optionally, if a service alert has just become active and it hasn't been * read in a while, we might also consider it unread. */ if (readTime + _redisplayIfNowActiveThhreshold < _time) { if (!isSituationActiveAtTime(situation, readTime) && isSituationActiveAtTime(situation, _time)) return true; } return false; }
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); } }
public void addToReferences(ServiceAlertBean situation) { if (isSituationExcludedForApplication(situation)) return; if (!shouldAddReferenceWithId(_references.getSituations(), situation.getId())) return; SituationV2Bean bean = getSituation(situation); _references.addSituation(bean); }
public void addToReferences(ServiceAlertBean situation) { if (isSituationExcludedForApplication(situation)) return; if (!shouldAddReferenceWithId(_references.getSituations(), situation.getId())) return; SituationV2Bean bean = getSituation(situation); _references.addSituation(bean); }
query.getTime(), id); for (ServiceAlertBean situation : situations) situationsById.put(situation.getId(), situation);
@Override public void updateServiceAlert(ServiceAlertBean situationBean) { AgencyAndId id = AgencyAndIdLibrary.convertFromString(situationBean.getId()); ServiceAlertRecord serviceAlertRecord = getServiceAlertRecordFromServiceAlertBean( situationBean, id.getAgencyId()); ServiceAlertRecord dbServiceAlertRecord = _serviceAlertsService.getServiceAlertForId(id); if(dbServiceAlertRecord != null){ serviceAlertRecord.setCopy(dbServiceAlertRecord.isCopy()); } _serviceAlertsService.createOrUpdateServiceAlert(serviceAlertRecord); }
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 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 PtSituationElementStructure getServiceAlertBeanAsPtSituationElementStructure( ServiceAlertBean serviceAlert) { PtSituationElementStructure ptSit = new PtSituationElementStructure(); EntryQualifierStructure value = new EntryQualifierStructure(); if (serviceAlert != null) { value.setValue(serviceAlert.getId()); ptSit.setSituationNumber(value); } else { // nothing to do return ptSit; } if (serviceAlert.getCreationTime() != 0) ptSit.setCreationTime(new Date(serviceAlert.getCreationTime())); handleDescriptions(serviceAlert, ptSit); handleOtherFields(serviceAlert, ptSit); handleAffects(serviceAlert, ptSit); handleConsequences(serviceAlert, ptSit); return ptSit; }
bean.setId(situation.getId()); bean.setCreationTime(situation.getCreationTime());
bean.setId(situation.getId()); bean.setCreationTime(situation.getCreationTime());
public TripDetailsV2Bean getTripDetails(TripDetailsBean tripDetails) { TripDetailsV2Bean bean = new TripDetailsV2Bean(); bean.setTripId(tripDetails.getTripId()); bean.setServiceDate(tripDetails.getServiceDate()); if (tripDetails.getFrequency() != null) bean.setFrequency(getFrequency(tripDetails.getFrequency())); TripBean trip = tripDetails.getTrip(); if (trip != null) addToReferences(trip); TripStopTimesBean stopTimes = tripDetails.getSchedule(); if (stopTimes != null) bean.setSchedule(getTripStopTimes(stopTimes)); TripStatusBean status = tripDetails.getStatus(); if (status != null) bean.setStatus(getTripStatus(status)); List<ServiceAlertBean> situations = tripDetails.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 TripDetailsV2Bean getTripDetails(TripDetailsBean tripDetails) { TripDetailsV2Bean bean = new TripDetailsV2Bean(); bean.setTripId(tripDetails.getTripId()); bean.setServiceDate(tripDetails.getServiceDate()); if (tripDetails.getFrequency() != null) bean.setFrequency(getFrequency(tripDetails.getFrequency())); TripBean trip = tripDetails.getTrip(); if (trip != null) addToReferences(trip); TripStopTimesBean stopTimes = tripDetails.getSchedule(); if (stopTimes != null) bean.setSchedule(getTripStopTimes(stopTimes)); TripStatusBean status = tripDetails.getStatus(); if (status != null) bean.setStatus(getTripStatus(status)); List<ServiceAlertBean> situations = tripDetails.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; }
List<String> situationIds = new ArrayList<String>(); for (ServiceAlertBean situation : situations) { situationIds.add(situation.getId()); addToReferences(situation);
List<String> situationIds = new ArrayList<String>(); for (ServiceAlertBean situation : situations) { situationIds.add(situation.getId()); addToReferences(situation);
List<String> situationIds = new ArrayList<String>(situations.size()); for (ServiceAlertBean situation : situations) { situationIds.add(situation.getId()); _factory.addToReferences(situation);
List<String> situationIds = new ArrayList<String>(); for (ServiceAlertBean situation : situations) { situationIds.add(situation.getId()); addToReferences(situation);