1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.accrual.service;
17
18 import java.util.ArrayList;
19 import java.util.List;
20 import java.util.Properties;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.kuali.hr.time.accrual.TimeOffAccrual;
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 TimeOffAccrualLookupableHelper extends KualiLookupableHelperServiceImpl {
32
33 private static final long serialVersionUID = -8156015437451479966L;
34
35 @Override
36 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
37 List<HtmlData> customActionUrls = new ArrayList<HtmlData>();
38
39 List<HtmlData> defaultCustomActionUrls = super.getCustomActionUrls(businessObject, pkNames);
40
41 TimeOffAccrual timeOffAccrual = (TimeOffAccrual) businessObject;
42 final String lmAccrualId = timeOffAccrual.getLmAccrualId();
43
44 for (HtmlData defaultCustomActionUrl : defaultCustomActionUrls){
45 if (!StringUtils.equals(defaultCustomActionUrl.getMethodToCall(), "copy")){
46 customActionUrls.add(defaultCustomActionUrl);
47 }
48 }
49
50 Properties params = new Properties();
51 params.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, getBusinessObjectClass().getName());
52 params.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
53 params.put("lmAccrualId", lmAccrualId);
54 AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view");
55 viewUrl.setDisplayText("view");
56 viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK);
57 customActionUrls.add(viewUrl);
58
59 return customActionUrls;
60 }
61 }