/** * * @param id * @return a full id with the default agency id ("a0") for the feed. */ public AgencyAndId id(String id) { return new AgencyAndId("a0", id); }
/** * * @param id * @return a full id with the default agency id ("a0") for the feed. */ public AgencyAndId id(String id) { return new AgencyAndId("a0", id); }
private Object getKeyForTripProblemReportSummariesRow(Object[] row, ETripProblemGroupBy groupBy) { switch (groupBy) { case TRIP: return new AgencyAndId((String) row[1], (String) row[2]); case STATUS: return row[1]; case LABEL: return row[1]; } throw new IllegalStateException("unhandled grouping: " + groupBy); }
public static AgencyAndId convertIdFromString(String value) { int index = value.indexOf(ID_SEPARATOR); if (index == -1) { throw new IllegalStateException("invalid agency-and-id: " + value); } else { return new AgencyAndId(value.substring(0, index), value.substring(index + 1)); } }
private TripEntry getTripEntryForId(String agencyId, String tripId) { String mappedTripId = _tripIdMapping.get(tripId); if (mappedTripId != null) tripId = mappedTripId; for (String aid : _agencyIds) { AgencyAndId fullTripId = new AgencyAndId(aid, tripId); TripEntry tripEntry = _transitGraph.getTripEntryForId(fullTripId); if (tripEntry != null) return tripEntry; } return null; }
/** * Id may have agencyId duplicated -- do the right thing * @return a valid, non duplicated AgencyAndId */ public static final AgencyAndId agencyAndIdAndId(String agencyId, String id) { if (id != null && id.indexOf(AgencyAndIdLibrary.ID_SEPARATOR) != -1) { return AgencyAndIdLibrary.convertFromString(id); } return new AgencyAndId(agencyId, id); }
private AgencyAndId computeUnmergedTripId(AgencyAndId tripId) { Matcher m = _mergedIdPattern.matcher(tripId.getId()); if (m.matches()) { return new AgencyAndId(tripId.getAgencyId(), m.group(1)); } else { return tripId; } }
private Trip getTrip(GtfsReaderContext context, GtfsRelationalDao dao) { String agencyId = context.getAgencyForEntity(Trip.class, tripId); AgencyAndId id = new AgencyAndId(agencyId, tripId); Trip trip = dao.getTripForId(id); if (trip == null) { throw new IllegalArgumentException("unknown trip: " + tripId); } return trip; }
public AgencyAndId getShiftedServiceId() { String shiftedId = originalServiceId.getId() + " " + ((dayOffset < 0) ? "-" : "+") + Math.abs(dayOffset); return new AgencyAndId(originalServiceId.getAgencyId(), shiftedId); }
@Override public String convertStopId(String stopId) { AgencyAndId id = new AgencyAndId(_agencyId, stopId); AgencyAndId newId = _consolidatedStopsService.getConsolidatedStopIdForHiddenStopId(id); if (newId == null) return stopId; return newId.getId(); } }
@Override protected IdKey resolveKey() { AgencyAndId id = new AgencyAndId(_reader.getDefaultAgencyId(), _rawServiceId); return new ServiceIdKey(id); } }
@Override protected IdKey resolveKey() { AgencyAndId id = new AgencyAndId(_reader.getDefaultAgencyId(), _rawShapeId); return new ShapeIdKey(id); } }
@Override public void translateFromCSVToObject(CsvEntityContext context, Map<String, Object> csvValues, BeanWrapper object) { if (isMissingAndOptional(csvValues)) return; String agencyId = resolveAgencyId(context, object); String id = (String) csvValues.get(_csvFieldName); AgencyAndId agencyAndId = new AgencyAndId(agencyId, id); object.setPropertyValue(_objFieldName, agencyAndId); }
@Override public void translateFromCSVToObject(CsvEntityContext context, Map<String, Object> csvValues, BeanWrapper object) { if (isMissingAndOptional(csvValues)) return; String agencyId = resolveAgencyId(context, object); String id = (String) csvValues.get(_csvFieldName); AgencyAndId agencyAndId = new AgencyAndId(agencyId, id); object.setPropertyValue(_objFieldName, agencyAndId); }
public Id getTripId(String tripId) { TripEntry trip = getTrip(tripId); if (trip != null) return ServiceAlertLibrary.id(trip.getId()); _log.warn("trip not found with id \"{}\"", tripId); AgencyAndId id = new AgencyAndId(_agencyIds.get(0), tripId); return ServiceAlertLibrary.id(id); }
private <T extends IdentityBean<AgencyAndId>> void bulkRenameAgencyId( Iterable<T> elements, String oldAgencyId, String newAgencyId) { for (T element : elements) { AgencyAndId id = element.getId(); if (id.getAgencyId().equals(oldAgencyId)) { AgencyAndId newId = new AgencyAndId(newAgencyId, id.getId()); element.setId(newId); } } }
private AgencyAndId getRouteCollectionIdForRoute(Route route) { String id = trim(route.getShortName()); // If no short name is supplied, we go back to using the original route id if (id == null || id.length() == 0) id = route.getId().getId(); id = id.replace('/', '_'); id = id.replace('\\', '_'); return new AgencyAndId(route.getId().getAgencyId(), id); }
private AgencyAndId getRouteCollectionIdForRoute(Route route) { String id = trim(route.getShortName()); // If no short name is supplied, we go back to using the original route id if (id == null || id.length() == 0) id = route.getId().getId(); id = id.replace('/', '_'); id = id.replace('\\', '_'); return new AgencyAndId(route.getId().getAgencyId(), id); }
private void cacheVehicleLocations(FeedMessage vehiclePositions) { for (FeedEntity entity : vehiclePositions.getEntityList()) { if (entity.hasVehicle()) { GtfsRealtime.VehiclePosition vehicle = entity.getVehicle(); _vehicleLocationListener.handleRawPosition( new AgencyAndId(getAgencyIds().get(0), vehicle.getVehicle().getId()), vehicle.getPosition().getLatitude(), vehicle.getPosition().getLongitude(), vehicle.getTimestamp()); } } }
private Route getShuttleRoute(GtfsMutableRelationalDao dao, Route orig) { Route shuttleRoute = new Route(orig); AgencyAndId id = new AgencyAndId(shuttleRoute.getId().getAgencyId(), shuttleRoute.getId().getId() + SHUTTLE_ID_SUFFIX); shuttleRoute.setId(id); shuttleRoute.setShortName(shuttleRoute.getShortName() + SHUTTLE_ID_SUFFIX); shuttleRoute.setLongName(shuttleRoute.getLongName() + SHUTTLE_NAME_SUFFIX); shuttleRoute.setType(SHUTTLE_ROUTE_TYPE); dao.saveEntity(shuttleRoute); return shuttleRoute; } }