Package com.skava.oms.util
Class ValidationUtils
java.lang.Object
com.skava.oms.util.ValidationUtils
This class contains the utility method for validation.
- Since:
- Jul 11, 2018
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
static ValidationFieldErrorModel[]
getFieldErrors
(List<org.springframework.validation.FieldError> fieldErrors) getFieldErrors.static ValidationGlobalErrorModel[]
getGlobalErrors
(List<org.springframework.validation.ObjectError> globalErrors) getGlobalErrors.static void
rejectIfNotNullButZero
(org.springframework.validation.Errors errors, String field, ValidationCode errorCode, org.springframework.context.MessageSource messageSource) static void
rejectIfNull
(org.springframework.validation.Errors errors, String field, ValidationCode errorCode, org.springframework.context.MessageSource messageSource) static void
throwOmsValidateException
(com.skava.core.validation.InputModel request, String field, ValidationCode errorCode, String messageKey, org.springframework.context.MessageSource messageSource, Object... values) static void
throwOmsValidateException
(String responseCode, org.springframework.context.MessageSource messageSource)
-
Constructor Details
-
ValidationUtils
public ValidationUtils()
-
-
Method Details
-
getFieldErrors
public static ValidationFieldErrorModel[] getFieldErrors(List<org.springframework.validation.FieldError> fieldErrors) getFieldErrors.
- Parameters:
fieldErrors
- aList
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
- aList
object.- Returns:
- an array of
ValidationGlobalErrorModel
objects. Debug logger has been added to this method.
-
getConstraintMessageCode
- Parameters:
code
- object ofValidationCode
- Returns:
- String
-
rejectIfNotNullButZero
public static void rejectIfNotNullButZero(org.springframework.validation.Errors errors, String field, ValidationCode errorCode, org.springframework.context.MessageSource messageSource) - Parameters:
errors
- object ofErrors
field
- name of the fielderrorCode
- object ofValidationCode
messageSource
- object ofMessageSource
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 ofErrors
field
- name of the fielderrorCode
- object ofValidationCode
messageSource
- object ofMessageSource
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 requestfield
- Name of the field.errorCode
-ValidationCode
}messageKey
- Key of the message string.messageSource
- object ofMessageSource
values
- message values
-
throwOmsValidateException
public static void throwOmsValidateException(String responseCode, org.springframework.context.MessageSource messageSource) - Parameters:
responseCode
-ValidationCode
}messageSource
- object ofMessageSource
-