1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.kuali.ole.gl.batch.service.impl;
21
22 import java.util.Date;
23
24 import org.kuali.ole.gl.GeneralLedgerConstants;
25 import org.kuali.ole.gl.batch.service.AccountingCycleCachingService;
26 import org.kuali.ole.gl.batch.service.PostTransaction;
27 import org.kuali.ole.gl.businessobject.Reversal;
28 import org.kuali.ole.gl.businessobject.Transaction;
29 import org.kuali.ole.sys.service.ReportWriterService;
30 import org.kuali.rice.krad.service.PersistenceStructureService;
31 import org.springframework.transaction.annotation.Transactional;
32
33
34
35
36 @Transactional
37 public class PostReversal implements PostTransaction {
38 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PostReversal.class);
39
40 private AccountingCycleCachingService accountingCycleCachingService;
41 private PersistenceStructureService persistenceStructureService;
42
43
44
45
46 public PostReversal() {
47 super();
48 }
49
50
51
52
53
54
55
56
57
58
59
60 public String post(Transaction t, int mode, Date postDate, ReportWriterService posterReportWriterService) {
61 LOG.debug("post() started");
62
63 if (t.getFinancialDocumentReversalDate() == null) {
64
65 return GeneralLedgerConstants.EMPTY_CODE;
66 }
67
68 Reversal re = new Reversal(t);
69
70 accountingCycleCachingService.insertReversal(re);
71
72 return GeneralLedgerConstants.INSERT_CODE;
73 }
74
75
76
77
78 public String getDestinationName() {
79 return persistenceStructureService.getTableName(Reversal.class);
80 }
81
82 public void setAccountingCycleCachingService(AccountingCycleCachingService accountingCycleCachingService) {
83 this.accountingCycleCachingService = accountingCycleCachingService;
84 }
85
86 public void setPersistenceStructureService(PersistenceStructureService persistenceStructureService) {
87 this.persistenceStructureService = persistenceStructureService;
88 }
89 }