1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.leavecode.service;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.hr.lm.leavecode.LeaveCode;
23 import org.kuali.hr.time.HrEffectiveDateActiveLookupableHelper;
24 import org.kuali.hr.time.util.TKContext;
25 import org.kuali.rice.kns.lookup.HtmlData;
26 import org.kuali.rice.krad.bo.BusinessObject;
27
28
29
30
31
32
33 public class LeaveCodeLookupableHelper extends
34 HrEffectiveDateActiveLookupableHelper {
35
36
37
38 private static final long serialVersionUID = 1L;
39
40 @Override
41 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject,
42 List pkNames) {
43 List<HtmlData> customActionUrls = super.getCustomActionUrls(
44 businessObject, pkNames);
45 List<HtmlData> overrideUrls = new ArrayList<HtmlData>();
46 for(HtmlData actionUrl : customActionUrls){
47 if(!StringUtils.equals(actionUrl.getMethodToCall(), "copy")){
48 overrideUrls.add(actionUrl);
49 }
50 }
51
52 if (TKContext.getUser().isSystemAdmin()) {
53 LeaveCode leaveCode = (LeaveCode) businessObject;
54 final String className = this.getBusinessObjectClass().getName();
55 final String lmLeaveCodeId = leaveCode
56 .getLmLeaveCodeId();
57 HtmlData htmlData = new HtmlData() {
58
59 @Override
60 public String constructCompleteHtmlTag() {
61 return "<a target=\"_blank\" href=\"inquiry.do?businessObjectClassName="
62 + className
63 + "&methodToCall=start&lmLeaveCodeId="
64 + lmLeaveCodeId + "\">view</a>";
65 }
66 };
67 overrideUrls.add(htmlData);
68 } else if (overrideUrls.size() != 0) {
69 overrideUrls.remove(0);
70 }
71 return overrideUrls;
72 }
73
74 }