01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.module.labor.batch.poster.impl;
17:
18: import java.sql.Date;
19:
20: import org.kuali.kfs.KFSConstants;
21: import org.kuali.module.gl.batch.poster.PostTransaction;
22: import org.kuali.module.gl.bo.Transaction;
23: import org.kuali.module.labor.LaborConstants;
24: import org.kuali.module.labor.bo.LaborTransaction;
25: import org.kuali.module.labor.bo.LedgerEntry;
26: import org.kuali.module.labor.service.LaborLedgerEntryService;
27: import org.springframework.transaction.annotation.Transactional;
28:
29: /**
30: * The class is used to post a transaction to labor ledger entry table
31: */
32: @Transactional
33: public class LaborLedgerEntryPoster implements PostTransaction {
34: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
35: .getLogger(LaborLedgerEntryPoster.class);
36: private LaborLedgerEntryService laborLedgerEntryService;
37:
38: /**
39: * @see org.kuali.module.gl.batch.poster.PostTransaction#post(org.kuali.module.gl.bo.Transaction, int, java.util.Date)
40: */
41: public String post(Transaction transaction, int mode,
42: java.util.Date postDate) {
43: String operationType = KFSConstants.OperationType.INSERT;
44: LedgerEntry ledgerEntry = new LedgerEntry(
45: (LaborTransaction) transaction);
46: // ObjectUtil.buildObject(ledgerEntry, transaction);
47:
48: ledgerEntry
49: .setTransactionLedgerEntrySequenceNumber(laborLedgerEntryService
50: .getMaxSequenceNumber(ledgerEntry) + 1);
51: ledgerEntry.setTransactionPostingDate(new Date(postDate
52: .getTime()));
53:
54: laborLedgerEntryService.save(ledgerEntry);
55: return operationType;
56: }
57:
58: /**
59: * @see org.kuali.module.gl.batch.poster.PostTransaction#getDestinationName()
60: */
61: public String getDestinationName() {
62: return LaborConstants.DestinationNames.LEDGER_ENRTY;
63: }
64:
65: /**
66: * Sets the laborLedgerEntryService attribute value.
67: *
68: * @param laborLedgerEntryService The laborLedgerEntryService to set.
69: */
70: public void setLaborLedgerEntryService(
71: LaborLedgerEntryService laborledgerEntryService) {
72: this.laborLedgerEntryService = laborledgerEntryService;
73: }
74: }
|