1 /*
2 * Copyright 2008 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.ole.vnd.businessobject.inquiry;
17
18 import org.kuali.ole.sys.OLEConstants;
19 import org.kuali.ole.sys.businessobject.inquiry.KfsInquirableImpl;
20 import org.kuali.ole.vnd.businessobject.VendorDetail;
21 import org.kuali.rice.kns.lookup.HtmlData;
22 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
23 import org.kuali.rice.krad.bo.BusinessObject;
24 import org.kuali.rice.krad.util.KRADConstants;
25 import org.kuali.rice.krad.util.ObjectUtils;
26
27 /**
28 * This class adds in some new sections for {@link Org} inquiries, specifically Org Hierarchy Org Review Hierarchy
29 */
30 public class VendorInquirable extends KfsInquirableImpl {
31
32 /**
33 * Overrides the helper method to build an inquiry url for a result field.
34 * For the Vendor URL field, returns the url address as the inquiry URL, so that Vendor URL functions as a hyperlink.
35 *
36 * @param bo the business object instance to build the urls for
37 * @param propertyName the property which links to an inquirable
38 * @return String url to inquiry
39 */
40 public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
41 if (businessObject instanceof VendorDetail && attributeName.equalsIgnoreCase("vendorUrlAddress")) {
42 Object objFieldValue = ObjectUtils.getPropertyValue(businessObject, attributeName);
43 String fieldValue = objFieldValue == null ? OLEConstants.EMPTY_STRING : objFieldValue.toString();
44 return new AnchorHtmlData("http://" + fieldValue, KRADConstants.EMPTY_STRING, ((VendorDetail)businessObject).getVendorName()+" ("+fieldValue+")");
45 }
46
47 return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
48 }
49
50 }