View Javadoc

    1   package org.example.customerdao.utility;
    2
    3   /*
    4    * This is free and unencumbered software released into the public domain.
    5    * Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software,
    6    * either in source code form or as a compiled binary, for any purpose, commercial or
    7    * non-commercial, and by any means.
    8    *
    9    * In jurisdictions that recognize copyright laws, the author or authors of this
    10   * software dedicate any and all copyright interest in the software to the public domain.
    11   * We make this dedication for the benefit of the public at large and to the detriment of
    12   * our heirs and successors. We intend this dedication to be an overt act of relinquishment in
    13   * perpetuity of all present and future rights to this software under copyright law.
    14   *
    15   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
    16   * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
    17   * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES
    18   * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    20   *
    21   * For more information, please refer to: https://unlicense.org/
    22  */
    23
    24  import java.io.Serializable;
    25
    26  import org.apache.logging.log4j.LogManager;
    27  import org.apache.logging.log4j.Logger;
    28
    29  /**
    30   * The NonDeleteableRecordException class for the <strong>CustomerDAO</strong>.
    31   *
    32   * @author Jonathan Earl
    33   * @version 1.0
    34   *
    35   */
    36  public final class NonDeleteableRecordException extends RuntimeException
    37     implements Serializable
    38  {
    39      private static final long serialVersionUID = 1L;
    40      private static final Logger LOG = LogManager.getLogger();
    41
    42      /**
    43       * Default Constructor.
    44       *
    45       * Sets the message to "Unknown Service Error"
    46       */
    47      public NonDeleteableRecordException()
    48      {
    49          super("Record is not deleteable");
    50          LOG.error("Record is not deleteable");
    51      }
    52
    53      /**
    54       * Constructor.
    55       *
    56       * @param message the message to set
    57       * @see NonDeleteableRecordException#NonDeleteableRecordException()
    58       */
    59      public NonDeleteableRecordException(final String message)
    60      {
    61          super(message);
    62          LOG.error(message);
    63      }
    64
    65      /**
    66       * Throwable Constructor.
    67       *
    68       * @param message the message to set
    69       * @param cause the inner exception
    70       * @see NonDeleteableRecordException#NonDeleteableRecordException()
    71       * @see NonDeleteableRecordException#NonDeleteableRecordException(String message)
    72       */
    73      public NonDeleteableRecordException(final String message, final Throwable cause)
    74      {
    75          super(message, cause);
    76          LOG.error(message + " - " + cause.getLocalizedMessage());
    77      }
    78
    79      /**
    80       * Throwable Constructor.
    81       *
    82       * @param cause the inner exception
    83       * @see NonDeleteableRecordException#NonDeleteableRecordException()
    84       * @see NonDeleteableRecordException#NonDeleteableRecordException(String message)
    85       * @see NonDeleteableRecordException#NonDeleteableRecordException(String message, Throwable cause)
    86       */
    87      public NonDeleteableRecordException(final Throwable cause)
    88      {
    89          super(cause);
    90          LOG.error(cause.getLocalizedMessage());
    91      }
    92  }