Class UniqueConstraintViolationHandler

java.lang.Object
io.jmix.flowuidata.exception.UniqueConstraintViolationHandler
All Implemented Interfaces:
UiExceptionHandler

@Component("flowui_UniqueConstraintViolationHandler") @Order(160) public class UniqueConstraintViolationHandler extends Object implements UiExceptionHandler
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(Messages messages, Notifications notifications)
  • Method Details

    • handle

      public boolean handle(Throwable exception)
      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 - throwable instance
      Returns:
      true if the exception has been successfully handled, false if not
    • doHandle

      protected boolean doHandle(UniqueConstraintViolationException exception)
    • getMessage

      protected String getMessage(String constraintName)
    • getDefaultMessage

      protected String getDefaultMessage(String constraintName)