Source Code Cross Referenced for LaborGLLedgerEntryPoster.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » labor » batch » poster » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.module.labor.batch.poster.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.module.labor.batch.poster.impl;
017:
018:        import java.sql.Date;
019:        import java.util.HashMap;
020:        import java.util.Map;
021:
022:        import org.apache.commons.lang.StringUtils;
023:        import org.kuali.core.service.DataDictionaryService;
024:        import org.kuali.core.util.KualiDecimal;
025:        import org.kuali.kfs.KFSConstants;
026:        import org.kuali.kfs.KFSPropertyConstants;
027:        import org.kuali.kfs.context.SpringContext;
028:        import org.kuali.module.gl.batch.poster.PostTransaction;
029:        import org.kuali.module.gl.bo.Entry;
030:        import org.kuali.module.gl.bo.Transaction;
031:        import org.kuali.module.labor.LaborConstants;
032:        import org.kuali.module.labor.bo.LaborGeneralLedgerEntry;
033:        import org.kuali.module.labor.service.LaborGeneralLedgerEntryService;
034:        import org.kuali.module.labor.util.DebitCreditUtil;
035:        import org.kuali.module.labor.util.ObjectUtil;
036:        import org.springframework.transaction.annotation.Transactional;
037:
038:        /**
039:         * This class is used to post a transaction into labor GL entry table
040:         */
041:        @Transactional
042:        public class LaborGLLedgerEntryPoster implements  PostTransaction {
043:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
044:                    .getLogger(LaborGLLedgerEntryPoster.class);
045:            private LaborGeneralLedgerEntryService laborGeneralLedgerEntryService;
046:
047:            /**
048:             * @see org.kuali.module.gl.batch.poster.PostTransaction#post(org.kuali.module.gl.bo.Transaction, int, java.util.Date)
049:             */
050:            public String post(Transaction transaction, int mode,
051:                    java.util.Date postDate) {
052:                String operationType = KFSConstants.OperationType.INSERT;
053:                LaborGeneralLedgerEntry laborGeneralLedgerEntry = new LaborGeneralLedgerEntry();
054:                ObjectUtil.buildObject(laborGeneralLedgerEntry, transaction);
055:
056:                laborGeneralLedgerEntry.setTransactionDate(new Date(postDate
057:                        .getTime()));
058:
059:                laborGeneralLedgerEntry.setTransactionDebitCreditCode(this 
060:                        .getDebitCreditCode(transaction));
061:                laborGeneralLedgerEntry.setTransactionLedgerEntryAmount(this 
062:                        .getTransactionAmount(transaction));
063:
064:                laborGeneralLedgerEntry
065:                        .setTransactionLedgerEntryDescription(getTransactionDescription(transaction));
066:
067:                laborGeneralLedgerEntry
068:                        .setTransactionEncumbranceUpdateCode(this 
069:                                .getEncumbranceUpdateCode(transaction));
070:
071:                Integer sequenceNumber = laborGeneralLedgerEntryService
072:                        .getMaxSequenceNumber(laborGeneralLedgerEntry) + 1;
073:                laborGeneralLedgerEntry
074:                        .setTransactionLedgerEntrySequenceNumber(sequenceNumber);
075:
076:                laborGeneralLedgerEntryService.save(laborGeneralLedgerEntry);
077:                return operationType;
078:            }
079:
080:            /**
081:             * @return the debit credit code
082:             */
083:            private String getDebitCreditCode(Transaction transaction) {
084:                KualiDecimal transactionAmount = transaction
085:                        .getTransactionLedgerEntryAmount();
086:                return DebitCreditUtil.getDebitCreditCode(transactionAmount,
087:                        false);
088:            }
089:
090:            /**
091:             * @return the transaction amount
092:             */
093:            private KualiDecimal getTransactionAmount(Transaction transaction) {
094:                KualiDecimal transactionAmount = transaction
095:                        .getTransactionLedgerEntryAmount();
096:                return transactionAmount.abs();
097:            }
098:
099:            /**
100:             * @return the encumbrance update code
101:             */
102:            private String getEncumbranceUpdateCode(Transaction transaction) {
103:                String encumbranceUpdateCode = transaction
104:                        .getTransactionEncumbranceUpdateCode();
105:                if (KFSConstants.ENCUMB_UPDT_DOCUMENT_CD
106:                        .equals(encumbranceUpdateCode)
107:                        || KFSConstants.ENCUMB_UPDT_REFERENCE_DOCUMENT_CD
108:                                .equals(encumbranceUpdateCode)) {
109:                    return encumbranceUpdateCode;
110:                }
111:                return null;
112:            }
113:
114:            /**
115:             * @return the transaction description
116:             */
117:            private String getTransactionDescription(Transaction transaction) {
118:                String documentTypeCode = transaction
119:                        .getFinancialDocumentTypeCode();
120:                String description = getDescriptionMap().get(documentTypeCode);
121:                description = StringUtils.isNotEmpty(description) ? description
122:                        : transaction.getTransactionLedgerEntryDescription();
123:
124:                // make sure the length of the description cannot excess the specified maximum
125:                int transactionDescriptionMaxLength = SpringContext.getBean(
126:                        DataDictionaryService.class).getAttributeMaxLength(
127:                        Entry.class,
128:                        KFSPropertyConstants.TRANSACTION_LEDGER_ENTRY_DESC)
129:                        .intValue();
130:                if (StringUtils.isNotEmpty(description)
131:                        && description.length() > transactionDescriptionMaxLength) {
132:                    description = StringUtils.left(description,
133:                            transactionDescriptionMaxLength);
134:                }
135:
136:                return description;
137:            }
138:
139:            /**
140:             * @return the description dictionary that can be used to look up approperite description
141:             */
142:            public static Map<String, String> getDescriptionMap() {
143:                Map<String, String> descriptionMap = new HashMap<String, String>();
144:
145:                descriptionMap.put(
146:                        LaborConstants.PayrollDocumentTypeCode.NORMAL_PAY,
147:                        "NORMAL PAYROLL ACTIVITY");
148:                descriptionMap
149:                        .put(
150:                                LaborConstants.PayrollDocumentTypeCode.ACCRUALS_REVERSAL,
151:                                "PAYROLL ACCRUAL REVERSAL");
152:                descriptionMap.put(
153:                        LaborConstants.PayrollDocumentTypeCode.ACCRUALS,
154:                        "PAYROLL ACCRUALS");
155:                descriptionMap
156:                        .put(
157:                                LaborConstants.PayrollDocumentTypeCode.CHECK_CANCELLATION,
158:                                "PAYROLL CHECK CANCELLATIONS");
159:                descriptionMap.put(
160:                        LaborConstants.PayrollDocumentTypeCode.ENCUMBRANCE,
161:                        "PAYROLL ENCUMBRANCES");
162:                descriptionMap
163:                        .put(
164:                                LaborConstants.PayrollDocumentTypeCode.EXPENSE_TRANSFER_ET,
165:                                "PAYROLL EXPENSE TRANSFERS");
166:                descriptionMap
167:                        .put(
168:                                LaborConstants.PayrollDocumentTypeCode.EXPENSE_TRANSFER_SACH,
169:                                "PAYROLL EXPENSE TRANSFERS");
170:                descriptionMap
171:                        .put(
172:                                LaborConstants.PayrollDocumentTypeCode.HAND_DRAWN_CHECK,
173:                                "PAYROLL HAND DRAWN CHECK PAYMENTS");
174:                descriptionMap.put(
175:                        LaborConstants.PayrollDocumentTypeCode.OVERPAYMENT,
176:                        "PAYROLL OVERPAYMENT COLLECTIONS");
177:                descriptionMap
178:                        .put(
179:                                LaborConstants.PayrollDocumentTypeCode.RETROACTIVE_ADJUSTMENT,
180:                                "PAYROLL RETROACTIVE ADJUSTMENTS");
181:
182:                return descriptionMap;
183:            }
184:
185:            /**
186:             * @see org.kuali.module.gl.batch.poster.PostTransaction#getDestinationName()
187:             */
188:            public String getDestinationName() {
189:                return LaborConstants.DestinationNames.LABOR_GL_ENTRY;
190:            }
191:
192:            /**
193:             * Sets the laborGeneralLedgerEntryService attribute value.
194:             * 
195:             * @param laborGeneralLedgerEntryService The laborGeneralLedgerEntryService to set.
196:             */
197:            public void setLaborGeneralLedgerEntryService(
198:                    LaborGeneralLedgerEntryService laborGeneralLedgerEntryService) {
199:                this.laborGeneralLedgerEntryService = laborGeneralLedgerEntryService;
200:            }
201:        }
www.__j___av_a__2_s.__co___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.