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; } }
newScd.setDate(calDate.getDate()); newScd.setExceptionType(calDate.getExceptionType()); dao.saveOrUpdateEntity(newScd);
List<ServiceCalendarDate> atisCalendarDates = dao.getCalendarDatesForServiceId(atisTrip.getServiceId()); for (ServiceCalendarDate atisScd : atisCalendarDates) { ServiceDate atisDate = atisScd.getDate(); if (refServiceDates.contains(atisDate)) {
Date date = removeTime(calDate.getDate().getAsDate()); Date today = removeTime(new Date()); if (calDate.getExceptionType() == 1 && date.equals(today)) {
Date date = removeTime(calDate.getDate().getAsDate()); Date today = removeTime(new Date()); if (calDate.getExceptionType() == 1 && date.equals(today)) {
Date date = removeTime(calDate.getDate().getAsDate()); if (date.equals(testDate)) { hasCalDateException = true;
@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); } } }
for (Trip trip1 : dao.getTripsForRoute(route)) { 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());
Date date = removeTime(calDate.getDate().getAsDate());
Date date = removeTime(calDate.getDate().getAsDate());