private ServiceCalendarDate doMap(org.onebusaway.gtfs.model.ServiceCalendarDate rhs) { ServiceCalendarDate lhs = new ServiceCalendarDate(); lhs.setServiceId(AgencyAndIdMapper.mapAgencyAndId(rhs.getServiceId())); lhs.setDate(ServiceDateMapper.mapServiceDate(rhs.getDate())); lhs.setExceptionType(rhs.getExceptionType()); return lhs; }
private void addAndRemoveDatesFromCalendarDate( ServiceCalendarDate calendarDate, TimeZone serviceIdTimeZone, Set<ServiceDate> activeDates) { ServiceDate serviceDate = calendarDate.getDate(); Date targetDate = calendarDate.getDate().getAsDate(); Calendar c = Calendar.getInstance(); c.setTime(targetDate); switch (calendarDate.getExceptionType()) { case ServiceCalendarDate.EXCEPTION_TYPE_ADD: addServiceDate(activeDates, serviceDate, serviceIdTimeZone); break; case ServiceCalendarDate.EXCEPTION_TYPE_REMOVE: activeDates.remove(serviceDate); break; default: _log.warn("unknown CalendarDate exception type: " + calendarDate.getExceptionType()); break; } }
private void addAndRemoveDatesFromCalendarDate( ServiceCalendarDate calendarDate, TimeZone serviceIdTimeZone, Set<ServiceDate> activeDates) { ServiceDate serviceDate = calendarDate.getDate(); Date targetDate = calendarDate.getDate().getAsDate(); Calendar c = Calendar.getInstance(); c.setTime(targetDate); switch (calendarDate.getExceptionType()) { case ServiceCalendarDate.EXCEPTION_TYPE_ADD: addServiceDate(activeDates, serviceDate, serviceIdTimeZone); break; case ServiceCalendarDate.EXCEPTION_TYPE_REMOVE: activeDates.remove(serviceDate); break; default: _log.warn("unknown CalendarDate exception type: " + calendarDate.getExceptionType()); break; } }
if (date.equals(testDate)) { hasCalDateException = true; if (calDate.getExceptionType() == 1) { if (calDate.getExceptionType() == 2) {
Date date = removeTime(calDate.getDate().getAsDate()); Date today = removeTime(new Date()); if (calDate.getExceptionType() == 1 && date.equals(today)) { curSerTrips++; break;
newScd.setServiceId(newServiceId); newScd.setDate(calDate.getDate()); newScd.setExceptionType(calDate.getExceptionType()); dao.saveOrUpdateEntity(newScd);
Date date = removeTime(calDate.getDate().getAsDate()); Date today = removeTime(new Date()); if (calDate.getExceptionType() == 1 && date.equals(today)) { curSerTrips++; break;
@Override public void run(TransformContext context, GtfsMutableRelationalDao dao) { Date today = removeTime(new Date()); boolean hasEntryToday; for (AgencyAndId aai : dao.getAllServiceIds()) { hasEntryToday = false; for (ServiceCalendarDate calDate : dao.getCalendarDatesForServiceId(aai)) { Date date = removeTime(calDate.getDate().getAsDate()); if (date.equals(today)) { hasEntryToday = true; if (calDate.getExceptionType() == 1) { calDate.setExceptionType(2); dao.saveOrUpdateEntity(calDate); } } } if (!hasEntryToday) { _log.error("No entry for today, adding one, id: {}", aai); ServiceCalendarDate calendarDate = new ServiceCalendarDate(); calendarDate.setServiceId(aai); calendarDate.setDate(new ServiceDate(today)); calendarDate.setExceptionType(2); dao.saveOrUpdateEntity(calendarDate); } } }
if (date.equals(today)) { hasCalDateException = true; if (calDate.getExceptionType() == 1) { if (calDate.getExceptionType() == 2) { if (date.equals(tomorrow)) { hasCalDateException = true; if (calDate.getExceptionType() == 1) { if (calDate.getExceptionType() == 2) {
for (ServiceCalendarDate calDate : dao.getCalendarDatesForServiceId(trip1.getServiceId())) { Date date = removeTime(calDate.getDate().getAsDate()); if (calDate.getExceptionType() == 1 && date.equals(today)) { _log.info("ATIS has current service for route: {}", route.getId().getId()); curSerRoute++;
if (calDate.getExceptionType() == 1 && date.equals(testDate)) { _log.info("ATIS has service for route: {} on {}", route.getId().getId(), testDate); numTripsOnDate++;
if (calDate.getExceptionType() == 1 && date.equals(testDate)) { _log.info("ATIS has service for route: {} on {}", route.getId().getId(), testDate); numTripsOnDate++;