Class ValidationUtils

java.lang.Object
com.skava.oms.util.ValidationUtils

public class ValidationUtils extends Object
This class contains the utility method for validation.
Since:
Jul 11, 2018
Author:
Infosys Equinox
  • Constructor Details

    • ValidationUtils

      public ValidationUtils()
  • Method Details

    • getFieldErrors

      public static ValidationFieldErrorModel[] getFieldErrors(List<org.springframework.validation.FieldError> fieldErrors)

      getFieldErrors.

      Parameters:
      fieldErrors - a List object.
      Returns:
      an array of ValidationFieldErrorModel objects. Debug logger has been added to this method.
    • getGlobalErrors

      public static ValidationGlobalErrorModel[] getGlobalErrors(List<org.springframework.validation.ObjectError> globalErrors)

      getGlobalErrors.

      Parameters:
      globalErrors - a List object.
      Returns:
      an array of ValidationGlobalErrorModel objects. Debug logger has been added to this method.
    • getConstraintMessageCode

      public static String getConstraintMessageCode(ValidationCode code)
      Parameters:
      code - object of ValidationCode
      Returns:
      String
    • rejectIfNotNullButZero

      public static void rejectIfNotNullButZero(org.springframework.validation.Errors errors, String field, ValidationCode errorCode, org.springframework.context.MessageSource messageSource)
      Parameters:
      errors - object of Errors
      field - name of the field
      errorCode - object of ValidationCode
      messageSource - object of MessageSource Debug logger has been added to this method.
    • rejectIfNull

      public static void rejectIfNull(org.springframework.validation.Errors errors, String field, ValidationCode errorCode, org.springframework.context.MessageSource messageSource)
      Parameters:
      errors - object of Errors
      field - name of the field
      errorCode - object of ValidationCode
      messageSource - object of MessageSource Debug logger has been added to this method.
    • throwOmsValidateException

      public static void throwOmsValidateException(com.skava.core.validation.InputModel request, String field, ValidationCode errorCode, String messageKey, org.springframework.context.MessageSource messageSource, Object... values)
      Parameters:
      request - input model request
      field - Name of the field.
      errorCode - ValidationCode}
      messageKey - Key of the message string.
      messageSource - object of MessageSource
      values - message values
    • throwOmsValidateException

      public static void throwOmsValidateException(String responseCode, org.springframework.context.MessageSource messageSource)
      Parameters:
      responseCode - ValidationCode}
      messageSource - object of MessageSource