1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.api.time.clocklog;
17
18 import org.joda.time.DateTime;
19 import org.kuali.kpme.core.api.KPMEConstants;
20 import org.kuali.kpme.core.api.groupkey.HrGroupKey;
21 import org.kuali.kpme.core.api.job.Job;
22 import org.kuali.rice.core.api.CoreConstants;
23 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
24 import org.kuali.rice.core.api.mo.ModelBuilder;
25 import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
26 import org.w3c.dom.Element;
27
28 import javax.xml.bind.annotation.XmlAccessType;
29 import javax.xml.bind.annotation.XmlAccessorType;
30 import javax.xml.bind.annotation.XmlAnyElement;
31 import javax.xml.bind.annotation.XmlElement;
32 import javax.xml.bind.annotation.XmlRootElement;
33 import javax.xml.bind.annotation.XmlType;
34 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
35 import java.io.Serializable;
36 import java.util.Collection;
37
38 @XmlRootElement(name = ClockLog.Constants.ROOT_ELEMENT_NAME)
39 @XmlAccessorType(XmlAccessType.NONE)
40 @XmlType(name = ClockLog.Constants.TYPE_NAME, propOrder = {
41 ClockLog.Elements.TK_CLOCK_LOG_ID,
42 KPMEConstants.CommonElements.GROUP_KEY_CODE,
43 KPMEConstants.CommonElements.GROUP_KEY,
44 ClockLog.Elements.TASK,
45 ClockLog.Elements.CLOCKED_BY_MISSED_PUNCH,
46 ClockLog.Elements.UNAPPROVED_I_P,
47 ClockLog.Elements.ASSIGNMENT_DESCRIPTION_KEY,
48 ClockLog.Elements.DEPT,
49 ClockLog.Elements.CLOCK_DATE_TIME,
50 ClockLog.Elements.DOCUMENT_ID,
51 ClockLog.Elements.PRINCIPAL_ID,
52 ClockLog.Elements.JOB_NUMBER,
53 ClockLog.Elements.CLOCK_ACTION,
54 ClockLog.Elements.IP_ADDRESS,
55 ClockLog.Elements.USER_PRINCIPAL_ID,
56 ClockLog.Elements.CREATE_TIME,
57 ClockLog.Elements.CLOCK_TIMESTAMP_TIMEZONE,
58 ClockLog.Elements.NEXT_VALID_CLOCK_ACTION,
59 ClockLog.Elements.JOB,
60 ClockLog.Elements.WORK_AREA,
61 CoreConstants.CommonElements.VERSION_NUMBER,
62 CoreConstants.CommonElements.OBJECT_ID,
63 CoreConstants.CommonElements.FUTURE_ELEMENTS
64 })
65 public final class ClockLog
66 extends AbstractDataTransferObject
67 implements ClockLogContract
68 {
69
70 private static final long serialVersionUID = 7754198231707731234L;
71 @XmlElement(name = Elements.TK_CLOCK_LOG_ID, required = false)
72 private final String tkClockLogId;
73
74 @XmlElement(name = KPMEConstants.CommonElements.GROUP_KEY_CODE, required = true)
75 private final String groupKeyCode;
76 @XmlElement(name = KPMEConstants.CommonElements.GROUP_KEY, required = false)
77 private final HrGroupKey groupKey;
78
79 @XmlElement(name = Elements.TASK, required = false)
80 private final Long task;
81 @XmlElement(name = Elements.CLOCKED_BY_MISSED_PUNCH, required = false)
82 private final boolean clockedByMissedPunch;
83 @XmlElement(name = Elements.UNAPPROVED_I_P, required = false)
84 private final boolean unapprovedIP;
85 @XmlElement(name = Elements.ASSIGNMENT_DESCRIPTION_KEY, required = false)
86 private final String assignmentDescriptionKey;
87 @XmlElement(name = Elements.DEPT, required = false)
88 private final String dept;
89 @XmlElement(name = Elements.CLOCK_DATE_TIME, required = false)
90 @XmlJavaTypeAdapter(DateTimeAdapter.class)
91 private final DateTime clockDateTime;
92 @XmlElement(name = Elements.DOCUMENT_ID, required = false)
93 private final String documentId;
94 @XmlElement(name = Elements.PRINCIPAL_ID, required = false)
95 private final String principalId;
96 @XmlElement(name = Elements.JOB_NUMBER, required = false)
97 private final Long jobNumber;
98 @XmlElement(name = Elements.CLOCK_ACTION, required = false)
99 private final String clockAction;
100 @XmlElement(name = Elements.IP_ADDRESS, required = false)
101 private final String ipAddress;
102 @XmlElement(name = Elements.USER_PRINCIPAL_ID, required = false)
103 private final String userPrincipalId;
104 @XmlElement(name = Elements.CREATE_TIME, required = false)
105 @XmlJavaTypeAdapter(DateTimeAdapter.class)
106 private final DateTime createTime;
107 @XmlElement(name = Elements.CLOCK_TIMESTAMP_TIMEZONE, required = false)
108 private final String clockTimestampTimezone;
109 @XmlElement(name = Elements.NEXT_VALID_CLOCK_ACTION, required = false)
110 private final String nextValidClockAction;
111 @XmlElement(name = Elements.JOB, required = false)
112 private final Job job;
113 @XmlElement(name = Elements.WORK_AREA, required = false)
114 private final Long workArea;
115 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
116 private final Long versionNumber;
117 @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
118 private final String objectId;
119 @SuppressWarnings("unused")
120 @XmlAnyElement
121 private final Collection<Element> _futureElements = null;
122
123
124
125
126
127 private ClockLog() {
128 this.tkClockLogId = null;
129 this.task = null;
130 this.groupKeyCode = null;
131 this.groupKey = null;
132 this.clockedByMissedPunch = false;
133 this.unapprovedIP = false;
134 this.assignmentDescriptionKey = null;
135 this.dept = null;
136 this.clockDateTime = null;
137 this.documentId = null;
138 this.principalId = null;
139 this.jobNumber = null;
140 this.clockAction = null;
141 this.ipAddress = null;
142 this.userPrincipalId = null;
143 this.createTime = null;
144 this.clockTimestampTimezone = null;
145 this.nextValidClockAction = null;
146 this.job = null;
147
148
149 this.workArea = null;
150 this.versionNumber = null;
151 this.objectId = null;
152 }
153
154 private ClockLog(Builder builder) {
155 this.tkClockLogId = builder.getTkClockLogId();
156 this.task = builder.getTask();
157 this.clockedByMissedPunch = builder.isClockedByMissedPunch();
158 this.unapprovedIP = builder.isUnapprovedIP();
159 this.assignmentDescriptionKey = builder.getAssignmentDescriptionKey();
160 this.dept = builder.getDept();
161 this.clockDateTime = builder.getClockDateTime();
162 this.documentId = builder.getDocumentId();
163 this.principalId = builder.getPrincipalId();
164 this.jobNumber = builder.getJobNumber();
165 this.clockAction = builder.getClockAction();
166 this.ipAddress = builder.getIpAddress();
167 this.userPrincipalId = builder.getUserPrincipalId();
168 this.createTime = builder.getCreateTime();
169 this.clockTimestampTimezone = builder.getClockTimestampTimezone();
170 this.nextValidClockAction = builder.getNextValidClockAction();
171 this.job = builder.getJob() == null ? null : builder.getJob().build();
172 this.groupKeyCode = builder.getGroupKeyCode();
173 this.groupKey = builder.getGroupKey() == null ? null : builder.getGroupKey().build();
174 this.workArea = builder.getWorkArea();
175 this.versionNumber = builder.getVersionNumber();
176 this.objectId = builder.getObjectId();
177 }
178
179 @Override
180 public String getTkClockLogId() {
181 return this.tkClockLogId;
182 }
183
184 @Override
185 public Long getTask() {
186 return this.task;
187 }
188
189 @Override
190 public boolean isClockedByMissedPunch() {
191 return this.clockedByMissedPunch;
192 }
193
194 @Override
195 public boolean isUnapprovedIP() {
196 return this.unapprovedIP;
197 }
198
199 @Override
200 public String getAssignmentDescriptionKey() {
201 return this.assignmentDescriptionKey;
202 }
203
204 @Override
205 public String getDept() {
206 return this.dept;
207 }
208
209 @Override
210 public DateTime getClockDateTime() {
211 return this.clockDateTime;
212 }
213
214 @Override
215 public String getDocumentId() {
216 return this.documentId;
217 }
218
219 @Override
220 public String getPrincipalId() {
221 return this.principalId;
222 }
223
224 @Override
225 public Long getJobNumber() {
226 return this.jobNumber;
227 }
228
229 @Override
230 public String getClockAction() {
231 return this.clockAction;
232 }
233
234 @Override
235 public String getIpAddress() {
236 return this.ipAddress;
237 }
238
239 @Override
240 public String getUserPrincipalId() {
241 return this.userPrincipalId;
242 }
243
244 @Override
245 public DateTime getCreateTime() {
246 return this.createTime;
247 }
248
249 @Override
250 public String getClockTimestampTimezone() {
251 return this.clockTimestampTimezone;
252 }
253
254 @Override
255 public String getNextValidClockAction() {
256 return this.nextValidClockAction;
257 }
258
259 @Override
260 public Job getJob() {
261 return this.job;
262 }
263
264 @Override
265 public HrGroupKey getGroupKey() {
266 return groupKey;
267 }
268
269 @Override
270 public String getGroupKeyCode() {
271 return groupKeyCode;
272 }
273
274 @Override
275 public Long getWorkArea() {
276 return this.workArea;
277 }
278
279 @Override
280 public Long getVersionNumber() {
281 return this.versionNumber;
282 }
283
284 @Override
285 public String getObjectId() {
286 return this.objectId;
287 }
288
289
290
291
292
293
294 public final static class Builder
295 implements Serializable, ClockLogContract, ModelBuilder
296 {
297
298 private static final long serialVersionUID = -5655909845940279134L;
299 private String tkClockLogId;
300 private String groupKeyCode;
301 private HrGroupKey.Builder groupKey;
302 private Long task;
303 private boolean clockedByMissedPunch;
304 private boolean unapprovedIP;
305 private String assignmentDescriptionKey;
306 private String dept;
307 private DateTime clockDateTime;
308 private String documentId;
309 private String principalId;
310 private Long jobNumber;
311 private String clockAction;
312 private String ipAddress;
313 private String userPrincipalId;
314 private DateTime createTime;
315 private String clockTimestampTimezone;
316 private String nextValidClockAction;
317 private Job.Builder job;
318
319
320 private Long workArea;
321 private Long versionNumber;
322 private String objectId;
323
324 private Builder() { }
325
326 public static Builder create() {
327 return new Builder();
328 }
329
330 public static Builder create(ClockLogContract contract) {
331 if (contract == null) {
332 throw new IllegalArgumentException("contract was null");
333 }
334 Builder builder = create();
335 builder.setGroupKeyCode(contract.getGroupKeyCode());
336 builder.setGroupKey(contract.getGroupKey() == null ? null : HrGroupKey.Builder.create(contract.getGroupKey()));
337 builder.setTkClockLogId(contract.getTkClockLogId());
338 builder.setTask(contract.getTask());
339 builder.setClockedByMissedPunch(contract.isClockedByMissedPunch());
340 builder.setUnapprovedIP(contract.isUnapprovedIP());
341 builder.setAssignmentDescriptionKey(contract.getAssignmentDescriptionKey());
342 builder.setDept(contract.getDept());
343 builder.setClockDateTime(contract.getClockDateTime());
344 builder.setDocumentId(contract.getDocumentId());
345 builder.setPrincipalId(contract.getPrincipalId());
346 builder.setJobNumber(contract.getJobNumber());
347 builder.setClockAction(contract.getClockAction());
348 builder.setIpAddress(contract.getIpAddress());
349 builder.setUserPrincipalId(contract.getUserPrincipalId());
350 builder.setCreateTime(contract.getCreateTime());
351 builder.setClockTimestampTimezone(contract.getClockTimestampTimezone());
352 builder.setNextValidClockAction(contract.getNextValidClockAction());
353 builder.setJob(contract.getJob() == null ? null : Job.Builder.create(contract.getJob()));
354
355
356 builder.setWorkArea(contract.getWorkArea());
357 builder.setVersionNumber(contract.getVersionNumber());
358 builder.setObjectId(contract.getObjectId());
359 return builder;
360 }
361
362 public ClockLog build() {
363 return new ClockLog(this);
364 }
365
366 @Override
367 public String getTkClockLogId() {
368 return this.tkClockLogId;
369 }
370
371 @Override
372 public Long getTask() {
373 return this.task;
374 }
375
376 @Override
377 public boolean isClockedByMissedPunch() {
378 return this.clockedByMissedPunch;
379 }
380
381 @Override
382 public boolean isUnapprovedIP() {
383 return this.unapprovedIP;
384 }
385
386 @Override
387 public String getAssignmentDescriptionKey() {
388 return this.assignmentDescriptionKey;
389 }
390
391 @Override
392 public String getDept() {
393 return this.dept;
394 }
395
396 @Override
397 public DateTime getClockDateTime() {
398 return this.clockDateTime;
399 }
400
401 @Override
402 public String getDocumentId() {
403 return this.documentId;
404 }
405
406 @Override
407 public String getPrincipalId() {
408 return this.principalId;
409 }
410
411 @Override
412 public Long getJobNumber() {
413 return this.jobNumber;
414 }
415
416 @Override
417 public String getClockAction() {
418 return this.clockAction;
419 }
420
421 @Override
422 public String getIpAddress() {
423 return this.ipAddress;
424 }
425
426 @Override
427 public String getUserPrincipalId() {
428 return this.userPrincipalId;
429 }
430
431 @Override
432 public DateTime getCreateTime() {
433 return this.createTime;
434 }
435
436 @Override
437 public String getClockTimestampTimezone() {
438 return this.clockTimestampTimezone;
439 }
440
441 @Override
442 public String getNextValidClockAction() {
443 return this.nextValidClockAction;
444 }
445
446 @Override
447 public Job.Builder getJob() {
448 return this.job;
449 }
450
451 @Override
452 public String getGroupKeyCode() {
453 return groupKeyCode;
454 }
455
456 @Override
457 public HrGroupKey.Builder getGroupKey() {
458 return groupKey;
459 }
460
461 @Override
462 public Long getWorkArea() {
463 return this.workArea;
464 }
465
466 @Override
467 public Long getVersionNumber() {
468 return this.versionNumber;
469 }
470
471 @Override
472 public String getObjectId() {
473 return this.objectId;
474 }
475
476 public void setTkClockLogId(String tkClockLogId) {
477 this.tkClockLogId = tkClockLogId;
478 }
479
480 public void setGroupKeyCode(String groupKeyCode) {
481 this.groupKeyCode = groupKeyCode;
482 }
483
484 public void setGroupKey(HrGroupKey.Builder groupKey) {
485 this.groupKey = groupKey;
486 }
487
488 public void setTask(Long task) {
489 this.task = task;
490 }
491
492 public void setClockedByMissedPunch(boolean clockedByMissedPunch) {
493 this.clockedByMissedPunch = clockedByMissedPunch;
494 }
495
496 public void setUnapprovedIP(boolean unapprovedIP) {
497 this.unapprovedIP = unapprovedIP;
498 }
499
500 public void setAssignmentDescriptionKey(String assignmentDescriptionKey) {
501 this.assignmentDescriptionKey = assignmentDescriptionKey;
502 }
503
504 public void setDept(String dept) {
505 this.dept = dept;
506 }
507
508 public void setClockDateTime(DateTime clockDateTime) {
509 this.clockDateTime = clockDateTime;
510 }
511
512 public void setDocumentId(String documentId) {
513 this.documentId = documentId;
514 }
515
516 public void setPrincipalId(String principalId) {
517 this.principalId = principalId;
518 }
519
520 public void setJobNumber(Long jobNumber) {
521 this.jobNumber = jobNumber;
522 }
523
524 public void setClockAction(String clockAction) {
525 this.clockAction = clockAction;
526 }
527
528 public void setIpAddress(String ipAddress) {
529 this.ipAddress = ipAddress;
530 }
531
532 public void setUserPrincipalId(String userPrincipalId) {
533 this.userPrincipalId = userPrincipalId;
534 }
535
536 public void setCreateTime(DateTime createTime) {
537 this.createTime = createTime;
538 }
539
540 public void setClockTimestampTimezone(String clockTimestampTimezone) {
541 this.clockTimestampTimezone = clockTimestampTimezone;
542 }
543
544 public void setNextValidClockAction(String nextValidClockAction) {
545 this.nextValidClockAction = nextValidClockAction;
546 }
547
548 public void setJob(Job.Builder job) {
549 this.job = job;
550 }
551
552
553
554
555
556
557
558
559
560 public void setWorkArea(Long workArea) {
561 this.workArea = workArea;
562 }
563
564 public void setVersionNumber(Long versionNumber) {
565 this.versionNumber = versionNumber;
566 }
567
568 public void setObjectId(String objectId) {
569 this.objectId = objectId;
570 }
571
572 }
573
574
575
576
577
578
579 static class Constants {
580
581 final static String ROOT_ELEMENT_NAME = "clockLog";
582 final static String TYPE_NAME = "ClockLogType";
583
584 }
585
586
587
588
589
590
591 static class Elements {
592
593 final static String TK_CLOCK_LOG_ID = "tkClockLogId";
594 final static String TASK = "task";
595 final static String CLOCKED_BY_MISSED_PUNCH = "clockedByMissedPunch";
596 final static String UNAPPROVED_I_P = "unapprovedIP";
597 final static String ASSIGNMENT_DESCRIPTION_KEY = "assignmentDescriptionKey";
598 final static String DEPT = "dept";
599 final static String CLOCK_DATE_TIME = "clockDateTime";
600 final static String DOCUMENT_ID = "documentId";
601 final static String PRINCIPAL_ID = "principalId";
602 final static String JOB_NUMBER = "jobNumber";
603 final static String CLOCK_ACTION = "clockAction";
604 final static String IP_ADDRESS = "ipAddress";
605 final static String USER_PRINCIPAL_ID = "userPrincipalId";
606 final static String CREATE_TIME = "createTime";
607 final static String CLOCK_TIMESTAMP_TIMEZONE = "clockTimestampTimezone";
608 final static String NEXT_VALID_CLOCK_ACTION = "nextValidClockAction";
609 final static String JOB = "job";
610
611
612 final static String WORK_AREA = "workArea";
613
614 }
615
616 }