Class AbstractTravelValidator
java.lang.Object
de.hybris.platform.travelacceleratorstorefront.validators.AbstractTravelValidator
- All Implemented Interfaces:
org.springframework.validation.Validator
- Direct Known Subclasses:
AccommodationAddToCartValidator,AccommodationAvailabilityValidator,AccommodationBookingChangeDateValidator,AccommodationFinderValidator,AddDealToCartFormValidator,AddDealToCartFormValidator,FareFinderValidator,FareFinderValidator
public abstract class AbstractTravelValidator
extends Object
implements org.springframework.validation.Validator
The type Abstract travel validator.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected de.hybris.platform.servicelayer.config.ConfigurationServiceprotected Stringprotected voidrejectValue(org.springframework.validation.Errors errors, String attributeName, String errorCode) Method to add errorsvoidsetAttributePrefix(String attributePrefix) voidsetConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService) voidsetTargetForm(String targetForm) protected BooleanvalidateBlankField(String fieldName, String fieldValue, org.springframework.validation.Errors errors) Method to check if the value of the selected field either empty, null or contains only white spaces and if so it will set a EmptyField error against the fieldprotected voidvalidateCheckInAndCheckOutDateTimeRange(String startDate, String startDateFieldName, String endDate, String endDateFieldName, org.springframework.validation.Errors errors) Method used to validate Check In and Check Out datesprotected BooleanvalidateDateFormat(String date, org.springframework.validation.Errors errors, String field) Method responsible for validating the date formatprotected voidvalidateDates(String startDate, String startDateFieldName, String endDate, String endDateFieldName, org.springframework.validation.Errors errors) protected BooleanvalidateEmptyField(String fieldName, Collection listObject, org.springframework.validation.Errors errors) Method to check if the value of the selected field either empty, null and if so it will set a EmptyField error against the fieldprotected voidvalidateForPastDate(String date, org.springframework.validation.Errors errors, String field) Method check to see if date is a past date and if so sets a PastDate errors for the fieldvoidvalidateGuestsQuantity(String numberOfRooms, List<RoomStayCandidateData> roomStayCandidates, org.springframework.validation.Errors errors) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.validation.Validator
supports, validate
-
Constructor Details
-
AbstractTravelValidator
public AbstractTravelValidator()
-
-
Method Details
-
validateBlankField
protected Boolean validateBlankField(String fieldName, String fieldValue, org.springframework.validation.Errors errors) Method to check if the value of the selected field either empty, null or contains only white spaces and if so it will set a EmptyField error against the field- Parameters:
fieldName-fieldValue-errors-
-
validateDateFormat
protected Boolean validateDateFormat(String date, org.springframework.validation.Errors errors, String field) Method responsible for validating the date format- Parameters:
date-errors-field-- Returns:
-
validateForPastDate
protected void validateForPastDate(String date, org.springframework.validation.Errors errors, String field) Method check to see if date is a past date and if so sets a PastDate errors for the field- Parameters:
date-errors-field-
-
validateDates
-
validateCheckInAndCheckOutDateTimeRange
protected void validateCheckInAndCheckOutDateTimeRange(String startDate, String startDateFieldName, String endDate, String endDateFieldName, org.springframework.validation.Errors errors) Method used to validate Check In and Check Out dates- Parameters:
startDate-startDateFieldName-endDate-endDateFieldName-errors-
-
validateGuestsQuantity
public void validateGuestsQuantity(String numberOfRooms, List<RoomStayCandidateData> roomStayCandidates, org.springframework.validation.Errors errors) - Parameters:
numberOfRooms-roomStayCandidates-errors-
-
validateEmptyField
protected Boolean validateEmptyField(String fieldName, Collection listObject, org.springframework.validation.Errors errors) Method to check if the value of the selected field either empty, null and if so it will set a EmptyField error against the field- Parameters:
fieldName-listObject-errors-
-
rejectValue
protected void rejectValue(org.springframework.validation.Errors errors, String attributeName, String errorCode) Method to add errors- Parameters:
errors-attributeName-errorCode-
-
getTargetForm
-
setTargetForm
-
getAttributePrefix
- Returns:
- the attributePrefix
-
setAttributePrefix
- Parameters:
attributePrefix- the attributePrefix to set
-
getConfigurationService
protected de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService()- Returns:
- the configurationService
-
setConfigurationService
public void setConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService) - Parameters:
configurationService- the configurationService to set
-