private Stop doMap(org.onebusaway.gtfs.model.Stop rhs) { Stop lhs = new Stop(); lhs.setId(mapAgencyAndId(rhs.getId())); lhs.setName(rhs.getName()); lhs.setLat(rhs.getLat()); lhs.setLon(rhs.getLon()); lhs.setCode(rhs.getCode()); lhs.setDesc(rhs.getDesc()); lhs.setZoneId(rhs.getZoneId()); lhs.setUrl(rhs.getUrl()); lhs.setLocationType(rhs.getLocationType()); lhs.setParentStation(rhs.getParentStation()); lhs.setWheelchairBoarding(rhs.getWheelchairBoarding()); lhs.setDirection(rhs.getDirection()); lhs.setTimezone(rhs.getTimezone()); lhs.setVehicleType(rhs.getVehicleType()); lhs.setPlatformCode(rhs.getPlatformCode()); return lhs; } }
private Document getStopAsDocument(Stop stop) { Document document = new Document(); // Id AgencyAndId id = stop.getId(); document.add(new Field(FIELD_AGENCY_ID, id.getAgencyId(), Field.Store.YES, Field.Index.NO)); document.add(new Field(FIELD_STOP_ID, id.getId(), Field.Store.YES, Field.Index.ANALYZED)); // Code if (stop.getCode() != null && stop.getCode().length() > 0) document.add(new Field(FIELD_STOP_CODE, stop.getCode(), Field.Store.NO, Field.Index.ANALYZED)); else document.add(new Field(FIELD_STOP_CODE, stop.getId().getId(), Field.Store.NO, Field.Index.ANALYZED)); if (stop.getName() != null && stop.getName().length() > 0) document.add(new Field(FIELD_STOP_NAME, stop.getName(), Field.Store.YES, Field.Index.ANALYZED)); return document; } }
public void generateStopNarratives(NarrativeProviderImpl provider) { Map<AgencyAndId, List<ProjectedPoint>> shapePointCache = new HashMap<AgencyAndId, List<ProjectedPoint>>(); int index = 0; Collection<Stop> allStops = _gtfsDao.getAllStops(); Map<AgencyAndId, Stop> stopsById = MappingLibrary.mapToValue(allStops, "id"); int logInterval = LoggingIntervalUtil.getAppropriateLoggingInterval(allStops.size()); for (StopEntry stopEntry : _transitGraphDao.getAllStops()) { if (index % logInterval == 0) _log.info("stops=" + index); index++; Stop stop = stopsById.get(stopEntry.getId()); StopNarrative.Builder narrative = StopNarrative.builder(); narrative.setCode(deduplicate(stop.getCode())); narrative.setDescription(deduplicate(stop.getDesc())); narrative.setName(deduplicate(stop.getName())); narrative.setUrl(deduplicate(stop.getUrl())); String direction = computeStopDirection(provider, shapePointCache, stop, stopEntry); narrative.setDirection(deduplicate(direction)); provider.setNarrativeForStop(stopEntry.getId(), narrative.create()); } }
public void generateStopNarratives(NarrativeProviderImpl provider) { Map<AgencyAndId, List<ProjectedPoint>> shapePointCache = new HashMap<AgencyAndId, List<ProjectedPoint>>(); int index = 0; Collection<Stop> allStops = _gtfsDao.getAllStops(); Map<AgencyAndId, Stop> stopsById = MappingLibrary.mapToValue(allStops, "id"); for (StopEntry stopEntry : _transitGraphDao.getAllStops()) { if (index % 10 == 0) _log.info("stops=" + index); index++; Stop stop = stopsById.get(stopEntry.getId()); StopNarrative.Builder narrative = StopNarrative.builder(); narrative.setCode(deduplicate(stop.getCode())); narrative.setDescription(deduplicate(stop.getDesc())); narrative.setName(deduplicate(stop.getName())); narrative.setUrl(deduplicate(stop.getUrl())); String direction = computeStopDirection(provider, shapePointCache, stop, stopEntry); narrative.setDirection(deduplicate(direction)); provider.setNarrativeForStop(stopEntry.getId(), narrative.create()); } }
private StopBean fillStopBean(Stop stop, StopBean bean) { bean.setId(ApplicationBeanLibrary.getId(stop.getId())); bean.setLat(stop.getLat()); bean.setLon(stop.getLon()); StopNarrative stopNarrative = _narrativeService.getStopForId(stop.getId()); if (stopNarrative != null) bean.setDirection(stopNarrative.getDireciton()); bean.setName(stop.getName()); bean.setCode(StringLibrary.getBestName(stop.getCode(), stop.getId().getId())); bean.setLocationType(stop.getLocationType()); return bean; }