public Collection<ShapePoint> getAllShapePoints() { if (packShapePoints) { return shapePoints; } return getAllEntitiesForType(ShapePoint.class); }
/*** * {@link GtfsDao} Interface ****/ public Agency getAgencyForId(String id) { return getEntityForId(Agency.class, id); }
public static void main(String[] args) throws IOException { if (args.length != 2) { System.err.println("usage: bundle.xml output_path"); System.exit(-1); } List<String> paths = new ArrayList<String>(); paths.add(args[0]); ConfigurableApplicationContext context = ContainerLibrary.createContext(paths); GtfsDaoImpl store = new GtfsDaoImpl(); DefaultEntitySchemaFactory schema = GtfsEntitySchemaFactory.createEntitySchemaFactory(); GenericAdditionalFieldMapping.addGenericFieldMapping(schema, Stop.class, "stop_direction", "stopDirection"); GenericAdditionalFieldMapping.addGenericFieldMapping(schema, Trip.class, "block_sequence_id", "blockSequenceId"); GtfsReadingSupport.readGtfsIntoStore(context, store,schema); writeGtfs(new File(args[1]), store, schema); }
/**** * {@link GenericMutableDao} Interface ****/ @Override public <K, V> Map<K, V> getEntitiesByIdForEntityType(Class<K> keyType, Class<V> entityType) { noKeyCheck(keyType); return super.getEntitiesByIdForEntityType(keyType, entityType); }
@Override public void saveEntity(Object entity) { Class<? extends Object> entityType = entity.getClass(); if (entity instanceof IdentityBean<?> && _entityReplacementStrategy.hasReplacementEntities(entityType)) { IdentityBean<?> bean = (IdentityBean<?>) entity; Serializable id = bean.getId(); if (_entityReplacementStrategy.hasReplacementEntity(entityType, id)) { _rejectionStore.saveEntity(entity); return; } } super.saveEntity(entity); } }
@Override public List<ErrorListHelperModel> validate(GtfsDaoImpl gtfsData) { List<OccurrenceModel> e010List = new ArrayList<>(); Collection<StopTime> stopTimes = gtfsData.getAllStopTimes(); Set<Stop> checkedStops = new HashSet<>(); for (StopTime stopTime : stopTimes) { if (!checkedStops.contains(stopTime.getStop())) { checkedStops.add(stopTime.getStop()); if (stopTime.getStop().getLocationType() != 0) { RuleUtils.addOccurrence(E010, "stop_id " + stopTime.getStop().getId(), e010List, _log); } } } List<ErrorListHelperModel> errors = new ArrayList<>(); if (!e010List.isEmpty()) { errors.add(new ErrorListHelperModel(new MessageLogModel(E010), e010List)); } return errors; } }
double gtfsReadTime = readGtfsData(); Collection<Agency> agencies = mGtfsData.getAllAgencies(); for (Agency agency : agencies) { timeZoneText = agency.getTimezone();
public static void main(String[] args) throws IOException { if (args.length != 2) { System.err.println("usage: bundle.xml output_path"); System.exit(-1); } List<String> paths = new ArrayList<String>(); paths.add(args[0]); ConfigurableApplicationContext context = ContainerLibrary.createContext(paths); GtfsDaoImpl store = new GtfsDaoImpl(); DefaultEntitySchemaFactory schema = GtfsEntitySchemaFactory.createEntitySchemaFactory(); GenericAdditionalFieldMapping.addGenericFieldMapping(schema, Stop.class, "stop_direction", "stopDirection"); GenericAdditionalFieldMapping.addGenericFieldMapping(schema, Trip.class, "block_sequence_id", "blockSequenceId"); GtfsReadingSupport.readGtfsIntoStore(context, store,schema); writeGtfs(new File(args[1]), store, schema); }
/**** * {@link GenericMutableDao} Interface ****/ @Override public <K, V> Map<K, V> getEntitiesByIdForEntityType(Class<K> keyType, Class<V> entityType) { noKeyCheck(keyType); return super.getEntitiesByIdForEntityType(keyType, entityType); }
public static void main(String[] args) throws IOException { if (args.length != 2) { System.err.println("usage: bundle.xml output_path"); System.exit(-1); } List<String> paths = new ArrayList<String>(); paths.add(args[0]); ConfigurableApplicationContext context = ContainerLibrary.createContext(paths); GtfsDaoImpl store = new GtfsDaoImpl(); DefaultEntitySchemaFactory schema = GtfsEntitySchemaFactory.createEntitySchemaFactory(); GenericAdditionalFieldMapping.addGenericFieldMapping(schema, Stop.class, "stop_direction", "stopDirection"); GenericAdditionalFieldMapping.addGenericFieldMapping(schema, Trip.class, "block_sequence_id", "blockSequenceId"); GtfsReadingSupport.readGtfsIntoStore(context, store,schema); writeGtfs(new File(args[1]), store, schema); }
public Collection<StopTime> getAllStopTimes() { if (packStopTimes) { return stopTimes; } return getAllEntitiesForType(StopTime.class); }
/*** * {@link GtfsDao} Interface ****/ public Agency getAgencyForId(String id) { return getEntityForId(Agency.class, id); }
/** * Read the GTFS data into an internal data model * * @return the amount of time to read the GTFS data, in seconds as a decimal (0.22) * @throws IOException */ private double readGtfsData() throws IOException { _log.info("Reading GTFS data from " + mPathToGtfsFile + "..."); mGtfsData = new GtfsDaoImpl(); mReader = new GtfsReader(); mReader.setInputLocation(mPathToGtfsFile); mReader.setEntityStore(mGtfsData); long startGtfsRead = System.nanoTime(); mReader.run(); double readTime = getElapsedTime(startGtfsRead, System.nanoTime()); _log.info(mPathToGtfsFile.getName() + " read in " + getElapsedTimeString(readTime)); return readTime; }
public Collection<StopTime> getAllStopTimes() { if (packStopTimes) { return stopTimes; } return getAllEntitiesForType(StopTime.class); }
public ServiceCalendar getCalendarForId(int id) { return getEntityForId(ServiceCalendar.class, id); }
@Override public Collection<FeedInfo> getAllFeedInfos() { return getAllEntitiesForType(FeedInfo.class); }
public Transfer getTransferForId(int id) { return getEntityForId(Transfer.class, id); }
public Collection<ShapePoint> getAllShapePoints() { if (packShapePoints) { return shapePoints; } return getAllEntitiesForType(ShapePoint.class); }
public FareAttribute getFareAttributeForId(AgencyAndId id) { return getEntityForId(FareAttribute.class, id); }
public Collection<Pathway> getAllPathways() { return getAllEntitiesForType(Pathway.class); }