001/* 002 * Copyright 2008 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.ole.pdp.businessobject.inquiry; 017 018import java.util.HashMap; 019import java.util.Map; 020import java.util.Properties; 021 022import org.kuali.ole.pdp.PdpPropertyConstants; 023import org.kuali.ole.pdp.businessobject.PayeeACHAccount; 024import org.kuali.ole.pdp.businessobject.PayeeType; 025import org.kuali.ole.sys.OLEConstants; 026import org.kuali.ole.sys.businessobject.inquiry.KfsInquirableImpl; 027import org.kuali.rice.core.api.util.type.KualiInteger; 028import org.kuali.rice.kns.lookup.HtmlData; 029import org.kuali.rice.krad.bo.BusinessObject; 030import org.kuali.rice.krad.util.KRADConstants; 031import org.kuali.rice.krad.util.ObjectUtils; 032import org.kuali.rice.krad.util.UrlFactory; 033 034/** 035 * Customer inquiry for "Payee ACH Account Lookup" results. 036 */ 037public class PayeeAchAccountInquirable extends KfsInquirableImpl { 038 039 /** 040 * @see org.kuali.ole.sys.businessobject.inquiry.KfsInquirableImpl#getInquiryUrl(org.kuali.rice.krad.bo.BusinessObject, 041 * java.lang.String, boolean) 042 */ 043 @Override 044 public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) { 045 046 HtmlData htmlData = null; 047 048 // 049 // Creates a customized inquiry link for the 'payeeName' attribute. 050 // 051 if (PdpPropertyConstants.PAYEE_NAME.equals(attributeName)) { 052 Properties parameters = new Properties(); 053 054 parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.START_METHOD); 055 parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, PayeeACHAccount.class.getName()); 056 057 KualiInteger generatedIdentifier = (KualiInteger) ObjectUtils.getPropertyValue(businessObject, PdpPropertyConstants.ACH_ACCOUNT_GENERATED_IDENTIFIER); 058 parameters.put(PdpPropertyConstants.ACH_ACCOUNT_GENERATED_IDENTIFIER, generatedIdentifier.toString()); 059 060 Map<String, String> fieldList = new HashMap<String, String>(); 061 fieldList.put(PdpPropertyConstants.ACH_ACCOUNT_GENERATED_IDENTIFIER, generatedIdentifier.toString()); 062 063 htmlData = getHyperLink(PayeeACHAccount.class, fieldList, UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, parameters)); 064 } 065 066 // 067 // Creates a customized inquiry link for the 'payeeIdentifierTypeCode' attribute. 068 // 069 else if (PdpPropertyConstants.PAYEE_IDENTIFIER_TYPE_CODE.equals(attributeName)) { 070 Properties parameters = new Properties(); 071 072 parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.START_METHOD); 073 parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, PayeeType.class.getName()); 074 075 String payeeIdentifierCode = (String) ObjectUtils.getPropertyValue(businessObject, PdpPropertyConstants.PAYEE_IDENTIFIER_TYPE_CODE); 076 parameters.put(PdpPropertyConstants.PAYEE_CODE, payeeIdentifierCode); 077 078 Map<String, String> fieldList = new HashMap<String, String>(); 079 fieldList.put(PdpPropertyConstants.PAYEE_CODE, payeeIdentifierCode); 080 081 htmlData = getHyperLink(PayeeType.class, fieldList, UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, parameters)); 082 } 083 084 // 085 // Default. 086 // 087 else { 088 htmlData = super.getInquiryUrl(businessObject, attributeName, forceInquiry); 089 } 090 091 return htmlData; 092 } 093 094}