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