01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-api/api/src/java/org/sakaiproject/metaobj/shared/model/PersistenceException.java $
03: * $Id: PersistenceException.java 8052 2006-04-20 18:16:21Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.metaobj.shared.model;
21:
22: import java.text.MessageFormat;
23:
24: public class PersistenceException extends OspException {
25:
26: private String errorCode;
27: private Object[] errorInfo;
28: private String field;
29:
30: public PersistenceException(String errorCode, Object[] errorInfo,
31: String field) {
32: this .errorCode = errorCode;
33: this .errorInfo = errorInfo;
34: this .field = field;
35: }
36:
37: public PersistenceException(String message, String errorCode,
38: Object[] errorInfo, String field) {
39: super (message);
40: this .errorCode = errorCode;
41: this .errorInfo = errorInfo;
42: this .field = field;
43: }
44:
45: public PersistenceException(String message, Throwable cause,
46: String errorCode, Object[] errorInfo, String field) {
47: super (message, cause);
48: this .errorCode = errorCode;
49: this .errorInfo = errorInfo;
50: this .field = field;
51: }
52:
53: public PersistenceException(Throwable cause, String errorCode,
54: Object[] errorInfo, String field) {
55: super (cause);
56: this .errorCode = errorCode;
57: this .errorInfo = errorInfo;
58: this .field = field;
59: }
60:
61: public String getErrorCode() {
62: return errorCode;
63: }
64:
65: public Object[] getErrorInfo() {
66: return errorInfo;
67: }
68:
69: public String getField() {
70: return field;
71: }
72:
73: public String getDefaultMessage() {
74: return MessageFormat.format(getErrorCode(), getErrorInfo());
75: }
76: }
|