コード例 #1
0
 private void validateDates(AcScheduledFlightUploadErrorVo e) {
   AcScheduledFlightUpload u = e.getScheduledFlightUpload();
   if (!u.hasStartLocalDt()) return;
   if (!u.hasEndLocalDt()) return;
   if (u.getStartLocalDt().isAfter(u.getEndLocalDt()))
     e.addError("Invalid Start/End date combination");
 }
コード例 #2
0
  private void validateTimes(
      JwDate date, JwMap<String, AcAirport> airportCache, AcScheduledFlightUploadErrorVo e) {
    JwDate date2 = date.getCopy();
    date2.addDays(e.getScheduledFlightUploadDayOffset());

    JwTimestamp departLocalTs =
        JwTimestamp.createTimestamp(date, e.getScheduledFlightUploadDepartureLocalTm());
    JwTimestamp arriveLocalTs =
        JwTimestamp.createTimestamp(date2, e.getScheduledFlightUploadArrivalLocalTm());

    AcAirport originAirport =
        getAirport(airportCache, e.getScheduledFlightUploadOriginAirportCode());
    AcAirport destAirport =
        getAirport(airportCache, e.getScheduledFlightUploadDestinationAirportCode());

    JwTimestamp departUtcTs = originAirport.toUtc(departLocalTs);
    if (departUtcTs == null) departUtcTs = departLocalTs;
    JwTimestamp arriveUtcTs = destAirport.toUtc(arriveLocalTs);
    if (arriveUtcTs == null) arriveUtcTs = arriveLocalTs;

    if (departUtcTs.isAfter(arriveUtcTs)) e.addError("Invalid Depart/Arrive time combination");
  }