Class TravelFormValidator

java.lang.Object
de.hybris.platform.traveladdon.validators.TravelFormValidator
Direct Known Subclasses:
APIFormValidator, CheckInValidator

public abstract class TravelFormValidator extends Object
Abstract form validator class containing common methods to validate travel specific forms
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    rejectValue(org.springframework.validation.Errors errors, String attributeName, String errorCode)
    Method to add errors
    void
    rejectValue(org.springframework.validation.Errors errors, String attributeName, String errorCode, String[] params)
    Method to add errors with parameters
    boolean
    validateAgainstRegEx(String value, org.springframework.validation.Errors errors, String attributeName, String expression)
    Method to validate value against a given expression.
    boolean
    validateDateFormat(String date, org.springframework.validation.Errors errors, String field)
    Method responsible for validating the date format
    boolean
    validateDocumentType(String documentType, org.springframework.validation.Errors errors, String attributeName)
    Validates the documentType provided with the DocumentType ENUM.
    boolean
    validateIsBlankField(String fieldValue, org.springframework.validation.Errors errors, String fieldName)
    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
    boolean
    validateIsFutureDate(String date, org.springframework.validation.Errors errors, String field)
    Method returns true if the date is in the future.
    boolean
    validateIsPastDate(String date, org.springframework.validation.Errors errors, String field)
    Method returns true if the date is in the past.
    boolean
    validateMaxLength(String value, org.springframework.validation.Errors errors, String attributeName, int maxLength)
    Method checks to see if the value exceeds the maxLength.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TravelFormValidator

      public TravelFormValidator()
  • Method Details

    • validateDateFormat

      public boolean validateDateFormat(String date, org.springframework.validation.Errors errors, String field)
      Method responsible for validating the date format
      Parameters:
      date -
      errors -
      field -
      Returns:
    • validateIsPastDate

      public boolean validateIsPastDate(String date, org.springframework.validation.Errors errors, String field)
      Method returns true if the date is in the past. Date is evaluated on the current date.
      Parameters:
      date -
      errors -
      field -
      Returns:
    • validateIsFutureDate

      public boolean validateIsFutureDate(String date, org.springframework.validation.Errors errors, String field)
      Method returns true if the date is in the future. Date is evaluated on the current date.
      Parameters:
      date -
      errors -
      field -
      Returns:
    • validateIsBlankField

      public boolean validateIsBlankField(String fieldValue, org.springframework.validation.Errors errors, String fieldName)
      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:
      fieldValue -
      errors -
      fieldName -
      Returns:
    • validateDocumentType

      public boolean validateDocumentType(String documentType, org.springframework.validation.Errors errors, String attributeName)
      Validates the documentType provided with the DocumentType ENUM. If the documentType provided is not a valid DocumentType, an error will be added to the list of validation errors
      Parameters:
      documentType -
      errors -
      attributeName -
      Returns:
    • validateAgainstRegEx

      public boolean validateAgainstRegEx(String value, org.springframework.validation.Errors errors, String attributeName, String expression)
      Method to validate value against a given expression. Method will return false if regex fails and true if regex passes.
      Parameters:
      value -
      errors -
      attributeName -
      expression -
      Returns:
    • validateMaxLength

      public boolean validateMaxLength(String value, org.springframework.validation.Errors errors, String attributeName, int maxLength)
      Method checks to see if the value exceeds the maxLength. Method returns true if it does and false if it doesn't.
      Parameters:
      value -
      errors -
      attributeName -
      maxLength -
      Returns:
    • rejectValue

      public void rejectValue(org.springframework.validation.Errors errors, String attributeName, String errorCode)
      Method to add errors
      Parameters:
      errors -
      attributeName -
      errorCode -
    • rejectValue

      public void rejectValue(org.springframework.validation.Errors errors, String attributeName, String errorCode, String[] params)
      Method to add errors with parameters
      Parameters:
      errors -
      attributeName -
      errorCode -