2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
18 package org.collectionspace.services.common.document;
21 * TransactionException
24 public class TransactionException extends DocumentException {
29 private static final long serialVersionUID = 1L;
31 // Custom HTTP status code, per the extensibility offered via RFC-2616
32 // e.g. http://tools.ietf.org/html/rfc2616#section-6.1.1
33 final public static int HTTP_CODE = 590;
35 final static String TRANSACTION_FAILED_MSG =
36 "A transaction failed, whether due to exceeding a timeout value or some other cause. Please contact your system administrator.";
39 * Creates a new instance of <code>TransactionException</code> without detail message.
41 public TransactionException() {
42 super(TRANSACTION_FAILED_MSG);
43 setErrorCode(HTTP_CODE);
47 * Constructs an instance of <code>TransactionException</code> with the specified detail message.
48 * @param msg the detail message.
50 public TransactionException(String msg) {
52 setErrorCode(HTTP_CODE);
56 * Constructs a new exception with the specified detail message and
57 * cause. <p>Note that the detail message associated with
58 * <code>cause</code> is <i>not</i> automatically incorporated in
59 * this exception's detail message.
61 * @param message the detail message (which is saved for later retrieval
62 * by the {@link #getMessage()} method).
63 * @param cause the cause (which is saved for later retrieval by the
64 * {@link #getCause()} method). (A <tt>null</tt> value is
65 * permitted, and indicates that the cause is nonexistent or
69 public TransactionException(String message, Throwable cause) {
70 super(message, cause);
71 setErrorCode(HTTP_CODE);
75 * Constructs a new exception with the specified cause and a detail
76 * message of <tt>(cause==null ? null : cause.toString())</tt> (which
77 * typically contains the class and detail message of <tt>cause</tt>).
78 * This constructor is useful for exceptions that are little more than
79 * wrappers for other throwables (for example, {@link
80 * java.security.PrivilegedActionException}).
82 * @param cause the cause (which is saved for later retrieval by the
83 * {@link #getCause()} method). (A <tt>null</tt> value is
84 * permitted, and indicates that the cause is nonexistent or
88 public TransactionException(Throwable cause) {
89 super(TRANSACTION_FAILED_MSG, cause);
90 setErrorCode(HTTP_CODE);