use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class AddOmnySubwayData method run.
@Override
public void run(TransformContext context, GtfsMutableRelationalDao dao) {
int stop_count = 0;
int route_count = 0;
// Per MOTP-1770 all stops/routes are now OMNY enabled.
for (Stop stop : dao.getAllStops()) {
stop.setRegionalFareCardAccepted(1);
stop_count++;
}
for (Route route : dao.getAllRoutes()) {
route.setRegionalFareCardAccepted(1);
route_count++;
}
_log.info("Set {} stops and {} routes to omny_enabled Y", stop_count, route_count);
}
use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class StopMergeStrategy method save.
@Override
protected void save(GtfsMergeContext context, IdentityBean<?> entity) {
GtfsRelationalDao source = context.getSource();
GtfsMutableRelationalDao target = context.getTarget();
Stop stop = (Stop) entity;
super.save(context, entity);
}
use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class LatLonFieldMappingFactoryTest method testTranslateFromCSVToObject.
@Test
public void testTranslateFromCSVToObject() {
Map<String, Object> csvValues = new HashMap<String, Object>();
csvValues.put("stop_lat", "47.1234");
Stop stop = new Stop();
_fieldMapping.translateFromCSVToObject(new CsvEntityContextImpl(), csvValues, BeanWrapperFactory.wrap(stop));
assertEquals(47.1234, stop.getLat(), 0.00001);
}
use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class LatLonFieldMappingFactoryTest method testTranslateFromObjectToCSV.
@Test
public void testTranslateFromObjectToCSV() {
Stop stop = new Stop();
stop.setLat(47.5678);
Map<String, Object> csvValues = new HashMap<String, Object>();
_fieldMapping.translateFromObjectToCSV(new CsvEntityContextImpl(), BeanWrapperFactory.wrap(stop), csvValues);
assertEquals("47.567800", csvValues.get("stop_lat"));
}
use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class LatLonFieldMappingFactoryTest method testTranslateFromObjectToCSV_differentLocale.
@Test
public void testTranslateFromObjectToCSV_differentLocale() {
Locale.setDefault(Locale.FRANCE);
_fieldMapping = buildFieldMapping();
Stop stop = new Stop();
stop.setLat(47.5678);
Map<String, Object> csvValues = new HashMap<String, Object>();
_fieldMapping.translateFromObjectToCSV(new CsvEntityContextImpl(), BeanWrapperFactory.wrap(stop), csvValues);
assertEquals("47.567800", csvValues.get("stop_lat"));
}
Aggregations