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