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