1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.pdp.businessobject.inquiry;
17
18 import java.util.HashMap;
19 import java.util.Map;
20 import java.util.Properties;
21
22 import org.kuali.ole.pdp.PdpPropertyConstants;
23 import org.kuali.ole.pdp.businessobject.PaymentDetail;
24 import org.kuali.ole.pdp.businessobject.PurchasingPaymentDetail;
25 import org.kuali.ole.sys.OLEConstants;
26 import org.kuali.ole.sys.context.SpringContext;
27 import org.kuali.rice.core.api.config.property.ConfigurationService;
28 import org.kuali.rice.kns.lookup.HtmlData;
29 import org.kuali.rice.krad.bo.BusinessObject;
30 import org.kuali.rice.krad.util.KRADConstants;
31 import org.kuali.rice.krad.util.ObjectUtils;
32 import org.kuali.rice.krad.util.UrlFactory;
33
34 public class PurchasingPaymentDetailInquirable extends PaymentDetailInquirable {
35
36
37
38
39 @Override
40 public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
41 PaymentDetail paymentDetail = (PaymentDetail) businessObject;
42 if (PdpPropertyConstants.PaymentDetail.PAYMENT_DETAIL_NUMBER_OF_PAYMENTS_IN_PAYMENT_GROUP.equals(attributeName) && ObjectUtils.isNotNull(paymentDetail.getPaymentGroupId())) {
43
44 Properties params = new Properties();
45 params.put(OLEConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.SEARCH_METHOD);
46 params.put(OLEConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, PurchasingPaymentDetail.class.getName());
47 params.put(KRADConstants.DOC_FORM_KEY, "88888888");
48 params.put(OLEConstants.HIDE_LOOKUP_RETURN_LINK, "true");
49 params.put(OLEConstants.BACK_LOCATION, SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(KRADConstants.APPLICATION_URL_KEY) + "/" + OLEConstants.MAPPING_PORTAL + ".do");
50 params.put(OLEConstants.LOOKUP_READ_ONLY_FIELDS, PdpPropertyConstants.PaymentDetail.PAYMENT_DETAIL_PAYMENT_GROUP_ID);
51 params.put(PdpPropertyConstants.PaymentDetail.PAYMENT_DETAIL_PAYMENT_GROUP_ID, UrlFactory.encode(String.valueOf(paymentDetail.getPaymentGroupId())));
52 String url = UrlFactory.parameterizeUrl(KRADConstants.LOOKUP_ACTION, params);
53
54 Map<String, String> fieldList = new HashMap<String, String>();
55 fieldList.put(PdpPropertyConstants.PaymentDetail.PAYMENT_DETAIL_PAYMENT_GROUP_ID, paymentDetail.getPaymentGroupId().toString());
56
57 return getHyperLink(PaymentDetail.class, fieldList, url);
58 }
59
60 if (PdpPropertyConstants.PaymentDetail.PAYMENT_DETAIL_NUMBER_OF_PAYMENTS_IN_DISBURSEMENT.equals(attributeName) && ObjectUtils.isNotNull(paymentDetail.getPaymentGroup().getDisbursementNbr())) {
61
62 Properties params = new Properties();
63 params.put(OLEConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.SEARCH_METHOD);
64 params.put(OLEConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, PurchasingPaymentDetail.class.getName());
65 params.put(KRADConstants.DOC_FORM_KEY, "88888888");
66 params.put(OLEConstants.HIDE_LOOKUP_RETURN_LINK, "true");
67 params.put(OLEConstants.BACK_LOCATION, SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(KRADConstants.APPLICATION_URL_KEY) + "/" + OLEConstants.MAPPING_PORTAL + ".do");
68 params.put(OLEConstants.LOOKUP_READ_ONLY_FIELDS, PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_NUMBER);
69 params.put(PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_NUMBER, UrlFactory.encode(String.valueOf(paymentDetail.getPaymentGroup().getDisbursementNbr())));
70 String url = UrlFactory.parameterizeUrl(KRADConstants.LOOKUP_ACTION, params);
71
72 Map<String, String> fieldList = new HashMap<String, String>();
73 fieldList.put(PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_NUMBER, paymentDetail.getPaymentGroup().getDisbursementNbr().toString());
74
75 return getHyperLink(PaymentDetail.class, fieldList, url);
76 }
77
78 return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
79 }
80
81 }