Class FareFinderValidator

java.lang.Object
de.hybris.platform.travelacceleratorstorefront.validators.AbstractTravelValidator
de.hybris.platform.shoppingaddon.validators.FareFinderValidator
All Implemented Interfaces:
org.springframework.validation.Validator
Direct Known Subclasses:
TravelFareFinderValidator

@Component("fareFinderValidator") public class FareFinderValidator extends AbstractTravelValidator
Custom validation to valid Fare Finder Form attributes which can't be validated using JSR303
  • Constructor Details

    • FareFinderValidator

      public FareFinderValidator()
  • Method Details

    • supports

      public boolean supports(Class<?> clazz)
    • validate

      public void validate(Object object, org.springframework.validation.Errors errors)
    • validateTripType

      protected void validateTripType(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors)
      Method checks if the requested Trip Type is a valid type and sets an INVALID_TYPE error if invalid.
      Parameters:
      fareFinderForm -
      errors -
    • validateCabinClass

      protected void validateCabinClass(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors)
      Method checks if the requested cabin class is a valid class and sets an INVALID_TYPE error if invalid.
      Parameters:
      fareFinderForm -
      errors -
    • validateDepartureLocation

      protected void validateDepartureLocation(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors)
      Method responsible to ensure departure location value and departure location name value re not blank. Method also check to see if arrival location name contain only combinations the following:
      • Uppercase and lowercase characters from A to Z
      • Spaces
      • Dash/Hyphen
      • Parenthesis
      Parameters:
      fareFinderForm -
      errors -
    • validateArrivalLocation

      protected void validateArrivalLocation(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors)
      Method responsible to ensure arrival location value and arrival location name value re not blank. Method also check to see if arrival location name contain only combinations the following:
      • Uppercase and lowercase characters from A to Z
      • Spaces
      • Dash/Hyphen
      • Parenthesis
      Parameters:
      fareFinderForm -
      errors -
    • validateSuggestionValue

      protected void validateSuggestionValue(String fieldLocationType, String locationSuggestionType, org.springframework.validation.Errors errors)
      Validates if a value belongs to a given enumerator
      Parameters:
      fieldLocationType - the field location type
      locationSuggestionType - the location suggestion type
      errors - the errors
    • validateFieldFormat

      protected Boolean validateFieldFormat(String fieldName, String fieldValue, String regex, org.springframework.validation.Errors errors)
      Method runs the regex against the fieldValue and sets an InvalidFormat error against the field if the regex fails
      Parameters:
      fieldName -
      fieldValue -
      regex -
      errors -
    • validateDates

      protected void validateDates(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors)
      Method responsible for running the following validation on Departing and Arriving dates
      • validateDateFormat(String date, Errors errors, String field)
      • validateDateIsPopulated(String date, Errors errors, String field)
      • validateDepartureAndArrivalDateTimeRange(FareFinderForm fareFinderForm, Errors errors)
      Parameters:
      fareFinderForm -
      errors -
    • validateDepartureAndArrivalDateTimeRange

      protected void validateDepartureAndArrivalDateTimeRange(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors)
      Method used to validate Departing and Arrival dates
      Parameters:
      fareFinderForm -
      errors -
    • validateDateIsPopulated

      protected boolean validateDateIsPopulated(String date, org.springframework.validation.Errors errors, String field)
      Method responsible for checking if date is populate
      Parameters:
      date -
      errors -
      field -
      Returns:
    • validatePassengerTypeQuantity

      protected void validatePassengerTypeQuantity(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors)
      Method responsible for checking that at least one adult is present is there are any children or infants traveling
      Parameters:
      fareFinderForm -