001    /*
002     * Copyright 2011 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     */
016    package org.kuali.kfs.pdp.businessobject.lookup;
017    
018    import java.util.Properties;
019    
020    import org.kuali.kfs.pdp.PdpPropertyConstants;
021    import org.kuali.kfs.pdp.businessobject.Batch;
022    import org.kuali.kfs.pdp.businessobject.PaymentDetail;
023    import org.kuali.kfs.pdp.businessobject.PaymentProcess;
024    import org.kuali.kfs.pdp.businessobject.ProcessSummary;
025    import org.kuali.kfs.sys.KFSConstants;
026    import org.kuali.rice.kns.bo.BusinessObject;
027    import org.kuali.rice.kns.lookup.HtmlData;
028    import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl;
029    import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
030    import org.kuali.rice.kns.util.KNSConstants;
031    import org.kuali.rice.kns.util.UrlFactory;
032    
033    public class PaymentProcessLookupableHelperService extends KualiLookupableHelperServiceImpl {
034        
035        /**
036         * @see org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#getInquiryUrl(org.kuali.rice.kns.bo.BusinessObject,
037         *      java.lang.String)
038         */
039        @Override
040        public HtmlData getInquiryUrl(BusinessObject bo, String propertyName) {
041            AnchorHtmlData inquiryUrl = (AnchorHtmlData) super.getInquiryUrl(bo, propertyName);
042            PaymentProcess paymentProcess = (PaymentProcess) bo;
043            if (propertyName.equalsIgnoreCase(PdpPropertyConstants.PaymentProcess.PAYMENT_PROCESS_ID)) {
044                Properties params = new Properties();
045                params.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.SEARCH_METHOD);
046                params.put(KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, ProcessSummary.class.getName());
047                params.put(KNSConstants.DOC_FORM_KEY, "88888888");
048                params.put(KFSConstants.HIDE_LOOKUP_RETURN_LINK, "true");
049                params.put(KFSConstants.RETURN_LOCATION_PARAMETER, KFSConstants.MAPPING_PORTAL + ".do");
050                params.put(PdpPropertyConstants.ProcessSummary.PROCESS_SUMMARY_PROCESS_ID, UrlFactory.encode(String.valueOf(paymentProcess.getId())));
051                String url = UrlFactory.parameterizeUrl(KNSConstants.LOOKUP_ACTION, params);
052                inquiryUrl.setHref(url);
053            }
054            return inquiryUrl;
055        }
056    
057    }