1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.unitedinternet.portal.selenium.utils.logging;
18
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.apache.commons.lang.ArrayUtils;
23
24
25
26
27
28
29
30
31 public class LoggingBean {
32 private String commandName = "";
33
34 private String[] args;
35
36 private String result = "";
37
38 private String callingClass = "";
39
40 private boolean commandSuccessful;
41
42 private boolean waitInvolved;
43
44 private long cmdStartMillis;
45
46 private long cmdEndMillis;
47
48 private String sourceMethod;
49
50 private boolean excludeFromLogging = false;
51
52 private long waitDeltaMillis = 0;
53
54 private List<LoggingBean> children = new ArrayList<LoggingBean>();
55
56 public void addChild(LoggingBean loggingBean) {
57 children.add(loggingBean);
58 }
59
60 public List<LoggingBean> getChildren() {
61 return children;
62 }
63
64 public boolean hasChildren() {
65 return getChildren().size() > 0;
66 }
67
68 public String getCommandName() {
69 return commandName;
70 }
71
72 public void setCommandName(String commandName) {
73 this.commandName = commandName;
74 }
75
76 public String[] getArgs() {
77 return (String[]) ArrayUtils.clone(args);
78 }
79
80 public void setArgs(String[] args) {
81 this.args = (String[]) ArrayUtils.clone(args);
82 }
83
84 public String getResult() {
85 return result;
86 }
87
88 public void setResult(String result) {
89 this.result = result;
90 }
91
92 public String getCallingClass() {
93 return callingClass;
94 }
95
96 public void setCallingClass(String callingClass) {
97 this.callingClass = callingClass;
98 }
99
100 public boolean isCommandSuccessful() {
101 return commandSuccessful;
102 }
103
104 public void setCommandSuccessful(boolean commandSuccessful) {
105 this.commandSuccessful = commandSuccessful;
106 }
107
108
109
110
111
112
113 public String getSrcResult() {
114 String[] results = this.result.split(",");
115 String srcResult = "";
116 if (results.length > 0) {
117 srcResult = results[0];
118 }
119 return srcResult;
120 }
121
122
123
124
125
126
127 public String getSelResult() {
128 int firstCommaIndex = this.result.indexOf(",");
129 return this.result.substring(firstCommaIndex + 1);
130 }
131
132
133
134
135
136
137 @Override
138 public String toString() {
139 return "commandName=" + commandName + ", args=" + ArrayUtils.toString(args);
140 }
141
142 public long getCmdStartMillis() {
143 return cmdStartMillis;
144 }
145
146 public void setCmdStartMillis(long cmdStartMillis) {
147 this.cmdStartMillis = cmdStartMillis;
148 }
149
150 public long getCmdEndMillis() {
151 return cmdEndMillis;
152 }
153
154 public void setCmdEndMillis(long cmdEndMillis) {
155 this.cmdEndMillis = cmdEndMillis;
156 }
157
158 public boolean isWaitInvolved() {
159 return waitInvolved;
160 }
161
162 public void setWaitInvolved(boolean waitInvolved) {
163 this.waitInvolved = waitInvolved;
164 }
165
166 public String getSourceMethod() {
167 return sourceMethod;
168 }
169
170 public void setSourceMethod(String sourceMethod) {
171 this.sourceMethod = sourceMethod;
172 }
173
174
175
176
177
178
179
180
181
182
183
184
185 public long getDeltaMillis() {
186 if (getWaitDeltaMillis() > 0) {
187 return getWaitDeltaMillis();
188 } else {
189 return this.cmdEndMillis - this.cmdStartMillis;
190 }
191 }
192
193 public boolean isExcludeFromLogging() {
194 return excludeFromLogging;
195 }
196
197 public void setExcludeFromLogging(boolean excludeFromLogging) {
198 this.excludeFromLogging = excludeFromLogging;
199 }
200
201 public long getWaitDeltaMillis() {
202 return waitDeltaMillis;
203 }
204
205 public void setWaitDeltaMillis(long waitDeltaMillis) {
206 this.waitDeltaMillis = waitDeltaMillis;
207 }
208 }