1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.leavedonation.service;
17
18 import java.util.ArrayList;
19 import java.util.List;
20 import java.util.Properties;
21
22 import org.kuali.hr.lm.leavedonation.LeaveDonation;
23 import org.kuali.hr.time.HrEffectiveDateActiveLookupableHelper;
24 import org.kuali.rice.kns.lookup.HtmlData;
25 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
26 import org.kuali.rice.krad.bo.BusinessObject;
27 import org.kuali.rice.krad.util.KRADConstants;
28 import org.kuali.rice.krad.util.UrlFactory;
29
30 public class LeaveDonationLookupableHelper extends HrEffectiveDateActiveLookupableHelper {
31
32 private static final long serialVersionUID = 4181583515349590532L;
33
34 @Override
35 public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
36 List<HtmlData> customActionUrls = super.getCustomActionUrls(businessObject, pkNames);
37
38 List<HtmlData> copyOfUrls = new ArrayList<HtmlData>();
39 copyOfUrls.addAll(customActionUrls);
40 for(HtmlData aData : copyOfUrls) {
41 if(aData.getMethodToCall().equals(KRADConstants.MAINTENANCE_EDIT_METHOD_TO_CALL)) {
42 customActionUrls.remove(aData);
43 }
44 }
45 LeaveDonation leaveDonation = (LeaveDonation) businessObject;
46 String lmLeaveDonationId = leaveDonation.getLmLeaveDonationId();
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("lmLeaveDonationId", lmLeaveDonationId);
52 AnchorHtmlData viewUrl = new AnchorHtmlData(UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, params), "view");
53 viewUrl.setDisplayText("view");
54 viewUrl.setTarget(AnchorHtmlData.TARGET_BLANK);
55 customActionUrls.add(viewUrl);
56
57 return customActionUrls;
58 }
59
60 }