Package io.jmix.uidata.exception
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.exception.UiExceptionHandler
UiExceptionHandler.UiContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected MessagesFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleandoHandle(UniqueConstraintViolationException exception, UiExceptionHandler.UiContext context) protected StringgetDefaultMessage(String constraintName) protected StringgetMessage(String constraintName) intgetOrder()booleanhandle(Throwable exception, UiExceptionHandler.UiContext context) Handle an exception.
-
Field Details
-
DEFAULT_MESSAGE_PROPERTY
- See Also:
-
MESSAGE_PREFIX
- See Also:
-
messages
-
-
Constructor Details
-
UniqueConstraintViolationHandler
public UniqueConstraintViolationHandler()
-
-
Method Details
-
handle
Description copied from interface:UiExceptionHandlerHandle 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:
handlein interfaceUiExceptionHandler- Parameters:
exception- exception instancecontext- UI context- Returns:
- true if the exception has been successfully handled, false if not
-
doHandle
protected boolean doHandle(UniqueConstraintViolationException exception, UiExceptionHandler.UiContext context) -
getMessage
-
getDefaultMessage
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-