Source Code Cross Referenced for ReversalServiceImpl.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » service » 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.gl.service.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-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.gl.service.impl;
017:
018:        import java.util.Date;
019:        import java.util.Iterator;
020:
021:        import org.kuali.kfs.KFSConstants;
022:        import org.kuali.module.chart.service.AccountingPeriodService;
023:        import org.kuali.module.financial.service.UniversityDateService;
024:        import org.kuali.module.gl.bo.Reversal;
025:        import org.kuali.module.gl.bo.Transaction;
026:        import org.kuali.module.gl.dao.ReversalDao;
027:        import org.kuali.module.gl.service.ReversalService;
028:        import org.kuali.module.gl.util.LedgerEntry;
029:        import org.kuali.module.gl.util.LedgerEntryHolder;
030:        import org.springframework.transaction.annotation.Transactional;
031:
032:        /**
033:         * This transactional class provides the default implementation of the services required in ReversalService
034:         * 
035:         * @see org.kuali.module.gl.service.ReversalService
036:         */
037:        @Transactional
038:        public class ReversalServiceImpl implements  ReversalService {
039:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
040:                    .getLogger(ReversalServiceImpl.class);
041:
042:            private ReversalDao reversalDao;
043:            private AccountingPeriodService accountingPeriodService;
044:            private UniversityDateService universityDateService;
045:
046:            /**
047:             * Deletes a reversal record
048:             * 
049:             * @param re the reversal to delete, remove, or otherwise expiate from the database
050:             * @see org.kuali.module.gl.service.ReversalService#delete(org.kuali.module.gl.bo.Reversal)
051:             */
052:            public void delete(Reversal re) {
053:                LOG.debug("delete() started");
054:
055:                reversalDao.delete(re);
056:            }
057:
058:            /**
059:             * Returns all the reversal records set to reverse on or before the given date
060:             * 
061:             * @param before the date to find reversals on or before
062:             * @see org.kuali.module.gl.service.ReversalService#getByDate(java.util.Date)
063:             */
064:            public Iterator getByDate(Date before) {
065:                LOG.debug("getByDate() started");
066:
067:                return reversalDao.getByDate(before);
068:            }
069:
070:            public Reversal getByTransaction(Transaction t) {
071:                LOG.debug("getByTransaction() started");
072:
073:                return reversalDao.getByTransaction(t);
074:            }
075:
076:            /**
077:             * Summarizes all of the reversal records set to reverse before or on the given date
078:             * @param before the date reversals summarized should be on or before
079:             * @return a LedgerEntryHolder with a summary of
080:             * @see org.kuali.module.gl.service.ReversalService#getSummaryByDate(java.util.Date)
081:             */
082:            public LedgerEntryHolder getSummaryByDate(Date before) {
083:                LOG.debug("getSummaryByDate() started");
084:
085:                LedgerEntryHolder ledgerEntryHolder = new LedgerEntryHolder();
086:
087:                Iterator reversalsIterator = reversalDao.getByDate(before);
088:                while (reversalsIterator.hasNext()) {
089:                    Reversal reversal = (Reversal) reversalsIterator.next();
090:                    LedgerEntry ledgerEntry = buildLedgerEntryFromReversal(reversal);
091:                    ledgerEntryHolder.insertLedgerEntry(ledgerEntry, true);
092:                }
093:                return ledgerEntryHolder;
094:            }
095:
096:            /**
097:             * Creates a LedgerEntry from a reversal, which is proper for summarization (ie, its fiscal year and period code are based off
098:             * the reversal date, not off the transaction date or the reversal's current fiscal year and accounting period)
099:             * 
100:             * @param reversal reversal to build LedgerEntry with
101:             * @return a new LedgerEntry, populated by the reversal
102:             */
103:            private LedgerEntry buildLedgerEntryFromReversal(Reversal reversal) {
104:                LedgerEntry entry = new LedgerEntry(universityDateService
105:                        .getFiscalYear(reversal
106:                                .getFinancialDocumentReversalDate()),
107:                        accountingPeriodService.getByDate(
108:                                reversal.getFinancialDocumentReversalDate())
109:                                .getUniversityFiscalPeriodCode(), reversal
110:                                .getFinancialBalanceTypeCode(), reversal
111:                                .getFinancialSystemOriginationCode());
112:                if (KFSConstants.GL_CREDIT_CODE.equals(reversal
113:                        .getTransactionDebitCreditCode())) {
114:                    entry.setCreditAmount(reversal
115:                            .getTransactionLedgerEntryAmount());
116:                    entry.setCreditCount(1);
117:                } else if (KFSConstants.GL_DEBIT_CODE.equals(reversal
118:                        .getTransactionDebitCreditCode())) {
119:                    entry.setDebitAmount(reversal
120:                            .getTransactionLedgerEntryAmount());
121:                    entry.setDebitCount(1);
122:                } else {
123:                    entry.setNoDCAmount(reversal
124:                            .getTransactionLedgerEntryAmount());
125:                    entry.setNoDCCount(1);
126:                }
127:                entry.setRecordCount(1);
128:                return entry;
129:            }
130:
131:            /**
132:             * Saves a reversal record
133:             * 
134:             * @param re the reversal to save
135:             * @see org.kuali.module.gl.service.ReversalService#save(org.kuali.module.gl.bo.Reversal)
136:             */
137:            public void save(Reversal re) {
138:                LOG.debug("save() started");
139:
140:                reversalDao.save(re);
141:            }
142:
143:            /**
144:             * Sets the reversalDao attribute, allowing injection of an implementation of that data access object
145:             * 
146:             * @param reversalDao the reversalDao implementation to set
147:             * @see org.kuali.module.gl.dao.ReversalDao
148:             */
149:            public void setReversalDao(ReversalDao reversalDao) {
150:                this .reversalDao = reversalDao;
151:            }
152:
153:            /**
154:             * Sets the accountingPeriodService attribute, allowing injection of an implementation of that service
155:             * 
156:             * @param accountingPeriodService the accountingPeriodService implementation to set
157:             * @see org.kuali.module.chart.service.AccountingPeriodService
158:             */
159:            public void setAccountingPeriodService(
160:                    AccountingPeriodService accountingPeriodService) {
161:                this .accountingPeriodService = accountingPeriodService;
162:            }
163:
164:            /**
165:             * Sets the unversityDateService attribute, allowing injection of an implementation of that service
166:             * 
167:             * @param universityDateService the universityDateService implementation to set
168:             * @see org.kuali.module.financial.service.UniversityDateService
169:             */
170:            public void setUniversityDateService(
171:                    UniversityDateService universityDateService) {
172:                this.universityDateService = universityDateService;
173:            }
174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.