Class FlightSearchRequestValidator

All Implemented Interfaces:
TravelValidator, org.springframework.validation.Validator

public class FlightSearchRequestValidator extends TravelCompositeValidator
Validates instances of FlightSearchRequest for the valid departureDate, passengerQuantity format,locationType
  • Constructor Details

    • FlightSearchRequestValidator

      public FlightSearchRequestValidator()
  • Method Details

    • supports

      public boolean supports(Class<?> aClass)
      Specified by:
      supports in interface org.springframework.validation.Validator
      Overrides:
      supports in class TravelCompositeValidator
    • validateInternal

      public void validateInternal(Object target, org.springframework.validation.Errors errors)
      Description copied from class: TravelCompositeValidator
      Internal method for validating the supplied target object
      Overrides:
      validateInternal in class TravelCompositeValidator
      Parameters:
      target - the object that is to be validated
      errors - contextual state about the validation process
    • validatePassengers

      protected boolean validatePassengers(List<SearchPassengerPreferences> passengerType, org.springframework.validation.Errors errors)
      Validate the adult is present in passenger quantity.
      Parameters:
      passengerType - the passenger type
      Returns:
      the boolean
    • validateDepartureDate

      protected Date validateDepartureDate(String departureDate, Date outboundDate, org.springframework.validation.Errors errors)
      Validate the departure date is after the current time.
      Parameters:
      departureDate - the departure date of the segment
      outboundDate - the outbound date
      errors - contextual state about the validation process
      Returns:
      the outbound date
    • validatePassengerQuantity

      protected boolean validatePassengerQuantity(List<SearchPassengerPreferences> passengerType)
      Validate the passenger type.
      Parameters:
      passengerType - the passenger type
      Returns:
      the boolean
    • validateLocation

      protected boolean validateLocation(String location)
      Validate the location
      Parameters:
      location -
      Returns:
    • parseDate

      protected Date parseDate(String date)
      Parse string to date.
      Parameters:
      date - the date
      Returns:
      date
    • getTravelLocationFacade

      protected TravelLocationFacade getTravelLocationFacade()
      Get travel location facade
      Returns:
      the travel location facade
    • setTravelLocationFacade

      public void setTravelLocationFacade(TravelLocationFacade travelLocationFacade)
      Set the travel location facade
      Parameters:
      travelLocationFacade - the travel location facade
    • getTransportFacilityFacade

      protected TransportFacilityFacade getTransportFacilityFacade()
      get transport facility facade
      Returns:
      the transport facility facade
    • setTransportFacilityFacade

      public void setTransportFacilityFacade(TransportFacilityFacade transportFacilityFacade)
      set transport facility facade
      Parameters:
      transportFacilityFacade - the transport facility facade
    • getCabinClassService

      protected CabinClassService getCabinClassService()
      Gets cabin class service.
      Returns:
      the cabin class service
    • setCabinClassService

      public void setCabinClassService(CabinClassService cabinClassService)
      Sets cabin class service.
      Parameters:
      cabinClassService - the cabin class service
    • getPassengerTypeService

      protected PassengerTypeService getPassengerTypeService()
      Returns:
      the passengerTypeService
    • setPassengerTypeService

      public void setPassengerTypeService(PassengerTypeService passengerTypeService)
      Parameters:
      passengerTypeService - the passengerTypeService to set