Class ErrorResolver
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.frontend.util.impl.ErrorResolver
-
public class ErrorResolver extends java.lang.ObjectUtility class to parse specific UI-Errors types from the UI-Error-Binding.
There are 3 Error types:- ValidationErrors: Indicating that the user input is considered invalid. They have no specific type, just the
default type
FieldError - Conflicts: Indicating that the configuration engine has determined a conflict for one or many cstic(-values).
They are of specific type
ConflictError - Missing Mandatory Fields: Indicating that a cstic has no value assigned, although it is considered mandatory by
configuration engine. They are of specific type
MandatoryFieldError
- ValidationErrors: Indicating that the user input is considered invalid. They have no specific type, just the
default type
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static ErrorMessagecreateErrorMessageBasedOnType(org.springframework.validation.FieldError objError)protected static ErrorMessagecreateErrorMessageForConflictType(org.springframework.validation.FieldError objError)protected static ErrorMessagecreateErrorMessageForErrorType(org.springframework.validation.FieldError objError)protected static ErrorMessagecreateErrorMessageForType(org.springframework.validation.FieldError objError, ErrorType type)protected static ErrorMessagecreateErrorMessageMandatoryFieldType(org.springframework.validation.FieldError objError)static java.util.List<ErrorMessage>getConflictErrors(org.springframework.validation.BindingResult bindResult)Get for each error of typeConflictErroran error message.protected static java.util.List<ErrorMessage>getErrorMessages(java.util.List<org.springframework.validation.FieldError> errorList, java.util.function.Predicate<org.springframework.validation.FieldError> filter, java.util.function.Function<org.springframework.validation.FieldError,ErrorMessage> mapper)static java.util.List<ErrorMessage>getMandatoryFieldErrors(org.springframework.validation.BindingResult bindResult)Get for each error of typeMandatoryFieldErroran error message.static java.util.List<ErrorMessage>getValidationErrors(org.springframework.validation.BindingResult bindResult)Get for each error that is neither of typeMandatoryFieldErrornor of typeConflictErroran error message.static java.util.List<ErrorMessage>getValidationErrorsForCstic(org.springframework.validation.BindingResult bindResult, java.lang.String path)Get for each error that is neither of typeMandatoryFieldErrornor of typeConflictErroran error message.static java.util.List<ErrorMessage>getWarnings(org.springframework.validation.BindingResult bindResult)Get for each error that is either of typeMandatoryFieldErroror of typeConflictErroran error message.static java.util.List<ErrorMessage>getWarningsForCstic(org.springframework.validation.BindingResult bindResult, java.lang.String path)Get for each error that is either of typeMandatoryFieldErroror of typeConflictErroran error message.
The Result is filtered for the given cstic path.static booleanhasErrorMessages(org.springframework.validation.BindingResult bindResult)Checks whether the configuration has at lest one classical ValidationError, so an error that is neither of typeMandatoryFieldErrornor of typeConflictError.protected static booleanisConfigError(org.springframework.validation.FieldError error)protected static booleanisErrorMessage(org.springframework.validation.FieldError objError)protected static booleanisMandatoryFieldError(org.springframework.validation.FieldError error)protected static booleanisWarningMessage(org.springframework.validation.FieldError objError)
-
-
-
Method Detail
-
getConflictErrors
public static java.util.List<ErrorMessage> getConflictErrors(org.springframework.validation.BindingResult bindResult)
Get for each error of typeConflictErroran error message.- Parameters:
bindResult- all UI errors- Returns:
- list of error messages
-
getMandatoryFieldErrors
public static java.util.List<ErrorMessage> getMandatoryFieldErrors(org.springframework.validation.BindingResult bindResult)
Get for each error of typeMandatoryFieldErroran error message.- Parameters:
bindResult- all UI errors- Returns:
- list of error messages
-
getWarnings
public static java.util.List<ErrorMessage> getWarnings(org.springframework.validation.BindingResult bindResult)
Get for each error that is either of typeMandatoryFieldErroror of typeConflictErroran error message.- Parameters:
bindResult- all UI errors- Returns:
- list of error messages
-
getValidationErrors
public static java.util.List<ErrorMessage> getValidationErrors(org.springframework.validation.BindingResult bindResult)
Get for each error that is neither of typeMandatoryFieldErrornor of typeConflictErroran error message. Those errors are the classical validation errors.- Parameters:
bindResult- all UI errors- Returns:
- list of error messages
-
getValidationErrorsForCstic
public static java.util.List<ErrorMessage> getValidationErrorsForCstic(org.springframework.validation.BindingResult bindResult, java.lang.String path)
Get for each error that is neither of typeMandatoryFieldErrornor of typeConflictErroran error message. Those errors are the classical validation errors.
The Result is filtered for the given cstic path.- Parameters:
bindResult- all UI errorspath- UI path identifying a cstic- Returns:
- list of error messages
-
hasErrorMessages
public static boolean hasErrorMessages(org.springframework.validation.BindingResult bindResult)
Checks whether the configuration has at lest one classical ValidationError, so an error that is neither of typeMandatoryFieldErrornor of typeConflictError.- Parameters:
bindResult- all UI errors- Returns:
trueonly if at least one validation error exists.
-
getWarningsForCstic
public static java.util.List<ErrorMessage> getWarningsForCstic(org.springframework.validation.BindingResult bindResult, java.lang.String path)
Get for each error that is either of typeMandatoryFieldErroror of typeConflictErroran error message.
The Result is filtered for the given cstic path.- Parameters:
bindResult- all UI errorspath- UI path identifying a cstic- Returns:
- list of error messages
-
isWarningMessage
protected static boolean isWarningMessage(org.springframework.validation.FieldError objError)
-
isErrorMessage
protected static boolean isErrorMessage(org.springframework.validation.FieldError objError)
-
createErrorMessageBasedOnType
protected static ErrorMessage createErrorMessageBasedOnType(org.springframework.validation.FieldError objError)
-
createErrorMessageMandatoryFieldType
protected static ErrorMessage createErrorMessageMandatoryFieldType(org.springframework.validation.FieldError objError)
-
createErrorMessageForConflictType
protected static ErrorMessage createErrorMessageForConflictType(org.springframework.validation.FieldError objError)
-
createErrorMessageForErrorType
protected static ErrorMessage createErrorMessageForErrorType(org.springframework.validation.FieldError objError)
-
createErrorMessageForType
protected static ErrorMessage createErrorMessageForType(org.springframework.validation.FieldError objError, ErrorType type)
-
getErrorMessages
protected static java.util.List<ErrorMessage> getErrorMessages(java.util.List<org.springframework.validation.FieldError> errorList, java.util.function.Predicate<org.springframework.validation.FieldError> filter, java.util.function.Function<org.springframework.validation.FieldError,ErrorMessage> mapper)
-
isMandatoryFieldError
protected static boolean isMandatoryFieldError(org.springframework.validation.FieldError error)
-
isConfigError
protected static boolean isConfigError(org.springframework.validation.FieldError error)
-
-