Class Validation

java.lang.Object
com.rosivanyshyn.utils.Validation

public class Validation extends Object
Application validator.
It contains methods to validate data types, fields, and entities
  • Constructor Details

    • Validation

      public Validation()
  • Method Details

    • isValidNumber

      public boolean isValidNumber(String number)
      Check if user entered valid number.
      Parameters:
      number - user input to check
      Returns:
      true if entered text is valid number, false otherwise
    • isValidNumber

      public boolean isValidNumber(Integer number)
      Check if user entered valid number.
      Parameters:
      number - user input to check
      Returns:
      true if entered text is valid number, false otherwise
    • isValidNumber

      public boolean isValidNumber(Long number)
      Check if user entered valid number.
      Parameters:
      number - user input to check
      Returns:
      true if entered text is valid number, false otherwise
    • isValidString

      public boolean isValidString(String string)
      Check if user entered data has string format.
      Parameters:
      string - string to check
      Returns:
      true, if string has valid format
    • isValidDescription

      public boolean isValidDescription(String string)
      Check if user entered data has description format.
      Parameters:
      string - string to check
      Returns:
      true, if string has valid format
    • isValidDate

      public boolean isValidDate(String date)
      Check if user entered data has date format.
      Parameters:
      date - date to check
      Returns:
      true, if data has date format
    • comparisonDataValidator

      public boolean comparisonDataValidator(Date fCheckInData, Date fCheckOutData, Date sCheckInData, Date sCheckOutData)
      Check if second period-of-time does not intersect first
      Parameters:
      fCheckInData - start of first period of time
      fCheckOutData - end of first period of time
      sCheckInData - start of second period of time
      sCheckOutData - end of second period of time
      Returns:
      true, if second period does not intersect first
    • isDataInFutureTime

      public boolean isDataInFutureTime(Date CheckInData)
      Check if entered data isn`t less, than current data
      Parameters:
      CheckInData - date to check
      Returns:
      true, if data is`n belong to pastime
    • isValidLength

      public boolean isValidLength(String string, int length)
      Check whether string length greater than given length param.
      Parameters:
      string - string to check
      length - length
      Returns:
      boolean
    • isValidLength

      public boolean isValidLength(String string, int length, int maxlength)
      Check whether string length greater than given length param.
      Parameters:
      string - string to check
      length - length
      maxlength - max length
      Returns:
      boolean
    • isValidEmail

      public boolean isValidEmail(String email)
      Check whether inputted string has valid email format
      Parameters:
      email - email to check
      Returns:
      boolean
    • isValidRole

      public boolean isValidRole(String role)
      Check if role entered string has AccountRole format.
      Parameters:
      role - role string to check
      Returns:
      true, if role has AccountRole format
    • validateAccount

      public void validateAccount(Account account)
      Validates account parameters.
      Parameters:
      account - account to validate
      Throws:
      ValidationException - validation exception
    • validateApartment

      public void validateApartment(Apartment apartment)
      Validates apartment parameters.
      Parameters:
      apartment - apartment to validate
      Throws:
      ValidationException - validation exception
    • validateBooking

      public void validateBooking(Booking booking, HashMap<Date,Date> otherBookingDates)
      Validates booking parameters.
      Parameters:
      booking - booking to validate
      otherBookingDates - HashMap of existing booking dates, to avoid interception with them. May be NULL.
      Throws:
      ValidationException - validation exception
    • validateOrder

      public void validateOrder(Order order)
      Validates order parameters.
      Parameters:
      order - order to validate
      Throws:
      ValidationException - validation exception
    • validateResponseToOrder

      public void validateResponseToOrder(ResponseToOrder responseToOrder)
      Validates response-to-order parameters.
      Parameters:
      responseToOrder - response-to-order to validate
      Throws:
      ValidationException - validation exception