use of org.onebusaway.gtfs.services.GtfsRelationalDao in project onebusaway-gtfs-modules by OneBusAway.
the class AgencyMergeStrategy method rename.
@Override
protected void rename(GtfsMergeContext context, IdentityBean<?> entity) {
GtfsRelationalDao source = context.getSource();
String prefix = context.getPrefix();
Agency agency = (Agency) entity;
String oldAgencyId = agency.getId();
String newAgencyId = prefix + oldAgencyId;
agency.setId(newAgencyId);
renameAgencyId(source, oldAgencyId, newAgencyId);
}
use of org.onebusaway.gtfs.services.GtfsRelationalDao in project onebusaway-gtfs-modules by OneBusAway.
the class ShapePointMergeStrategy method saveElementsForKey.
@Override
protected void saveElementsForKey(GtfsMergeContext context, AgencyAndId shapeId) {
GtfsRelationalDao source = context.getSource();
GtfsMutableRelationalDao target = context.getTarget();
for (ShapePoint shapePoint : source.getShapePointsForShapeId(shapeId)) {
shapePoint.setId(0);
shapePoint.setSequence(context.getNextSequenceCounter());
target.saveEntity(shapePoint);
}
}
use of org.onebusaway.gtfs.services.GtfsRelationalDao in project onebusaway-gtfs-modules by OneBusAway.
the class StopMergeStrategy method replaceDuplicateEntry.
@Override
protected void replaceDuplicateEntry(GtfsMergeContext context, Stop oldStop, Stop newStop) {
GtfsRelationalDao source = context.getSource();
for (StopTime stopTime : source.getStopTimesForStop(oldStop)) {
stopTime.setStop(newStop);
}
MergeSupport.bulkReplaceValueInProperties(source.getAllTransfers(), oldStop, newStop, "fromStop", "toStop");
MergeSupport.bulkReplaceValueInProperties(source.getAllPathways(), oldStop, newStop, "fromStop", "toStop");
}
use of org.onebusaway.gtfs.services.GtfsRelationalDao 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.services.GtfsRelationalDao in project onebusaway-gtfs-modules by OneBusAway.
the class CalendarSimplicationStrategyTest method testBasicSimplification.
@Test
public void testBasicSimplification() {
_gtfs.putAgencies(1);
_gtfs.putStops(1);
_gtfs.putRoutes(1);
_gtfs.putTrips(1, "r0", "sid0");
_gtfs.putStopTimes("t0", "s0");
_gtfs.putCalendars(1, "start_date=20120903", "end_date=20120916");
_gtfs.putCalendarDates("sid0=20120917,20120918,20120919,20120920,20120921,20120922,20120923");
GtfsRelationalDao dao = transform();
AgencyAndId serviceId = new AgencyAndId("a0", "sid0");
ServiceCalendar c = dao.getCalendarForServiceId(serviceId);
assertEquals(new ServiceDate(2012, 9, 3), c.getStartDate());
assertEquals(new ServiceDate(2012, 9, 23), c.getEndDate());
List<ServiceCalendarDate> serviceDates = dao.getCalendarDatesForServiceId(serviceId);
assertEquals(0, serviceDates.size());
}
Aggregations