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.sys.document.datadictionary;
17
18 import org.apache.commons.beanutils.PropertyUtils;
19 import org.apache.commons.lang.StringUtils;
20 import org.kuali.ole.sys.document.web.NestedFieldTotaling;
21 import org.kuali.ole.sys.document.web.renderers.Renderer;
22 import org.kuali.rice.krad.datadictionary.DataDictionaryDefinitionBase;
23
24 /**
25 * Metadata about something that will be responsible for rendering some total of some accounting line group sometime, or something
26 */
27 public abstract class TotalDefinition extends DataDictionaryDefinitionBase implements NestedFieldTotaling {
28
29 /**
30 * Returns a renderer which will render the total for this total definition
31 *
32 * @return a Renderer which will render a total
33 */
34 public abstract Renderer getTotalRenderer();
35
36 /**
37 * get the actual property name if the property is nested; otherwise, return the given property name
38 *
39 * @param containingPropertyName the given containing property name
40 * @param propertyName the given peropety name
41 * @return the actual property name if the property is nested; otherwise, return the given property name
42 */
43 public String getActualPropertyName(String containingPropertyName, String propertyName) {
44 if (this.isNestedProperty() && StringUtils.isNotBlank(containingPropertyName)) {
45 return containingPropertyName + PropertyUtils.NESTED_DELIM + propertyName;
46 }
47
48 return propertyName;
49 }
50 }