Class ErrorResolver
java.lang.Object
de.hybris.platform.sap.productconfig.frontend.util.impl.ErrorResolver
Utility class to parse specific UI-Errors types from the UI-Error-Binding.
There are 3 Error types:
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
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 List<ErrorMessage>getConflictErrors(org.springframework.validation.BindingResult bindResult) Get for each error of typeConflictErroran error message.protected static List<ErrorMessage>getErrorMessages(List<org.springframework.validation.FieldError> errorList, Predicate<org.springframework.validation.FieldError> filter, Function<org.springframework.validation.FieldError, ErrorMessage> mapper) static List<ErrorMessage>getMandatoryFieldErrors(org.springframework.validation.BindingResult bindResult) Get for each error of typeMandatoryFieldErroran error message.static List<ErrorMessage>getValidationErrors(org.springframework.validation.BindingResult bindResult) Get for each error that is neither of typeMandatoryFieldErrornor of typeConflictErroran error message.static List<ErrorMessage>getValidationErrorsForCstic(org.springframework.validation.BindingResult bindResult, String path) Get for each error that is neither of typeMandatoryFieldErrornor of typeConflictErroran error message.static List<ErrorMessage>getWarnings(org.springframework.validation.BindingResult bindResult) Get for each error that is either of typeMandatoryFieldErroror of typeConflictErroran error message.static List<ErrorMessage>getWarningsForCstic(org.springframework.validation.BindingResult bindResult, 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)
-
Field Details
-
LENGTH_OF_LITERAL_FORMATTED_VALUE
public static final int LENGTH_OF_LITERAL_FORMATTED_VALUE- See Also:
-
-
Method Details
-
getConflictErrors
public static 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 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 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 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 List<ErrorMessage> getValidationErrorsForCstic(org.springframework.validation.BindingResult bindResult, 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 List<ErrorMessage> getWarningsForCstic(org.springframework.validation.BindingResult bindResult, 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 List<ErrorMessage> getErrorMessages(List<org.springframework.validation.FieldError> errorList, Predicate<org.springframework.validation.FieldError> filter, 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)
-