1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.form;
17
18 import org.kuali.rice.core.api.util.type.KualiDecimal;
19 import org.springframework.web.multipart.MultipartFile;
20
21 import java.io.Serializable;
22 import java.text.SimpleDateFormat;
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.Calendar;
26 import java.util.Date;
27 import java.util.HashMap;
28 import java.util.List;
29 import java.util.Map;
30
31
32
33
34
35
36 public class UITestObject implements Serializable {
37 private static final long serialVersionUID = -7525378097732916411L;
38
39 private String field1;
40 private String field2;
41 private String field3;
42 private String field4;
43 private String field5;
44 private String field6;
45 private String field7;
46 private String field8;
47
48 private KualiDecimal feeAmount;
49
50 private static int count = 0;
51 private Integer int1 = 1;
52 private Integer int2 = 2;
53 private Integer int3 = 3;
54
55 private boolean bfield;
56 private boolean bfield2;
57
58 private List<String> stringList = Arrays.asList("String1", "String2", "String3");
59
60 private Date date1;
61 private String date1Str;
62
63 static int skipCount2 = 0;
64 private Date date2;
65
66 private MultipartFile fileUpload;
67
68
69
70 private UITestObject innerObject;
71
72 private Map<String, Object> remoteFieldValuesMap;
73
74 private List<UITestObject> subList = new ArrayList<UITestObject>();
75
76 public UITestObject() {
77 remoteFieldValuesMap = new HashMap<String, Object>();
78 remoteFieldValuesMap.put("remoteField1", "Apple");
79 remoteFieldValuesMap.put("remoteField2", "Banana");
80 remoteFieldValuesMap.put("remoteField3", true);
81 remoteFieldValuesMap.put("remoteField4", "Fruit");
82
83 int1 = ++count;
84 int3 = int1 * int2;
85
86 feeAmount = new KualiDecimal(int1);
87
88
89 try {
90 Calendar cal = Calendar.getInstance();
91 cal.set(2010, 1, 1);
92 long offset = cal.getTime().getTime();
93 cal.set(2014, 1, 1);
94 long end = cal.getTime().getTime();
95 long diff = end - offset + 1;
96 date1 = new Date(offset + (long) (Math.random() * diff));
97 date1Str = new SimpleDateFormat("MM/dd/yyyy").format(date1);
98 } catch (Exception e) {
99 e.printStackTrace();
100 }
101
102
103 skipCount2++;
104
105 if (skipCount2 % 5 != 0 && date2 == null) {
106 try {
107 Calendar cal = Calendar.getInstance();
108 cal.set(2010, 1, 1);
109 long offset = cal.getTime().getTime();
110 cal.set(2014, 1, 1);
111 long end = cal.getTime().getTime();
112 long diff = end - offset + 1;
113 date2 = new Date(offset + (long) (Math.random() * diff));
114 } catch (Exception e) {
115 e.printStackTrace();
116 }
117 }
118 }
119
120 public UITestObject(String field1, String field2, String field3, String field4) {
121 this();
122
123 this.field1 = field1;
124 this.field2 = field2;
125 this.field3 = field3;
126 this.field4 = field4;
127 }
128
129 public UITestObject(String field1, String field2, String field3, String field4, String field5, String field6) {
130 this(field1, field2, field3, field4);
131
132 this.field5 = field5;
133 this.field6 = field6;
134 }
135
136 public UITestObject(String field1, String field2, String field3, String field4, String field5, String field6,
137 String field7, String field8) {
138 this(field1, field2, field3, field4, field5, field6);
139
140 this.field7 = field7;
141 this.field8 = field8;
142 }
143
144 public UITestObject(String field1, String field2, String field3, String field4, UITestObject innerObject) {
145 this(field1, field2, field3, field4);
146
147 this.innerObject = innerObject;
148 }
149
150 public String getField1() {
151 return this.field1;
152 }
153
154 public void setField1(String field1) {
155 this.field1 = field1;
156 }
157
158 public String getField2() {
159 return this.field2;
160 }
161
162 public void setField2(String field2) {
163 this.field2 = field2;
164 }
165
166 public String getField3() {
167 return this.field3;
168 }
169
170
171
172
173 public String getDollar3() {
174 if (this.field3 != null && this.field3.length() > 0) {
175 return "$" + this.field3 + ".00";
176 }
177 return this.field3;
178 }
179
180 public void setField3(String field3) {
181 this.field3 = field3;
182 }
183
184 public String getField4() {
185 return this.field4;
186 }
187
188 public void setField4(String field4) {
189 this.field4 = field4;
190 }
191
192 public String getField5() {
193 return field5;
194 }
195
196 public void setField5(String field5) {
197 this.field5 = field5;
198 }
199
200 public String getField6() {
201 return field6;
202 }
203
204 public void setField6(String field6) {
205 this.field6 = field6;
206 }
207
208 public String getField7() {
209 return field7;
210 }
211
212 public void setField7(String field7) {
213 this.field7 = field7;
214 }
215
216 public String getField8() {
217 return field8;
218 }
219
220 public void setField8(String field8) {
221 this.field8 = field8;
222 }
223
224 public KualiDecimal getFeeAmount() {
225 return feeAmount;
226 }
227
228 public void setFeeAmount(KualiDecimal feeAmount) {
229 this.feeAmount = feeAmount;
230 }
231
232 public MultipartFile getFileUpload() {
233 return fileUpload;
234 }
235
236 public void setFileUpload(MultipartFile fileUpload) {
237 this.fileUpload = fileUpload;
238
239 }
240
241
242
243
244
245
246
247
248
249 public void setSubList(List<UITestObject> subList) {
250 this.subList = subList;
251 }
252
253 public List<UITestObject> getSubList() {
254 return subList;
255 }
256
257 public Map<String, Object> getRemoteFieldValuesMap() {
258 return remoteFieldValuesMap;
259 }
260
261 public void setRemoteFieldValuesMap(Map<String, Object> remoteFieldValuesMap) {
262 this.remoteFieldValuesMap = remoteFieldValuesMap;
263 }
264
265 public boolean isBfield() {
266 return bfield;
267 }
268
269 public void setBfield(boolean bfield) {
270 this.bfield = bfield;
271 }
272
273 public boolean isBfield2() {
274 return bfield2;
275 }
276
277 public void setBfield2(boolean bfield2) {
278 this.bfield2 = bfield2;
279 }
280
281 @Override
282 public String toString() {
283 return "" + field1 + field2 + field3 + field4;
284 }
285
286 public List<String> getStringList() {
287 return stringList;
288 }
289
290 public void setStringList(List<String> stringList) {
291 this.stringList = stringList;
292 }
293
294 public UITestObject getInnerObject() {
295 return innerObject;
296 }
297
298 public void setInnerObject(UITestObject innerObject) {
299 this.innerObject = innerObject;
300 }
301
302 public void setInputField1(String field) {
303 field1 = field;
304 }
305
306 public String getInputField1() {
307 return field1;
308 }
309
310 public void setInputField2(String field) {
311 field2 = field;
312 }
313
314 public String getInputField2() {
315 return field2;
316 }
317
318 public void setInputField3(String field) {
319 field3 = field;
320 }
321
322 public String getInputField3() {
323 return field3;
324 }
325
326 public void setInputField4(String field) {
327 field4 = field;
328 }
329
330 public String getInputField4() {
331 return field4;
332 }
333
334 public Integer getInt1() {
335 return int1;
336 }
337
338 public void setInt1(Integer int1) {
339 this.int1 = int1;
340 }
341
342 public Integer getInt2() {
343 return int2;
344 }
345
346 public void setInt2(Integer int2) {
347 this.int2 = int2;
348 }
349
350 public Integer getInt3() {
351 return int3;
352 }
353
354 public void setInt3(Integer int3) {
355 this.int3 = int3;
356 }
357
358 public Date getDate1() {
359 return date1;
360 }
361
362 public void setDate1(Date date1) {
363 this.date1 = date1;
364 }
365
366 public String getDate1Str() {
367 return date1Str;
368 }
369
370 public void setDate1Str(String date1Str) {
371 this.date1Str = date1Str;
372 }
373
374 public Date getDate2() {
375 return date2;
376 }
377
378 public void setDate2(Date date2) {
379 this.date2 = date2;
380 }
381 }
382