1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package openr66.context;
22
23 import openr66.context.filesystem.R66File;
24 import openr66.database.data.DbTaskRunner;
25 import openr66.protocol.exception.OpenR66Exception;
26
27
28
29
30
31
32
33 public class R66Result {
34
35
36
37 public OpenR66Exception exception = null;
38
39
40
41 public R66File file = null;
42
43
44
45 public DbTaskRunner runner = null;
46
47
48
49 public boolean isAnswered = false;
50
51
52
53 public ErrorCode code;
54
55
56
57 public Object other = null;
58
59
60
61
62
63
64
65
66 public R66Result(OpenR66Exception exception, R66Session session,
67 boolean isAnswered, ErrorCode code, DbTaskRunner runner) {
68 this.exception = exception;
69 this.runner = runner;
70 if (session != null) {
71 file = session.getFile();
72 this.runner = session.getRunner();
73 }
74 this.isAnswered = isAnswered;
75 this.code = code;
76 }
77
78
79
80
81
82
83
84 public R66Result(R66Session session, boolean isAnswered, ErrorCode code,
85 DbTaskRunner runner) {
86 this.runner = runner;
87 if (session != null) {
88 file = session.getFile();
89 this.runner = session.getRunner();
90 }
91 this.isAnswered = isAnswered;
92 this.code = code;
93 }
94
95 @Override
96 public String toString() {
97 return (exception != null? "Exception: " + exception.toString() : "") +
98 (file != null? file.toString() : " no file") + "\n "+
99 (runner != null? runner.toShortString() : " no runner") +
100 " isAnswered: " + isAnswered + " Code: " + code.mesg;
101 }
102
103
104
105
106 public String getMessage() {
107 if (exception != null) {
108 return exception.getMessage();
109 } else {
110 return code.mesg;
111 }
112 }
113 }