Class AbstractSqlExceptionHandler

  • All Implemented Interfaces:
    SqlExceptionHandler

    public abstract class AbstractSqlExceptionHandler
    extends Object
    implements SqlExceptionHandler
    Handler abstrait des exceptions SQL qui peuvent survenir dans un service. Cette classe est abstraite et doit être concretisée par une sous-classe. Dans le cas d'une contrainte d'intégrité référentiel ou d'unicité, le message de l'erreur utilisateur doit être specialisé en l'ajoutant comme ressource dans le RessourceManager en utilisant le nom de la contrainte comme clef.
    Author:
    npiedeloup, evernat
    • Constructor Detail

      • AbstractSqlExceptionHandler

        public AbstractSqlExceptionHandler()
        Crée une nouvelle instance de AbstractSqlExceptionHandler.
    • Method Detail

      • extractConstraintName

        protected abstract String extractConstraintName​(String msg)
        Parameters:
        msg - Message base de données
        Returns:
        Code de la contrainte
      • handleTooLargeValueSqlException

        protected final io.vertigo.core.lang.VUserException handleTooLargeValueSqlException​(SQLException sqle)
        Parameters:
        sqle - Exception base de données
      • handleUserSQLException

        protected final io.vertigo.core.lang.VUserException handleUserSQLException​(SQLException sqle)
        Parameters:
        sqle - SQLException launch by SQL (often PLSQL application specific exception with <text> tag)
      • handleConstraintSQLException

        protected final io.vertigo.core.lang.VUserException handleConstraintSQLException​(SQLException sqle,
                                                                                         io.vertigo.core.locale.MessageKey defaultMsg)
        Traite l'exception lié à la contrainte d'intégrité. Et lance une KUserException avec le message par défaut passé en paramètre et une MessageKey basé sur le nom de la contrainte.
        Parameters:
        sqle - Exception SQL
        defaultMsg - Message par defaut
      • handleForeignConstraintSQLException

        protected final io.vertigo.core.lang.VUserException handleForeignConstraintSQLException​(SQLException sqle)
        Parameters:
        sqle - ForeignConstraintSQLException
      • handleUniqueConstraintSQLException

        protected final io.vertigo.core.lang.VUserException handleUniqueConstraintSQLException​(SQLException sqle)
        Parameters:
        sqle - UniqueConstraintSQLException
      • handleOtherSQLException

        protected final RuntimeException handleOtherSQLException​(SQLException sqle,
                                                                 String statementInfos)
        Parameters:
        sqle - OtherSQLException
        statementInfos - the statement