1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.salgroup.service;
17
18 import java.util.List;
19 import java.util.Map;
20 import java.util.Properties;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.kuali.hr.time.HrEffectiveDateActiveLookupableHelper;
24 import org.kuali.hr.time.salgroup.SalGroup;
25 import org.kuali.hr.time.service.base.TkServiceLocator;
26 import org.kuali.hr.time.util.TKUtils;
27 import org.kuali.rice.kns.lookup.HtmlData;
28 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
29 import org.kuali.rice.krad.bo.BusinessObject;
30 import org.kuali.rice.krad.util.KRADConstants;
31 import org.kuali.rice.krad.util.UrlFactory;
32
33 public class SalaryGroupLookupableHelper extends HrEffectiveDateActiveLookupableHelper {
34
35 private static final long serialVersionUID = 4826886027602440306L;
36
37 @Override
38 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
39 List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames);
40
41 SalGroup salGroup = (SalGroup) businessObject;
42 String hrSalGroupId = salGroup.getHrSalGroupId();
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("hrSalGroupId", hrSalGroupId);
48 params.put("hrSalGroup", salGroup.getHrSalGroup());
49 AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view");
50 viewUrl.setDisplayText("view");
51 viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK);
52 customActionUrls.add(viewUrl);
53
54 return customActionUrls;
55 }
56
57 @Override
58 public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues){
59 String hrSalGroup = fieldValues.get("hrSalGroup");
60 String descr = fieldValues.get("descr");
61 String fromEffdt = TKUtils.getFromDateString(fieldValues.get("effectiveDate"));
62 String toEffdt = TKUtils.getToDateString(fieldValues.get("effectiveDate"));
63 String active = fieldValues.get("active");
64 String showHist = fieldValues.get("history");
65
66 if (StringUtils.equals(hrSalGroup, "%")) {
67 hrSalGroup = "";
68 }
69
70 return TkServiceLocator.getSalGroupService().getSalGroups(hrSalGroup, descr, TKUtils.formatDateString(fromEffdt),
71 TKUtils.formatDateString(toEffdt), active, showHist);
72 }
73
74 }