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
Custom validation to valid Fare Finder Form attributes which can't be validated using JSR303
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidprotected voidvalidateArrivalLocation(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors) Method responsible to ensure arrival location value and arrival location name value re not blank.protected voidvalidateCabinClass(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.protected booleanvalidateDateIsPopulated(String date, org.springframework.validation.Errors errors, String field) Method responsible for checking if date is populateprotected voidvalidateDates(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)protected voidvalidateDepartureAndArrivalDateTimeRange(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors) Method used to validate Departing and Arrival datesprotected voidvalidateDepartureLocation(FareFinderForm fareFinderForm, org.springframework.validation.Errors errors) Method responsible to ensure departure location value and departure location name value re not blank.protected BooleanvalidateFieldFormat(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 failsprotected voidvalidatePassengerTypeQuantity(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 travelingprotected voidvalidateSuggestionValue(String fieldLocationType, String locationSuggestionType, org.springframework.validation.Errors errors) Validates if a value belongs to a given enumeratorprotected voidvalidateTripType(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.Methods inherited from class de.hybris.platform.travelacceleratorstorefront.validators.AbstractTravelValidator
getAttributePrefix, getConfigurationService, getTargetForm, rejectValue, setAttributePrefix, setConfigurationService, setTargetForm, validateBlankField, validateCheckInAndCheckOutDateTimeRange, validateDateFormat, validateDates, validateEmptyField, validateForPastDate, validateGuestsQuantity
-
Constructor Details
-
FareFinderValidator
public FareFinderValidator()
-
-
Method Details
-
supports
-
validate
-
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 typelocationSuggestionType- the location suggestion typeerrors- 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-
-