1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.batch;
17
18 import java.text.DateFormat;
19 import java.text.SimpleDateFormat;
20 import java.util.Date;
21 import java.util.List;
22 import java.util.Map;
23
24 import org.apache.commons.lang.StringUtils;
25 import org.kuali.kpme.tklm.time.service.TkServiceLocator;
26 import org.kuali.rice.krad.lookup.LookupableImpl;
27 import org.kuali.rice.krad.util.ObjectUtils;
28 import org.kuali.rice.krad.web.form.LookupForm;
29 import org.quartz.SchedulerException;
30
31 public class BatchJobLookupableImpl extends LookupableImpl {
32
33 @Override
34 protected List<?> getSearchResults(LookupForm form,
35 Map<String, String> searchCriteria, boolean unbounded) {
36
37 Date fromDate = null;
38 Date toDate = null;
39 String fromDateString = searchCriteria.get("startDate");
40 String toDateString = searchCriteria.get("endDate");
41 String jobName = searchCriteria.get("name");
42 String jobStatus = searchCriteria.get("status");
43 String hrCalendarEntryId = searchCriteria.get("hrCalendarEntryId");
44 try {
45 if (ObjectUtils.isNotNull(fromDateString) && StringUtils.isNotEmpty(fromDateString.trim())) {
46 DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
47 dateFormat.setLenient(false);
48 fromDate = dateFormat.parse(fromDateString);
49 }
50 if (ObjectUtils.isNotNull(toDateString) && StringUtils.isNotEmpty(toDateString.trim())) {
51 DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
52 dateFormat.setLenient(false);
53 toDate = dateFormat.parse(toDateString);
54 }
55 return TkServiceLocator.getBatchJobService().getJobs(jobName, jobStatus, hrCalendarEntryId, fromDate, toDate);
56 } catch (Exception e) {
57
58 e.printStackTrace();
59 }
60 return null;
61 }
62
63
64 }