String agencyId = informed.getAgencyId(); 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; }
EntitySelectorModel esm = new EntitySelectorModel(); if (es.hasAgencyId()) { esm.setAgencyId(es.getAgencyId());
/** * <code>optional string agency_id = 1;</code> * * <pre> * The values of the fields should correspond to the appropriate fields in the * GTFS feed. * At least one specifier must be given. If several are given, then the * matching has to apply to all the given specifiers. * </pre> */ public Builder clearAgencyId() { bitField0_ = (bitField0_ & ~0x00000001); agencyId_ = getDefaultInstance().getAgencyId(); onChanged(); return this; } /**
/** * <code>optional string agency_id = 1;</code> * * <pre> * The values of the fields should correspond to the appropriate fields in the * GTFS feed. * At least one specifier must be given. If several are given, then the * matching has to apply to all the given specifiers. * </pre> */ public Builder clearAgencyId() { bitField0_ = (bitField0_ & ~0x00000001); agencyId_ = getDefaultInstance().getAgencyId(); onChanged(); 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 "); }