01: package com.bostechcorp.cbesb.console.common;
02:
03: import com.google.gwt.user.client.rpc.IsSerializable;
04:
05: public class BaseRPCResultInfo implements IRPCResultInfo,
06: IsSerializable {
07: protected boolean isError;
08: protected String exceptionText;
09: protected String exceptionTrace;
10: protected int callType;
11:
12: protected String result;
13: protected String source;
14:
15: public boolean isError() {
16: return isError;
17: }
18:
19: public void setError(boolean isError) {
20: this .isError = isError;
21: }
22:
23: public String getExceptionText() {
24: return exceptionText;
25: }
26:
27: public String getExceptionTrace() {
28: return exceptionTrace;
29: }
30:
31: // call this if we get a server-side exception
32: public void setException(Exception e) {
33: isError = true;
34: exceptionText = e.toString();
35: if (e instanceof ServerSideException)
36: exceptionTrace = ((ServerSideException) e)
37: .getServerStackTrace();
38: else
39: exceptionTrace = ExceptionUtil.stackTraceString(e);
40: }
41:
42: // call this if we get a server-side exception
43: public void setException(String message, Exception e) {
44: isError = true;
45: exceptionText = message;
46: if (e instanceof ServerSideException)
47: exceptionTrace = e.toString() + "\n"
48: + ((ServerSideException) e).getServerStackTrace();
49: else
50: exceptionTrace = e.toString() + "\n"
51: + ExceptionUtil.stackTraceString(e);
52: }
53:
54: // call this if we get a server-side exception
55: //public void setException(Exception e,HttpSession session) {
56: // this.setException(e);
57: // if(e instanceof org.apache.derby.client.am.DisconnectException)
58: // session.setAttribute("DBConnectERROR", "true");
59: //}
60: public void setException(String exceptionText, String exceptionTrace) {
61: isError = true;
62: this .exceptionText = exceptionText;
63: this .exceptionTrace = exceptionTrace;
64: }
65:
66: public int getCallType() {
67: return callType;
68: }
69:
70: public void setCallType(int callType) {
71: this .callType = callType;
72: }
73:
74: public String getResult() {
75: return result;
76: }
77:
78: public void setResult(String result) {
79: this .result = result;
80: }
81:
82: public boolean isDBConnectionError() {
83: return this .exceptionText
84: .startsWith("org.apache.derby.client.am.DisconnectException");
85: }
86:
87: public String getSource() {
88: return source;
89: }
90:
91: public void setSource(String source) {
92: this.source = source;
93: }
94:
95: }
|