1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.batch;
17
18 import java.util.List;
19
20 import org.kuali.hr.time.missedpunch.MissedPunchDocument;
21 import org.kuali.hr.time.service.base.TkServiceLocator;
22
23 public class BatchApproveMissedPunchJobRunnable extends BatchJobEntryRunnable {
24
25 public BatchApproveMissedPunchJobRunnable(BatchJobEntry entry) {
26 super(entry);
27 }
28
29 @Override
30 public void doWork() throws Exception {
31 String clockLogId = batchJobEntry.getClockLogId();
32 if(clockLogId != null) {
33 MissedPunchDocument document = TkServiceLocator.getMissedPunchService().getMissedPunchByClockLogId(clockLogId);
34 if(document != null) {
35 TkServiceLocator.getMissedPunchService().approveMissedPunch(document);
36 }
37 } else if( batchJobEntry.getDocumentId() != null) {
38 MissedPunchDocument document = TkServiceLocator.getMissedPunchService().getMissedPunchByRouteHeader(batchJobEntry.getDocumentId());
39 if(document != null) {
40 TkServiceLocator.getMissedPunchService().approveMissedPunch(document);
41 }
42 } else {
43 List<MissedPunchDocument> docList = TkServiceLocator.getMissedPunchService().getMissedPunchDocsByBatchJobEntry(batchJobEntry);
44 for(MissedPunchDocument aDoc : docList) {
45 TkServiceLocator.getMissedPunchService().approveMissedPunch(aDoc);
46 }
47 }
48
49 }
50 }