1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.calendar.service;
17
18 import java.util.List;
19 import java.util.Map;
20 import java.util.Properties;
21
22 import org.kuali.hr.time.calendar.Calendar;
23 import org.kuali.hr.time.service.base.TkServiceLocator;
24 import org.kuali.rice.kns.lookup.HtmlData;
25 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
26 import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl;
27 import org.kuali.rice.krad.bo.BusinessObject;
28 import org.kuali.rice.krad.util.KRADConstants;
29 import org.kuali.rice.krad.util.UrlFactory;
30
31 public class CalendarLookupableHelper extends KualiLookupableHelperServiceImpl {
32
33 private static final long serialVersionUID = 2324703412211619217L;
34
35 @Override
36 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
37 List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames);
38
39 Calendar calendar = (Calendar) businessObject;
40 String hrCalendarId = calendar.getHrCalendarId();
41
42 Properties params = new Properties();
43 params.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, getBusinessObjectClass().getName());
44 params.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
45 params.put("hrCalendarId", hrCalendarId);
46 AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view");
47 viewUrl.setDisplayText("view");
48 viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK);
49 customActionUrls.add(viewUrl);
50
51 return customActionUrls;
52 }
53
54 @Override
55 public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
56 String calendarName = fieldValues.get("calendarName");
57 String flsaBeginDay = fieldValues.get("flsaBeginDay");
58 String flsaBeginTime = fieldValues.get("flsaBeginTime");
59
60 return TkServiceLocator.getCalendarService().getCalendars(calendarName, flsaBeginDay, flsaBeginTime);
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 }
84
85 }