1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.businessobject.inquiry;
17
18
19
20 import org.apache.commons.beanutils.PropertyUtils;
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.ole.sys.OLEConstants;
23 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
24 import org.kuali.rice.kns.lookup.HtmlData;
25 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
26 import org.kuali.rice.krad.bo.BusinessObject;
27 import org.kuali.rice.krad.util.ObjectUtils;
28
29
30
31
32 public class KfsInquirableImpl extends KualiInquirableImpl {
33 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KfsInquirableImpl.class);
34
35
36
37
38
39
40
41
42 @Override
43 public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
44 try {
45 if (PropertyUtils.isReadable(businessObject, attributeName)) {
46 Object objFieldValue = ObjectUtils.getPropertyValue(businessObject, attributeName);
47 String fieldValue = objFieldValue == null ? OLEConstants.EMPTY_STRING : objFieldValue.toString();
48
49 if (StringUtils.containsOnly(fieldValue, OLEConstants.DASH)) {
50 return new AnchorHtmlData();
51 }
52 }
53
54 return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
55 } catch ( Exception ex ) {
56 LOG.error( "Unable to determine inquiry link for BO Class: " + businessObject.getClass() + " and property " + attributeName );
57 LOG.debug( "Unable to determine inquiry link for BO Class: " + businessObject.getClass() + " and property " + attributeName, ex );
58 return new AnchorHtmlData();
59 }
60 }
61
62 }