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.batch.service.PosterService;
28  import org.kuali.ole.gl.businessobject.Entry;
29  import org.kuali.ole.gl.businessobject.Transaction;
30  import org.kuali.ole.sys.service.ReportWriterService;
31  import org.kuali.rice.krad.service.PersistenceStructureService;
32  import org.springframework.transaction.annotation.Transactional;
33  
34  
35  
36  
37  @Transactional
38  public class PostEntry implements PostTransaction {
39      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PostEntry.class);
40  
41      private AccountingCycleCachingService accountingCycleCachingService;
42      private PersistenceStructureService persistenceStructureService;
43  
44      
45  
46  
47      public PostEntry() {
48          super();
49      }
50  
51      
52  
53  
54  
55  
56  
57  
58  
59  
60  
61      public String post(Transaction t, int mode, Date postDate, ReportWriterService posterReportWriterService) {
62          LOG.debug("post() started");
63  
64          Entry e = new Entry(t, postDate);
65  
66          if (mode == PosterService.MODE_REVERSAL) {
67              e.setFinancialDocumentReversalDate(null);
68          }
69          
70          accountingCycleCachingService.insertEntry(e);
71  
72          return GeneralLedgerConstants.INSERT_CODE;
73      }
74  
75      
76  
77  
78      public String getDestinationName() {
79          return persistenceStructureService.getTableName(Entry.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  
90  }