01: /**
02: * $Id: AlertHandler.java,v 1.2 2006/04/17 20:08:41 jtb Exp $
03: * Copyright 2003 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.rssportlet;
14:
15: public class AlertHandler {
16: private String successSummary = null;
17: private String errorSummary = null;
18: private String successDetail = null;
19: private String errorDetail = null;
20:
21: private boolean successRendered = false;
22: private boolean errorRendered = false;
23:
24: public String getSuccessSummary() {
25: String s = successSummary;
26: return s;
27: }
28:
29: public String getSuccessDetail() {
30: String s = successDetail;
31: return s;
32: }
33:
34: public void setSuccess(String successSummary) {
35: successRendered = true;
36: this .successSummary = successSummary;
37: this .successDetail = null;
38: }
39:
40: public void setSuccess(String successSummary, String successDetail) {
41: successRendered = true;
42: this .successSummary = successSummary;
43: this .successDetail = successDetail;
44: }
45:
46: public void setSuccess(String successSummary, Throwable t) {
47: successRendered = true;
48: this .successSummary = successSummary;
49: this .successDetail = t.getMessage();
50: }
51:
52: public String getErrorSummary() {
53: String s = errorSummary;
54: return s;
55: }
56:
57: public String getErrorDetail() {
58: String s = errorDetail;
59: return s;
60: }
61:
62: public void setError(String errorSummary) {
63: errorRendered = true;
64: this .errorSummary = errorSummary;
65: this .errorDetail = null;
66: }
67:
68: public void setError(String errorSummary, String errorDetail) {
69: errorRendered = true;
70: this .errorSummary = errorSummary;
71: this .errorDetail = errorDetail;
72: }
73:
74: public void setError(String errorSummary, Throwable t) {
75: errorRendered = true;
76: this .errorSummary = errorSummary;
77: this .errorDetail = t.getMessage();
78: }
79:
80: public boolean isSuccessRendered() {
81: boolean r = successRendered;
82: if (successRendered) {
83: successRendered = false;
84: }
85: return r;
86: }
87:
88: public boolean isErrorRendered() {
89: boolean r = errorRendered;
90: if (errorRendered) {
91: errorRendered = false;
92: }
93: return r;
94: }
95:
96: public boolean isErrorExists() {
97: return errorRendered;
98: }
99: }
|