1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.principal.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.KPMELookupableHelper;
23 import org.kuali.kpme.core.principal.PrincipalHRAttributes;
24 import org.kuali.kpme.core.service.HrServiceLocator;
25 import org.kuali.kpme.core.util.TKUtils;
26 import org.kuali.rice.kns.lookup.HtmlData;
27 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
28 import org.kuali.rice.krad.bo.BusinessObject;
29 import org.kuali.rice.krad.util.GlobalVariables;
30 import org.kuali.rice.krad.util.KRADConstants;
31 import org.kuali.rice.krad.util.UrlFactory;
32
33 @SuppressWarnings("deprecation")
34 public class PrincipalHRAttributesLookupableHelper extends KPMELookupableHelper {
35
36 private static final long serialVersionUID = 6198072858175242923L;
37
38 @Override
39 @SuppressWarnings("rawtypes")
40 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
41 List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames);
42
43 PrincipalHRAttributes principalHRAttributes = (PrincipalHRAttributes) businessObject;
44 String hrPrincipalAttributeId = principalHRAttributes.getHrPrincipalAttributeId();
45
46 Properties params = new Properties();
47 params.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, getBusinessObjectClass().getName());
48 params.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
49 params.put("hrPrincipalAttributeId", hrPrincipalAttributeId);
50 AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view");
51 viewUrl.setDisplayText("view");
52 viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK);
53 customActionUrls.add(viewUrl);
54
55
56 customActionUrls.add(getUrlData(principalHRAttributes, KRADConstants.MAINTENANCE_COPY_METHOD_TO_CALL, pkNames));
57
58 return customActionUrls;
59 }
60
61 @Override
62 public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
63 String principalId = fieldValues.get("principalId");
64 String leavePlan = fieldValues.get("leavePlan");
65 String fromEffdt = TKUtils.getFromDateString(fieldValues.get("effectiveDate"));
66 String toEffdt = TKUtils.getToDateString(fieldValues.get("effectiveDate"));
67 String active = fieldValues.get("active");
68 String showHist = fieldValues.get("history");
69
70 return HrServiceLocator.getPrincipalHRAttributeService().getPrincipalHrAtributes(GlobalVariables.getUserSession().getPrincipalId(), principalId, leavePlan, TKUtils.formatDateString(fromEffdt),
71 TKUtils.formatDateString(toEffdt), active, showHist);
72 }
73
74 }