1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.businessobject;
17
18 import java.sql.Date;
19 import java.sql.Timestamp;
20 import java.util.LinkedHashMap;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.kuali.ole.coa.businessobject.Account;
24 import org.kuali.ole.coa.businessobject.BalanceType;
25 import org.kuali.ole.coa.businessobject.Chart;
26 import org.kuali.ole.coa.businessobject.ObjectCode;
27 import org.kuali.ole.coa.businessobject.SubAccount;
28 import org.kuali.ole.coa.businessobject.SubObjectCode;
29 import org.kuali.ole.sys.OLEPropertyConstants;
30 import org.kuali.ole.sys.businessobject.OriginationCode;
31 import org.kuali.ole.sys.businessobject.SystemOptions;
32 import org.kuali.ole.sys.context.SpringContext;
33 import org.kuali.rice.core.api.util.type.KualiDecimal;
34 import org.kuali.rice.kew.api.doctype.DocumentTypeService;
35 import org.kuali.rice.kew.doctype.bo.DocumentType;
36 import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
37 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
38
39
40
41
42
43
44
45
46
47 public class Encumbrance extends PersistableBusinessObjectBase {
48 static final long serialVersionUID = -7494473472438516396L;
49
50 private Integer universityFiscalYear;
51 private String chartOfAccountsCode;
52 private String accountNumber;
53 private String subAccountNumber;
54 private String objectCode;
55 private String subObjectCode;
56 private String balanceTypeCode;
57 private String documentTypeCode;
58 private String originCode;
59 private String documentNumber;
60 private String transactionEncumbranceDescription;
61 private Date transactionEncumbranceDate;
62 private KualiDecimal accountLineEncumbranceAmount;
63 private KualiDecimal accountLineEncumbranceClosedAmount;
64 private KualiDecimal accountLineEncumbranceOutstandingAmount;
65 private String accountLineEncumbrancePurgeCode;
66 private Timestamp timestamp;
67
68 private SubAccount subAccount;
69 private Chart chart;
70 private Account account;
71 private SubObjectCode financialSubObject;
72 private DocumentTypeEBO financialSystemDocumentTypeCode;
73
74 private ObjectCode financialObject;
75 private BalanceType balanceType;
76 private OriginationCode originationCode;
77 private SystemOptions option;
78
79 private TransientBalanceInquiryAttributes dummyBusinessObject;
80
81 public Encumbrance() {
82 }
83
84 public Encumbrance(Transaction t) {
85 universityFiscalYear = t.getUniversityFiscalYear();
86 chartOfAccountsCode = t.getChartOfAccountsCode();
87 accountNumber = t.getAccountNumber();
88 subAccountNumber = t.getSubAccountNumber();
89 objectCode = t.getFinancialObjectCode();
90 subObjectCode = t.getFinancialSubObjectCode();
91 balanceTypeCode = t.getFinancialBalanceTypeCode();
92 documentTypeCode = t.getFinancialDocumentTypeCode();
93 originCode = t.getFinancialSystemOriginationCode();
94 documentNumber = t.getDocumentNumber();
95 transactionEncumbranceDescription = t.getTransactionLedgerEntryDescription();
96 transactionEncumbranceDate = t.getTransactionDate();
97 accountLineEncumbranceAmount = KualiDecimal.ZERO;
98 accountLineEncumbranceClosedAmount = KualiDecimal.ZERO;
99 accountLineEncumbrancePurgeCode = " ";
100 this.dummyBusinessObject = new TransientBalanceInquiryAttributes();
101 }
102
103
104
105
106
107 public Encumbrance(EncumbranceHistory encumbranceHistory) {
108 universityFiscalYear = encumbranceHistory.getUniversityFiscalYear();
109 chartOfAccountsCode = encumbranceHistory.getChartOfAccountsCode();
110 accountNumber = encumbranceHistory.getAccountNumber();
111 subAccountNumber = encumbranceHistory.getSubAccountNumber();
112 objectCode = encumbranceHistory.getObjectCode();
113 subObjectCode = encumbranceHistory.getSubObjectCode();
114 balanceTypeCode = encumbranceHistory.getBalanceTypeCode();
115 documentTypeCode = encumbranceHistory.getDocumentTypeCode();
116 originCode = encumbranceHistory.getOriginCode();
117 documentNumber = encumbranceHistory.getDocumentNumber();
118 }
119
120
121 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
122 LinkedHashMap map = new LinkedHashMap();
123 map.put(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, getUniversityFiscalYear());
124 map.put(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, getChartOfAccountsCode());
125 map.put(OLEPropertyConstants.ACCOUNT_NUMBER, getAccountNumber());
126 map.put(OLEPropertyConstants.SUB_ACCOUNT_NUMBER, getSubAccountNumber());
127 map.put(OLEPropertyConstants.OBJECT_CODE, getObjectCode());
128 map.put(OLEPropertyConstants.SUB_OBJECT_CODE, getSubObjectCode());
129 map.put(OLEPropertyConstants.BALANCE_TYPE_CODE, getBalanceTypeCode());
130 map.put(OLEPropertyConstants.ENCUMBRANCE_DOCUMENT_TYPE_CODE, getDocumentTypeCode());
131 map.put(OLEPropertyConstants.ORIGIN_CODE, getOriginCode());
132 map.put(OLEPropertyConstants.DOCUMENT_NUMBER, getDocumentNumber());
133 map.put(OLEPropertyConstants.ACCOUNT_LINE_ENCUMBRANCE_AMOUNT, getAccountLineEncumbranceAmount());
134 map.put(OLEPropertyConstants.ACCOUNT_LINE_ENCUMBRANCE_CLOSED_AMOUNT, getAccountLineEncumbranceClosedAmount());
135 return map;
136 }
137
138 public OriginationCode getOriginationCode() {
139 return originationCode;
140 }
141
142 public void setOriginationCode(OriginationCode originationCode) {
143 this.originationCode = originationCode;
144 }
145
146
147
148
149 public KualiDecimal getAccountLineEncumbranceAmount() {
150 return accountLineEncumbranceAmount;
151 }
152
153
154
155
156 public void setAccountLineEncumbranceAmount(KualiDecimal accountLineEncumbranceAmount) {
157 this.accountLineEncumbranceAmount = accountLineEncumbranceAmount;
158 }
159
160
161
162
163 public KualiDecimal getAccountLineEncumbranceClosedAmount() {
164 return accountLineEncumbranceClosedAmount;
165 }
166
167 public void setAccountLineEncumbranceOutstandingAmount() {
168 }
169
170 public KualiDecimal getAccountLineEncumbranceOutstandingAmount() {
171 return accountLineEncumbranceAmount.subtract(accountLineEncumbranceClosedAmount);
172 }
173
174
175
176
177 public void setAccountLineEncumbranceClosedAmount(KualiDecimal accountLineEncumbranceClosedAmount) {
178 this.accountLineEncumbranceClosedAmount = accountLineEncumbranceClosedAmount;
179 }
180
181
182
183
184 public String getAccountLineEncumbrancePurgeCode() {
185 return accountLineEncumbrancePurgeCode;
186 }
187
188
189
190
191 public void setAccountLineEncumbrancePurgeCode(String accountLineEncumbrancePurgeCode) {
192 this.accountLineEncumbrancePurgeCode = accountLineEncumbrancePurgeCode;
193 }
194
195
196
197
198 public String getAccountNumber() {
199 return accountNumber;
200 }
201
202
203
204
205 public void setAccountNumber(String accountNumber) {
206 this.accountNumber = accountNumber;
207 }
208
209
210
211
212 public String getBalanceTypeCode() {
213 return balanceTypeCode;
214 }
215
216
217
218
219 public void setBalanceTypeCode(String balanceTypeCode) {
220 this.balanceTypeCode = balanceTypeCode;
221 }
222
223
224
225
226 public String getChartOfAccountsCode() {
227 return chartOfAccountsCode;
228 }
229
230
231
232
233 public void setChartOfAccountsCode(String chartOfAccountsCode) {
234 this.chartOfAccountsCode = chartOfAccountsCode;
235 }
236
237
238
239
240 public String getDocumentNumber() {
241 return documentNumber;
242 }
243
244
245
246
247 public void setDocumentNumber(String documentNumber) {
248 this.documentNumber = documentNumber;
249 }
250
251
252
253
254 public String getDocumentTypeCode() {
255 return documentTypeCode;
256 }
257
258
259
260
261 public void setDocumentTypeCode(String documentTypeCode) {
262 this.documentTypeCode = documentTypeCode;
263 }
264
265
266
267
268 public String getObjectCode() {
269 return objectCode;
270 }
271
272
273
274
275 public void setObjectCode(String objectCode) {
276 this.objectCode = objectCode;
277 }
278
279
280
281
282 public String getOriginCode() {
283 return originCode;
284 }
285
286
287
288
289 public void setOriginCode(String originCode) {
290 this.originCode = originCode;
291 }
292
293
294
295
296 public String getSubAccountNumber() {
297 return subAccountNumber;
298 }
299
300
301
302
303 public void setSubAccountNumber(String subAccountNumber) {
304 this.subAccountNumber = subAccountNumber;
305 }
306
307
308
309
310 public String getSubObjectCode() {
311 return subObjectCode;
312 }
313
314
315
316
317 public void setSubObjectCode(String subObjectCode) {
318 this.subObjectCode = subObjectCode;
319 }
320
321
322
323
324 public Timestamp getTimestamp() {
325 return timestamp;
326 }
327
328
329
330
331 public void setTimestamp(Timestamp timestamp) {
332 this.timestamp = timestamp;
333 }
334
335
336
337
338 public Date getTransactionEncumbranceDate() {
339 return transactionEncumbranceDate;
340 }
341
342
343
344
345 public void setTransactionEncumbranceDate(Date transactionEncumbranceDate) {
346 this.transactionEncumbranceDate = transactionEncumbranceDate;
347 }
348
349
350
351
352 public String getTransactionEncumbranceDescription() {
353 return transactionEncumbranceDescription;
354 }
355
356
357
358
359 public void setTransactionEncumbranceDescription(String transactionEncumbranceDescription) {
360 this.transactionEncumbranceDescription = transactionEncumbranceDescription;
361 }
362
363
364
365
366 public Integer getUniversityFiscalYear() {
367 return universityFiscalYear;
368 }
369
370
371
372
373 public void setUniversityFiscalYear(Integer universityFiscalYear) {
374 this.universityFiscalYear = universityFiscalYear;
375 }
376
377
378
379
380
381
382 public Account getAccount() {
383 return account;
384 }
385
386
387
388
389
390
391 public void setAccount(Account account) {
392 this.account = account;
393 }
394
395
396
397
398
399
400 public Chart getChart() {
401 return chart;
402 }
403
404
405
406
407
408
409 public void setChart(Chart chart) {
410 this.chart = chart;
411 }
412
413
414
415
416
417
418 public ObjectCode getFinancialObject() {
419 return financialObject;
420 }
421
422
423
424
425
426
427 public void setFinancialObject(ObjectCode financialObject) {
428 this.financialObject = financialObject;
429 }
430
431
432
433
434
435
436 public BalanceType getBalanceType() {
437 return balanceType;
438 }
439
440
441
442
443
444
445 public void setBalanceType(BalanceType balanceType) {
446 this.balanceType = balanceType;
447 }
448
449
450
451
452
453
454 public TransientBalanceInquiryAttributes getDummyBusinessObject() {
455 return dummyBusinessObject;
456 }
457
458
459
460
461
462
463 public void setDummyBusinessObject(TransientBalanceInquiryAttributes dummyBusinessObject) {
464 this.dummyBusinessObject = dummyBusinessObject;
465 }
466
467
468
469
470
471
472 public SystemOptions getOption() {
473 return option;
474 }
475
476
477
478
479
480
481 public void setOption(SystemOptions option) {
482 this.option = option;
483 }
484
485
486
487
488
489
490 public SubAccount getSubAccount() {
491 return subAccount;
492 }
493
494
495
496
497
498
499 public void setSubAccount(SubAccount subAccount) {
500 this.subAccount = subAccount;
501 }
502
503
504
505
506
507 public DocumentTypeEBO getFinancialSystemDocumentTypeCode() {
508 if ( StringUtils.isBlank( documentTypeCode ) ) {
509 financialSystemDocumentTypeCode = null;
510 } else {
511 if ( financialSystemDocumentTypeCode == null || !StringUtils.equals(documentTypeCode, financialSystemDocumentTypeCode.getName() ) ) {
512 org.kuali.rice.kew.api.doctype.DocumentType temp = SpringContext.getBean(DocumentTypeService.class).getDocumentTypeByName(documentTypeCode);
513 if ( temp != null ) {
514 financialSystemDocumentTypeCode = DocumentType.from( temp );
515 } else {
516 financialSystemDocumentTypeCode = null;
517 }
518 }
519 }
520 return financialSystemDocumentTypeCode;
521 }
522
523
524
525
526
527
528 public SubObjectCode getFinancialSubObject() {
529 return financialSubObject;
530 }
531
532
533
534
535
536
537 public void setFinancialSubObject(SubObjectCode financialSubObject) {
538 this.financialSubObject = financialSubObject;
539 }
540 }