01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.kfs.inquiry;
17:
18: import org.kuali.core.bo.BusinessObject;
19: import org.kuali.core.inquiry.KualiInquirableImpl;
20: import org.kuali.core.util.ObjectUtils;
21: import org.kuali.kfs.KFSConstants;
22:
23: public class KfsInquirableImpl extends KualiInquirableImpl {
24:
25: /**
26: * Helper method to build an inquiry url for a result field.
27: *
28: * @param bo the business object instance to build the urls for
29: * @param propertyName the property which links to an inquirable
30: * @return String url to inquiry
31: */
32: public String getInquiryUrl(BusinessObject businessObject,
33: String attributeName, boolean forceInquiry) {
34:
35: // If the field is subAccountNumber, financialSubObjectCode or projectCode and the value is dashes, don't give a url
36: if ("subAccountNumber".equals(attributeName)
37: || "financialSubObjectCode".equals(attributeName)
38: || "projectCode".equals(attributeName)) {
39: Object objFieldValue = ObjectUtils.getPropertyValue(
40: businessObject, attributeName);
41: String fieldValue = objFieldValue == null ? ""
42: : objFieldValue.toString();
43:
44: if ("subAccountNumber".equals(attributeName)
45: && fieldValue.equals(KFSConstants
46: .getDashSubAccountNumber())) {
47: return "";
48: }
49: if ("financialSubObjectCode".equals(attributeName)
50: && fieldValue.equals(KFSConstants
51: .getDashFinancialSubObjectCode())) {
52: return "";
53: }
54: if ("projectCode".equals(attributeName)
55: && fieldValue.equals(KFSConstants
56: .getDashProjectCode())) {
57: return "";
58: }
59: }
60: return super.getInquiryUrl(businessObject, attributeName,
61: forceInquiry);
62: }
63:
64: }
|