1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.rules.clocklocation.web;
17
18 import java.util.ArrayList;
19 import java.util.List;
20 import java.util.Map;
21 import java.util.Properties;
22
23 import org.apache.commons.lang.StringUtils;
24 import org.kuali.kpme.core.api.bo.HrBusinessObjectContract;
25 import org.kuali.kpme.core.lookup.KpmeHrBusinessObjectLookupableHelper;
26 import org.kuali.kpme.tklm.time.rules.clocklocation.ClockLocationRule;
27 import org.kuali.kpme.tklm.time.service.TkServiceLocator;
28 import org.kuali.rice.kns.lookup.HtmlData;
29 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
30 import org.kuali.rice.krad.bo.BusinessObject;
31 import org.kuali.rice.krad.util.GlobalVariables;
32 import org.kuali.rice.krad.util.KRADConstants;
33 import org.kuali.rice.krad.util.UrlFactory;
34
35 @SuppressWarnings("deprecation")
36 public class ClockLocationRuleLookupableHelperServiceImpl extends KpmeHrBusinessObjectLookupableHelper {
37
38 private static final long serialVersionUID = 7261054962204557586L;
39
40 @Override
41 @SuppressWarnings("rawtypes")
42 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
43 List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames);
44
45 ClockLocationRule clockLocationRule = (ClockLocationRule) businessObject;
46 String tkClockLocationRuleId = clockLocationRule.getTkClockLocationRuleId();
47
48 Properties params = new Properties();
49 params.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, getBusinessObjectClass().getName());
50 params.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
51 params.put("tkClockLocationRuleId", tkClockLocationRuleId);
52
53 return customActionUrls;
54 }
55
56 @Override
57 protected void validateSearchParameterWildcardAndOperators(
58 String attributeName, String attributeValue) {
59 if (!StringUtils.equals(attributeValue, "%")) {
60 super.validateSearchParameterWildcardAndOperators(attributeName,
61 attributeValue);
62 }
63 }
64
65 public List<? extends HrBusinessObjectContract> getSearchResults( Map<String, String> fieldValues) {
66 List<? extends HrBusinessObjectContract> temp = new ArrayList<HrBusinessObjectContract>();
67 temp = super.getSearchResults(fieldValues);
68
69 if ( temp != null ){
70 List<ClockLocationRule> results = new ArrayList<ClockLocationRule>();
71 for ( int i = 0; i < temp.size(); i++ ){
72 ClockLocationRule clockLocationRule = (ClockLocationRule)temp.get(i);
73 results.add(clockLocationRule);
74 }
75
76 return TkServiceLocator.getClockLocationRuleService().getClockLocationRules(GlobalVariables.getUserSession().getPrincipalId(), results);
77 } else {
78 return temp;
79 }
80 }
81
82 }