Package com.rosivanyshyn.utils

# 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 Summary

  Constructors
  Constructor
  Description
  `Validation()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `comparisonDataValidator(Date fCheckInData, Date fCheckOutData, Date sCheckInData, Date sCheckOutData)`
  Check if second period-of-time does not intersect first
  `boolean`
  `isDataInFutureTime(Date CheckInData)`
  Check if entered data isn`t less, than current data
  `boolean`
  `isValidDate(String date)`
  Check if user entered data has date format.
  `boolean`
  `isValidDescription(String string)`
  Check if user entered data has description format.
  `boolean`
  `isValidEmail(String email)`
  Check whether inputted string has valid email format
  `boolean`
  `isValidLength(String string, int length)`
  Check whether string length greater than given length param.
  `boolean`
  `isValidLength(String string, int length, int maxlength)`
  Check whether string length greater than given length param.
  `boolean`
  `isValidNumber(Integer number)`
  Check if user entered valid number.
  `boolean`
  `isValidNumber(Long number)`
  Check if user entered valid number.
  `boolean`
  `isValidNumber(String number)`
  Check if user entered valid number.
  `boolean`
  `isValidRole(String role)`
  Check if role entered string has AccountRole format.
  `boolean`
  `isValidString(String string)`
  Check if user entered data has string format.
  `void`
  `validateAccount(Account account)`
  Validates account parameters.
  `void`
  `validateApartment(Apartment apartment)`
  Validates apartment parameters.
  `void`
  `validateBooking(Booking booking, HashMap<Date,Date> otherBookingDates)`
  Validates booking parameters.
  `void`
  `validateOrder(Order order)`
  Validates order parameters.
  `void`
  `validateResponseToOrder(ResponseToOrder responseToOrder)`
  Validates response-to-order parameters.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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