1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.kuali.kfs.sys.document.datadictionary;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.apache.log4j.Logger;
23 import org.kuali.kfs.sys.document.web.renderers.DebitCreditTotalRenderer;
24 import org.kuali.kfs.sys.document.web.renderers.Renderer;
25 import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException;
26
27
28
29
30 public class DebitCreditTotalDefinition extends TotalDefinition {
31 private static Logger LOG = Logger.getLogger(DebitCreditTotalDefinition.class);
32
33 private String debitTotalProperty;
34 private String creditTotalProperty;
35
36 private boolean nestedProperty;
37 private String containingPropertyName;
38
39 private String representedProperty;
40
41 private String debitTotalLabelProperty = "accounting.line.group.debitTotal.label";
42 private String creditTotalLabelProperty = "accounting.line.group.creditTotal.label";
43
44
45
46
47 @Override
48 public Renderer getTotalRenderer() {
49 DebitCreditTotalRenderer renderer = new DebitCreditTotalRenderer();
50
51 String actualCreditTotalProperty = this.getActualPropertyName(containingPropertyName, creditTotalProperty);
52 renderer.setCreditTotalProperty(actualCreditTotalProperty);
53
54 String actualDebitTotalProperty = this.getActualPropertyName(containingPropertyName, debitTotalProperty);
55 renderer.setDebitTotalProperty(actualDebitTotalProperty);
56
57 renderer.setRepresentedCellPropertyName(representedProperty);
58
59 renderer.setCreditTotalLabelProperty(creditTotalLabelProperty);
60 renderer.setDebitTotalLabelProperty(debitTotalLabelProperty);
61
62 return renderer;
63 }
64
65
66
67
68
69
70 public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
71 if (StringUtils.isBlank(debitTotalProperty) || StringUtils.isBlank(creditTotalProperty)) {
72 throw new AttributeValidationException("Please specify both debitTotalProperty and creditTotalProperty for the AccountingLineGroupTotalRenderer");
73 }
74 }
75
76
77
78
79
80
81 public String getDebitTotalProperty() {
82 return debitTotalProperty;
83 }
84
85
86
87
88
89
90 public void setDebitTotalProperty(String debitTotalProperty) {
91 this.debitTotalProperty = debitTotalProperty;
92 }
93
94
95
96
97
98
99 public String getCreditTotalProperty() {
100 return creditTotalProperty;
101 }
102
103
104
105
106
107
108 public void setCreditTotalProperty(String creditTotalProperty) {
109 this.creditTotalProperty = creditTotalProperty;
110 }
111
112
113
114
115
116
117 public String getDebitTotalLabelProperty() {
118 return debitTotalLabelProperty;
119 }
120
121
122
123
124
125
126 public void setDebitTotalLabelProperty(String debitTotalLabelProperty) {
127 this.debitTotalLabelProperty = debitTotalLabelProperty;
128 }
129
130
131
132
133
134
135 public String getCreditTotalLabelProperty() {
136 return creditTotalLabelProperty;
137 }
138
139
140
141
142
143
144 public void setCreditTotalLabelProperty(String creditTotalLabelProperty) {
145 this.creditTotalLabelProperty = creditTotalLabelProperty;
146 }
147
148
149
150
151
152
153 public String getRepresentedProperty() {
154 return representedProperty;
155 }
156
157
158
159
160
161
162 public void setRepresentedProperty(String representedProperty) {
163 this.representedProperty = representedProperty;
164 }
165
166
167
168
169
170 public void setNestedProperty(boolean nestedProperty) {
171 this.nestedProperty = nestedProperty;
172 }
173
174
175
176
177 public void setContainingPropertyName(String containingPropertyName) {
178 this.containingPropertyName = containingPropertyName;
179 }
180
181
182
183
184 public boolean isNestedProperty() {
185 return this.nestedProperty;
186 }
187 }