java.lang.Object
overit.geocallapp.utilities.core.bl.common.validation.ValidationHelper

public class ValidationHelper extends Object
Utility class that provides validation methods for common validation scenarios. The class uses a singleton pattern per company, with instances cached in a static map.
Since:
1.0
  • Constructor Details

    • ValidationHelper

      public ValidationHelper()
  • Method Details

    • getValidationHelper

      public static ValidationHelper getValidationHelper()
      Returns the validation helper.
      Returns:
      the ValidationHelper
    • validateNotNullField

      public void validateNotNullField(String fieldName, Object fieldValue, boolean isInsertOperation) throws DAValidateException
      Validates if a required field has a value.
      Parameters:
      fieldName - the field name
      fieldValue - the field value
      isInsertOperation - true if the validation is linked to an insertion operation, false otherwise
      Throws:
      DAValidateException - if the field value is null or empty (in the case of a string)
    • validateFieldLength

      public void validateFieldLength(String fieldName, Object fieldValue, int fieldLength) throws DAValidateException
      Validates the length of a field.
      Parameters:
      fieldName - the field name
      fieldValue - the field value
      fieldLength - the maximum field length
      Throws:
      DAValidateException - if the field value length is greater than maximum field length
    • validateDateInterval

      public void validateDateInterval(String startDateName, String endDateName, Date startDate, Date endDate) throws DAValidateException
      Validates if the start date of an interval is before or equal to the end date.
      Parameters:
      startDateName - the start date name
      endDateName - the end date name
      startDate - the start date
      endDate - the end date
      Throws:
      DAValidateException - if start date is after the end date
    • validateEntityExistence

      public <O> void validateEntityExistence(Class<? extends LoadEvent<O>> loadEventClass, Long id, PoolKit poolKit) throws DAValidateException, DAException
      Validates the existence of an entity.
      Type Parameters:
      O - the type of the entity
      Parameters:
      loadEventClass - the class of load entity
      id - the identifier of the entity
      poolKit - the PoolKit to use for launch the load event
      Throws:
      DAValidateException - if the entity doesn't exist
      DAException - the DA exception