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.PayeeACHAccount;
24  import org.kuali.ole.pdp.businessobject.PayeeType;
25  import org.kuali.ole.sys.OLEConstants;
26  import org.kuali.ole.sys.businessobject.inquiry.KfsInquirableImpl;
27  import org.kuali.rice.core.api.util.type.KualiInteger;
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  
35  
36  
37  public class PayeeAchAccountInquirable extends KfsInquirableImpl {
38  
39      
40  
41  
42  
43      @Override
44      public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
45          
46          HtmlData htmlData = null;
47          
48          
49          
50          
51          if (PdpPropertyConstants.PAYEE_NAME.equals(attributeName)) {
52              Properties parameters = new Properties();
53  
54              parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.START_METHOD);
55              parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, PayeeACHAccount.class.getName());
56  
57              KualiInteger generatedIdentifier = (KualiInteger) ObjectUtils.getPropertyValue(businessObject, PdpPropertyConstants.ACH_ACCOUNT_GENERATED_IDENTIFIER);
58              parameters.put(PdpPropertyConstants.ACH_ACCOUNT_GENERATED_IDENTIFIER, generatedIdentifier.toString());
59  
60              Map<String, String> fieldList = new HashMap<String, String>();
61              fieldList.put(PdpPropertyConstants.ACH_ACCOUNT_GENERATED_IDENTIFIER, generatedIdentifier.toString());
62              
63              htmlData = getHyperLink(PayeeACHAccount.class, fieldList, UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, parameters));
64          }
65          
66          
67          
68          
69          else if (PdpPropertyConstants.PAYEE_IDENTIFIER_TYPE_CODE.equals(attributeName)) {
70              Properties parameters = new Properties();
71  
72              parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.START_METHOD);
73              parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, PayeeType.class.getName());
74  
75              String payeeIdentifierCode = (String) ObjectUtils.getPropertyValue(businessObject, PdpPropertyConstants.PAYEE_IDENTIFIER_TYPE_CODE);
76              parameters.put(PdpPropertyConstants.PAYEE_CODE, payeeIdentifierCode);
77  
78              Map<String, String> fieldList = new HashMap<String, String>();
79              fieldList.put(PdpPropertyConstants.PAYEE_CODE, payeeIdentifierCode);
80              
81              htmlData = getHyperLink(PayeeType.class, fieldList, UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, parameters));
82          }
83          
84          
85          
86          
87          else {
88              htmlData = super.getInquiryUrl(businessObject, attributeName, forceInquiry);            
89          }
90          
91          return htmlData;
92      }
93  
94  }