if (informed.hasAgencyId()) { agencyId = informed.getAgencyId().intern();
/** * Checks rule E034 - "GTFS-rt agency_id does not exist in GTFS data", and adds any errors that are found to the provided error list * * @param entity feed entity to examine that contains an alert * @param entitySelector EntitySelector to examine for agency_id specifier * @param gtfsMetadata information about the GTFS dataset * @param errors list to add any errors for E034 to */ private void checkE034(GtfsRealtime.FeedEntity entity, GtfsRealtime.EntitySelector entitySelector, GtfsMetadata gtfsMetadata, List<OccurrenceModel> errors) { if (entitySelector.hasAgencyId()) { if (!gtfsMetadata.getAgencyIds().contains(entitySelector.getAgencyId())) { RuleUtils.addOccurrence(E034, "alert ID " + entity.getId() + " agency_id " + entitySelector.getAgencyId(), errors, _log); } } }
private Affects.Builder getEntitySelectorAsAffects(EntitySelector selector, Map agencyIdMap) { Affects.Builder affects = Affects.newBuilder(); if (selector.hasAgencyId()) { String agencyId = selector.getAgencyId(); if (agencyIdMap != null && agencyIdMap.get(agencyId) != null) { agencyId = (String) agencyIdMap.get(agencyId); } affects.setAgencyId(agencyId); } if (selector.hasRouteId()) { Id routeId = _entitySource.getRouteId(selector.getRouteId()); affects.setRouteId(routeId); } if (selector.hasStopId()) { Id stopId = _entitySource.getStopId(selector.getStopId()); affects.setStopId(stopId); } if (selector.hasTrip()) { TripDescriptor trip = selector.getTrip(); if (trip.hasTripId()) affects.setTripId(_entitySource.getTripId(trip.getTripId())); else if (trip.hasRouteId()) affects.setRouteId(_entitySource.getRouteId(trip.getRouteId())); } return affects; }
return null; EntitySelectorModel esm = new EntitySelectorModel(); if (es.hasAgencyId()) { esm.setAgencyId(es.getAgencyId());
public Builder mergeFrom(com.google.transit.realtime.GtfsRealtime.EntitySelector other) { if (other == com.google.transit.realtime.GtfsRealtime.EntitySelector.getDefaultInstance()) return this; if (other.hasAgencyId()) { bitField0_ |= 0x00000001; agencyId_ = other.agencyId_; onChanged(); } if (other.hasRouteId()) { bitField0_ |= 0x00000002; routeId_ = other.routeId_; onChanged(); } if (other.hasRouteType()) { setRouteType(other.getRouteType()); } if (other.hasTrip()) { mergeTrip(other.getTrip()); } if (other.hasStopId()) { bitField0_ |= 0x00000010; stopId_ = other.stopId_; onChanged(); } this.mergeExtensionFields(other); this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * Checks rule E033 - "Alert informed_entity does not have any specifiers" and adds * any errors that are found to the provided errors list * * @param entity feed entity to examine that contains an alert * @param entitySelector EntitySelector to examine for specifiers * @param errors list to add any errors for E033 to */ private void checkE033(GtfsRealtime.FeedEntity entity, GtfsRealtime.EntitySelector entitySelector, List<OccurrenceModel> errors) { GtfsRealtime.TripDescriptor trip = null; if (entitySelector.hasTrip()) { trip = entitySelector.getTrip(); } if (!entitySelector.hasAgencyId() && !entitySelector.hasRouteId() && !entitySelector.hasRouteType() && !entitySelector.hasStopId()) { // informed_entity isn't populated - check TripDescriptor if (trip == null || (!trip.hasTripId() && !trip.hasRouteId())) { RuleUtils.addOccurrence(E033, "alert ID " + entity.getId() + " informed_entity and informed_entity.trip do not not reference any agency, route, trip, or stop", errors, _log); } } }
public Builder mergeFrom(com.google.transit.realtime.GtfsRealtime.EntitySelector other) { if (other == com.google.transit.realtime.GtfsRealtime.EntitySelector.getDefaultInstance()) return this; if (other.hasAgencyId()) { bitField0_ |= 0x00000001; agencyId_ = other.agencyId_; onChanged(); } if (other.hasRouteId()) { bitField0_ |= 0x00000002; routeId_ = other.routeId_; onChanged(); } if (other.hasRouteType()) { setRouteType(other.getRouteType()); } if (other.hasTrip()) { mergeTrip(other.getTrip()); } if (other.hasStopId()) { bitField0_ |= 0x00000010; stopId_ = other.stopId_; onChanged(); } this.mergeExtensionFields(other); this.mergeUnknownFields(other.getUnknownFields()); return this; }
private String createId(String id, EntitySelector informed) { return id + " " + (informed.hasAgencyId () ? informed.getAgencyId () : " null ") + " " + (informed.hasRouteId () ? informed.getRouteId () : " null ") + " " + (informed.hasTrip() && informed.getTrip().hasDirectionId() ? informed.getTrip().hasDirectionId() : " null ") + " " + (informed.hasRouteType () ? informed.getRouteType () : " null ") + " " + (informed.hasStopId () ? informed.getStopId () : " null ") + " " + (informed.hasTrip() && informed.getTrip().hasTripId() ? informed.getTrip().getTripId() : " null "); }