1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.rules.graceperiod.web;
17
18 import java.util.List;
19 import java.util.Map;
20 import java.util.Properties;
21
22 import org.kuali.kpme.core.lookup.KPMELookupableHelperServiceImpl;
23 import org.kuali.kpme.tklm.time.rules.graceperiod.GracePeriodRule;
24 import org.kuali.kpme.tklm.time.service.TkServiceLocator;
25 import org.kuali.rice.kns.lookup.HtmlData;
26 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
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 @SuppressWarnings("deprecation")
32 public class GracePeriodRuleLookupableHelperServiceImpl extends KPMELookupableHelperServiceImpl {
33
34 private static final long serialVersionUID = -1656060180428314707L;
35
36 @Override
37 @SuppressWarnings("rawtypes")
38 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
39 List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames);
40
41 GracePeriodRule gracePeriodRule = (GracePeriodRule) businessObject;
42 String tkGracePeriodRuleId = gracePeriodRule.getTkGracePeriodRuleId();
43
44 Properties params = new Properties();
45 params.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, getBusinessObjectClass().getName());
46 params.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
47 params.put("tkGracePeriodRuleId", tkGracePeriodRuleId);
48 AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view");
49 viewUrl.setDisplayText("view");
50 viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK);
51 customActionUrls.add(viewUrl);
52
53 return customActionUrls;
54 }
55
56 @Override
57 public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues){
58 String hourFactor = fieldValues.get("hourFactor");
59 String active = fieldValues.get("active");
60 String showHistory = fieldValues.get("history");
61
62 return TkServiceLocator.getGracePeriodService().getGracePeriodRules(hourFactor,active,showHistory);
63 }
64
65 }