1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.businessobject.inquiry;
17
18 import java.util.HashMap;
19 import java.util.Map;
20 import java.util.Properties;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.kuali.ole.coa.businessobject.IndirectCostRecoveryRate;
24 import org.kuali.ole.sys.OLEConstants;
25 import org.kuali.ole.sys.OLEPropertyConstants;
26 import org.kuali.ole.sys.businessobject.inquiry.KfsInquirableImpl;
27 import org.kuali.ole.sys.context.SpringContext;
28 import org.kuali.ole.sys.service.UniversityDateService;
29 import org.kuali.rice.kns.lookup.HtmlData;
30 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
31 import org.kuali.rice.krad.bo.BusinessObject;
32 import org.kuali.rice.krad.util.KRADConstants;
33 import org.kuali.rice.krad.util.ObjectUtils;
34 import org.kuali.rice.krad.util.UrlFactory;
35
36
37
38
39 public class AccountInquirable extends KfsInquirableImpl {
40
41
42
43
44
45 @Override
46 public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
47 if (OLEPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER.equals(attributeName)) {
48 String baseUrl = KRADConstants.INQUIRY_ACTION;
49
50 Properties parameters = new Properties();
51 parameters.put(OLEConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.START_METHOD);
52 parameters.put(OLEConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, IndirectCostRecoveryRate.class.getName());
53 parameters.put(OLEConstants.DOC_FORM_KEY, "88888888");
54
55 Map<String, String> inquiryFields = new HashMap<String, String>();
56 String icrIdentifier = (String) ObjectUtils.getPropertyValue(businessObject, attributeName);
57 if (StringUtils.isBlank(icrIdentifier)) {
58 return new AnchorHtmlData();
59 }
60 inquiryFields.put(OLEPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER, icrIdentifier);
61 parameters.put(OLEPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER, icrIdentifier);
62
63 Integer fiscalYear = SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear();
64 parameters.put(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, fiscalYear.toString());
65
66 return getHyperLink(IndirectCostRecoveryRate.class, inquiryFields, UrlFactory.parameterizeUrl(baseUrl, parameters));
67 }
68
69 return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
70 }
71
72 }