1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.job.web;
17
18 import java.util.List;
19 import java.util.Map;
20 import java.util.Properties;
21
22 import org.kuali.kpme.core.api.bo.HrBusinessObjectContract;
23 import org.kuali.kpme.core.api.job.Job;
24 import org.kuali.kpme.core.job.JobBo;
25 import org.kuali.kpme.core.lookup.KpmeHrBusinessObjectLookupableHelper;
26 import org.kuali.rice.core.api.mo.ModelObjectUtils;
27 import org.kuali.rice.kns.lookup.HtmlData;
28 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
29 import org.kuali.rice.krad.bo.BusinessObject;
30 import org.kuali.rice.krad.util.KRADConstants;
31 import org.kuali.rice.krad.util.UrlFactory;
32
33 @SuppressWarnings("deprecation")
34 public class JobLookupableHelper extends KpmeHrBusinessObjectLookupableHelper {
35
36 private static final long serialVersionUID = 3233495722838070429L;
37 private static final ModelObjectUtils.Transformer<Job, JobBo> toJobBo =
38 new ModelObjectUtils.Transformer<Job, JobBo>() {
39 public JobBo transform(Job input) {
40 return JobBo.from(input);
41 };
42 };
43
44
45 @Override
46 @SuppressWarnings("rawtypes")
47 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
48 List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames);
49
50 JobBo job = (JobBo) businessObject;
51 String hrJobId = job.getHrJobId();
52
53 Properties params = new Properties();
54 params.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, getBusinessObjectClass().getName());
55 params.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
56
57 params.put("hrJobId", hrJobId);
58
59 AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view");
60 viewUrl.setDisplayText("view");
61 viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK);
62 customActionUrls.add(viewUrl);
63
64
65 customActionUrls.add(getUrlData(job, KRADConstants.MAINTENANCE_COPY_METHOD_TO_CALL, pkNames));
66
67 return customActionUrls;
68 }
69
70 @Override
71 public List<? extends HrBusinessObjectContract> getSearchResults(Map<String, String> fieldValues) {
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90 List<JobBo> jobObjs = (List<JobBo>) super.getSearchResults(fieldValues);
91 return jobObjs;
92 }
93
94 }