01: package com.sun.portal.app.filesharing.repo;
02:
03: /**
04: * @author Alejandro Abdelnur
05: */
06: public class RepoException extends Exception {
07: private String _id;
08: private RepoItem _item;
09:
10: /**
11: * Creates an FSException.
12: * <p>
13: * @param id unique ID identifying the location in the code where the exception was thrown.
14: * @param message message for the exception.
15: * @param item the RepoItem the operation failed on.
16: * @param cause a embedded exception.
17: *
18: */
19: public RepoException(String id, String message, RepoItem item,
20: Throwable cause) {
21: super (message, cause);
22: _id = id;
23: _item = item;
24: }
25:
26: /**
27: * Creates an FSException.
28: * <p>
29: * @param id unique ID identifying the location in the code where the exception was thrown.
30: * @param message message for the exception.
31: * @param item the RepoItem the operation failed on.
32: *
33: */
34: public RepoException(String id, String message, RepoItem item) {
35: this (id, message, item, null);
36: }
37:
38: /**
39: * Creates an FSException.
40: * <p>
41: * @param id unique ID identifying the location in the code where the exception was thrown.
42: * @param message message for the exception.
43: *
44: */
45: public RepoException(String id, String message) {
46: this (id, message, null, null);
47: }
48:
49: /**
50: * Returns the unique ID identifying the location in the code where the exception was thrown.
51: * <p>
52: * @return the unique ID.
53: *
54: */
55: public String getId() {
56: return _id;
57: }
58:
59: /**
60: * Returns the RepoItem the operation failed on.
61: * <p>
62: * @return the RepoItem.
63: *
64: */
65: public RepoItem getItem() {
66: return _item;
67: }
68:
69: /**
70: * Returns the exception message.
71: * <p>
72: * The format of the returned string is '${id} - ${message} - ${item}'
73: * <p>
74: * @return the exception message.
75: *
76: */
77: public String getMessage() {
78: return _id + " - " + super .getMessage() + " - " + _item;
79: }
80:
81: }
|