public GtfsImport(File path) throws IOException { GtfsReader reader = new GtfsReader(); reader.setInputLocation(path); readFeedId(reader); readDao(reader); }
private void readDao(GtfsReader reader) throws IOException { dao = new GtfsRelationalDaoImpl(); reader.setEntityStore(dao); reader.setDefaultAgencyId(getFeedId().getId()); reader.run(); }
private void readFeedId(GtfsReader reader) { feedId = new GtfsFeedId.Builder().fromGtfsFeed(reader.getInputSource()).build(); }
GtfsReader reader = new GtfsReader(); reader.setInputSource(gtfsBundle.getCsvInputSource()); reader.setEntityStore(store); reader.setInternStrings(true); reader.setDefaultAgencyId(gtfsFeedId.getId()); reader.addEntityHandler(counter); reader.addEntityHandler(new EntityBikeability(true)); for (Class<?> entityClass : reader.getEntityClasses()) { LOG.info("reading entities: " + entityClass.getName()); reader.readEntities(entityClass); store.flush(); for (Agency agency : reader.getAgencies()) { String agencyId = agency.getId(); LOG.info("This Agency has the ID {}", agencyId); reader.addAgencyIdMapping(agencyId, generatedAgencyId); // NULL key should work agency.setId(generatedAgencyId); agencyId = generatedAgencyId; shapePoint.getShapeId().setAgencyId(reader.getDefaultAgencyId()); route.getId().setAgencyId(reader.getDefaultAgencyId()); generateRouteColor(route); stop.getId().setAgencyId(reader.getDefaultAgencyId());
private static void writeGtfs(File outputDirectory, GtfsDaoImpl store, DefaultEntitySchemaFactory schema) throws IOException { GtfsWriter writer = new GtfsWriter(); writer.setOutputLocation(outputDirectory); writer.setEntitySchemaFactory(schema); writer.run(store); } }
public void run() throws IOException { run(getInputSource()); }
/**** * Protected Methods ****/ protected DefaultEntitySchemaFactory createEntitySchemaFactory() { return GtfsEntitySchemaFactory.createEntitySchemaFactory(); }
public List<Agency> getAgencies() { return GtfsReader.this.getAgencies(); }
public String getTranslatedAgencyId(String agencyId) { return GtfsReader.this.getTranslatedAgencyId(agencyId); } }
public String getAgencyForEntity(Class<?> entityType, String entityId) { return GtfsReader.this.getAgencyForEntity(entityType, entityId); }
public Object getEntity(Class<?> entityClass, Serializable id) { return GtfsReader.this.getEntity(entityClass, id); }
private static void writeGtfs(File outputDirectory, GtfsDaoImpl store, DefaultEntitySchemaFactory schema) throws IOException { GtfsWriter writer = new GtfsWriter(); writer.setOutputLocation(outputDirectory); writer.setEntitySchemaFactory(schema); writer.run(store); } }
public void run() throws IOException { run(getInputSource()); }
/**** * Protected Methods ****/ protected DefaultEntitySchemaFactory createEntitySchemaFactory() { return GtfsEntitySchemaFactory.createEntitySchemaFactory(); } }
public String getTranslatedAgencyId(String agencyId) { return GtfsReader.this.getTranslatedAgencyId(agencyId); } }
public String getAgencyForEntity(Class<?> entityType, String entityId) { return GtfsReader.this.getAgencyForEntity(entityType, entityId); }
public Object getEntity(Class<?> entityClass, Serializable id) { return GtfsReader.this.getEntity(entityClass, id); }
private static void writeGtfs(File outputDirectory, GtfsDaoImpl store, DefaultEntitySchemaFactory schema) throws IOException { GtfsWriter writer = new GtfsWriter(); writer.setOutputLocation(outputDirectory); writer.setEntitySchemaFactory(schema); writer.run(store); } }
/**** * Protected Methods ****/ protected DefaultEntitySchemaFactory createEntitySchemaFactory() { return GtfsEntitySchemaFactory.createEntitySchemaFactory(); }
/**** * Protected Methods ****/ protected DefaultEntitySchemaFactory createEntitySchemaFactory() { return GtfsEntitySchemaFactory.createEntitySchemaFactory(); } }