Class UniqueConstraintViolationHandler

java.lang.Object
io.jmix.uidata.exception.UniqueConstraintViolationHandler
All Implemented Interfaces:
UiExceptionHandler, org.springframework.core.Ordered

@Component("ui_UniqueConstraintViolationHandler") public class UniqueConstraintViolationHandler extends Object implements UiExceptionHandler, org.springframework.core.Ordered
Handles database unique constraint violations. Determines the exception type by searching a special marker string in the messages of all exceptions in the chain.
  • Field Details

  • Constructor Details

    • UniqueConstraintViolationHandler

      public UniqueConstraintViolationHandler()
  • Method Details

    • handle

      public boolean handle(Throwable exception, UiExceptionHandler.UiContext context)
      Description copied from interface: UiExceptionHandler
      Handle an exception. Implementation class should either handle the exception and return true, or return false to delegate execution to the next handler in the chain of responsibility.
      Specified by:
      handle in interface UiExceptionHandler
      Parameters:
      exception - exception instance
      context - UI context
      Returns:
      true if the exception has been successfully handled, false if not
    • doHandle

      protected boolean doHandle(UniqueConstraintViolationException exception, UiExceptionHandler.UiContext context)
    • getMessage

      protected String getMessage(String constraintName)
    • getDefaultMessage

      protected String getDefaultMessage(String constraintName)
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered