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