java.lang.Object
de.hybris.platform.sap.productconfig.frontend.util.impl.ErrorResolver

public class ErrorResolver extends Object
Utility 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
Additionally this class can be used to create UI error messages from the UI errors.
  • 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 type ConflictError an 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 type MandatoryFieldError an 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 type MandatoryFieldError or of type ConflictError an 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 type MandatoryFieldError nor of type ConflictError an 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 type MandatoryFieldError nor of type ConflictError an error message. Those errors are the classical validation errors.
      The Result is filtered for the given cstic path.
      Parameters:
      bindResult - all UI errors
      path - 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 type MandatoryFieldError nor of type ConflictError.
      Parameters:
      bindResult - all UI errors
      Returns:
      true only 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 type MandatoryFieldError or of type ConflictError an error message.
      The Result is filtered for the given cstic path.
      Parameters:
      bindResult - all UI errors
      path - 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)