1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.businessobject;
17
18 import java.sql.Date;
19 import java.util.Arrays;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.ole.sys.OLEPropertyConstants;
23 import org.kuali.ole.sys.ObjectUtil;
24 import org.kuali.ole.sys.context.SpringContext;
25 import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
26 import org.kuali.rice.core.api.util.type.KualiDecimal;
27 import org.kuali.rice.kew.api.doctype.DocumentTypeService;
28 import org.kuali.rice.kew.doctype.bo.DocumentType;
29 import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
30 import org.kuali.rice.kim.api.identity.Person;
31 import org.kuali.rice.kim.api.identity.PersonService;
32 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
33
34
35
36
37 public class AccountDelegate extends PersistableBusinessObjectBase implements MutableInactivatable {
38
39 private static final long serialVersionUID = 6883162275377881235L;
40
41
42
43
44 public AccountDelegate() {
45 }
46
47 private String chartOfAccountsCode;
48 private String accountNumber;
49 private String financialDocumentTypeCode;
50 private String accountDelegateSystemId;
51 private KualiDecimal finDocApprovalFromThisAmt;
52 private boolean accountsDelegatePrmrtIndicator;
53 private boolean active;
54 private Date accountDelegateStartDate;
55 private KualiDecimal finDocApprovalToThisAmount;
56
57 private Chart chart;
58 private Account account;
59 private transient DocumentTypeEBO financialSystemDocumentTypeCode;
60 private Person accountDelegate;
61
62
63
64
65
66
67 public String getAccountNumber() {
68 return accountNumber;
69 }
70
71
72
73
74
75
76 public void setAccountNumber(String accountNumber) {
77 this.accountNumber = accountNumber;
78 }
79
80
81
82
83
84
85 public String getChartOfAccountsCode() {
86 return chartOfAccountsCode;
87 }
88
89
90
91
92
93
94 public void setChartOfAccountsCode(String chartOfAccountsCode) {
95 this.chartOfAccountsCode = chartOfAccountsCode;
96 }
97
98
99
100
101
102
103 public String getFinancialDocumentTypeCode() {
104 return financialDocumentTypeCode;
105 }
106
107
108
109
110
111
112 public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) {
113 this.financialDocumentTypeCode = financialDocumentTypeCode;
114 }
115
116
117
118
119
120
121 public String getAccountDelegateSystemId() {
122 return accountDelegateSystemId;
123 }
124
125
126
127
128
129
130 public void setAccountDelegateSystemId(String accountDelegateSystemId) {
131 this.accountDelegateSystemId = accountDelegateSystemId;
132 }
133
134
135
136
137
138
139 public KualiDecimal getFinDocApprovalFromThisAmt() {
140 return finDocApprovalFromThisAmt;
141 }
142
143
144
145
146
147
148 public void setFinDocApprovalFromThisAmt(KualiDecimal finDocApprovalFromThisAmt) {
149 this.finDocApprovalFromThisAmt = finDocApprovalFromThisAmt;
150 }
151
152
153
154
155
156
157 public boolean isAccountsDelegatePrmrtIndicator() {
158 return accountsDelegatePrmrtIndicator;
159 }
160
161
162
163
164
165
166
167 public void setAccountsDelegatePrmrtIndicator(boolean accountsDelegatePrmrtIndicator) {
168 this.accountsDelegatePrmrtIndicator = accountsDelegatePrmrtIndicator;
169 }
170
171
172
173
174
175
176 @Override
177 public boolean isActive() {
178 return active;
179 }
180
181
182
183
184
185
186
187 public void setActive(boolean active) {
188 this.active = active;
189 }
190
191
192
193
194
195
196 public Date getAccountDelegateStartDate() {
197 return accountDelegateStartDate;
198 }
199
200
201
202
203
204
205 public void setAccountDelegateStartDate(Date accountDelegateStartDate) {
206 this.accountDelegateStartDate = accountDelegateStartDate;
207 }
208
209
210
211
212
213
214 public KualiDecimal getFinDocApprovalToThisAmount() {
215 return finDocApprovalToThisAmount;
216 }
217
218
219
220
221
222
223 public void setFinDocApprovalToThisAmount(KualiDecimal finDocApprovalToThisAmount) {
224 this.finDocApprovalToThisAmount = finDocApprovalToThisAmount;
225 }
226
227
228
229
230
231
232 public Account getAccount() {
233 return account;
234 }
235
236
237
238
239
240
241
242 public void setAccount(Account account) {
243 this.account = account;
244 }
245
246
247
248
249
250 public DocumentTypeEBO getFinancialSystemDocumentTypeCode() {
251 if ( StringUtils.isBlank( financialDocumentTypeCode ) ) {
252 financialSystemDocumentTypeCode = null;
253 } else {
254 if ( financialSystemDocumentTypeCode == null || !StringUtils.equals(financialDocumentTypeCode, financialSystemDocumentTypeCode.getName() ) ) {
255 org.kuali.rice.kew.api.doctype.DocumentType temp = SpringContext.getBean(DocumentTypeService.class).getDocumentTypeByName(financialDocumentTypeCode);
256 if ( temp != null ) {
257 financialSystemDocumentTypeCode = DocumentType.from( temp );
258 } else {
259 financialSystemDocumentTypeCode = null;
260 }
261 }
262 }
263 return financialSystemDocumentTypeCode;
264 }
265
266 public Person getAccountDelegate() {
267 accountDelegate = SpringContext.getBean(PersonService.class).updatePersonIfNecessary(accountDelegateSystemId, accountDelegate);
268 return accountDelegate;
269 }
270
271
272
273
274
275
276 public void setAccountDelegate(Person accountDelegate) {
277 this.accountDelegate = accountDelegate;
278 }
279
280
281
282
283
284
285
286 public String getAccountDelegateViewer() {
287 return "View Account Delegate";
288 }
289
290
291
292
293
294
295 public Chart getChart() {
296 return chart;
297 }
298
299
300
301
302
303
304 public void setChart(Chart chart) {
305 this.chart = chart;
306 }
307
308
309
310
311 @Override
312 public boolean equals(Object obj) {
313 if (obj != null) {
314 if (this.getClass().equals(obj.getClass())) {
315 AccountDelegate other = (AccountDelegate) obj;
316 if (StringUtils.equalsIgnoreCase(this.chartOfAccountsCode, other.chartOfAccountsCode)) {
317 if (StringUtils.equalsIgnoreCase(this.accountNumber, other.accountNumber)) {
318 if (StringUtils.equalsIgnoreCase(this.financialDocumentTypeCode, other.financialDocumentTypeCode)) {
319 if (StringUtils.equalsIgnoreCase(this.accountDelegateSystemId, other.accountDelegateSystemId)) {
320 return true;
321 }
322 }
323 }
324 }
325 }
326 }
327 return false;
328 }
329
330
331
332
333 @Override
334 public int hashCode() {
335 return ObjectUtil.generateHashCode(this, Arrays.asList(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, OLEPropertyConstants.ACCOUNT_NUMBER,"financialDocumentTypeCode", "accountDelegateSystemId" ));
336 }
337
338 }
339