Source Code Cross Referenced for LaborNightlyOutServiceImpl.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » labor » 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.labor.service.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.service.impl;
017:
018:        import java.sql.Date;
019:        import java.util.Collection;
020:        import java.util.Iterator;
021:
022:        import org.kuali.core.service.BusinessObjectService;
023:        import org.kuali.core.service.DateTimeService;
024:        import org.kuali.kfs.KFSConstants;
025:        import org.kuali.module.gl.bo.OriginEntryFull;
026:        import org.kuali.module.gl.bo.OriginEntryGroup;
027:        import org.kuali.module.gl.bo.OriginEntrySource;
028:        import org.kuali.module.gl.service.OriginEntryGroupService;
029:        import org.kuali.module.labor.bo.LaborGeneralLedgerEntry;
030:        import org.kuali.module.labor.bo.LaborLedgerPendingEntry;
031:        import org.kuali.module.labor.bo.LaborOriginEntry;
032:        import org.kuali.module.labor.service.LaborLedgerPendingEntryService;
033:        import org.kuali.module.labor.service.LaborNightlyOutService;
034:        import org.kuali.module.labor.service.LaborReportService;
035:        import org.kuali.module.labor.util.ObjectUtil;
036:        import org.kuali.module.labor.util.ReportRegistry;
037:        import org.springframework.transaction.annotation.Transactional;
038:
039:        /**
040:         * The class implements loading and cleanup methods for nightly batch jobs
041:         */
042:        @Transactional
043:        public class LaborNightlyOutServiceImpl implements 
044:                LaborNightlyOutService {
045:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
046:                    .getLogger(LaborNightlyOutServiceImpl.class);
047:
048:            private LaborLedgerPendingEntryService laborLedgerPendingEntryService;
049:            private OriginEntryGroupService originEntryGroupService;
050:            private LaborReportService laborReportService;
051:
052:            private BusinessObjectService businessObjectService;
053:            private DateTimeService dateTimeService;
054:
055:            /**
056:             * @see org.kuali.module.labor.service.LaborNightlyOutService#deleteCopiedPendingLedgerEntries()
057:             */
058:            public void deleteCopiedPendingLedgerEntries() {
059:                laborLedgerPendingEntryService
060:                        .deleteByFinancialDocumentApprovedCode(KFSConstants.PENDING_ENTRY_APPROVED_STATUS_CODE.PROCESSED);
061:            }
062:
063:            /**
064:             * @see org.kuali.module.labor.service.LaborNightlyOutService#copyApprovedPendingLedgerEntries()
065:             */
066:            public void copyApprovedPendingLedgerEntries() {
067:                Date runDate = dateTimeService.getCurrentSqlDate();
068:                String reportDirectory = ReportRegistry.getReportsDirectory();
069:                OriginEntryGroup group = originEntryGroupService
070:                        .createGroup(runDate, OriginEntrySource.LABOR_EDOC,
071:                                true, true, true);
072:
073:                Iterator<LaborLedgerPendingEntry> pendingEntries = laborLedgerPendingEntryService
074:                        .findApprovedPendingLedgerEntries();
075:                while (pendingEntries != null && pendingEntries.hasNext()) {
076:                    LaborLedgerPendingEntry pendingEntry = pendingEntries
077:                            .next();
078:
079:                    // copy the pending entry to labor origin entry table
080:                    boolean isSaved = saveAsLaborOriginEntry(pendingEntry,
081:                            group);
082:                    if (isSaved) {
083:                        // update the pending entry to indicate it has been copied
084:                        pendingEntry
085:                                .setFinancialDocumentApprovedCode(KFSConstants.PENDING_ENTRY_APPROVED_STATUS_CODE.PROCESSED);
086:                        pendingEntry.setTransactionDate(runDate);
087:                        businessObjectService.save(pendingEntry);
088:                    }
089:                }
090:                laborReportService.generateInputSummaryReport(group,
091:                        ReportRegistry.LABOR_PENDING_ENTRY_SUMMARY,
092:                        reportDirectory, runDate);
093:            }
094:
095:            /**
096:             * @see org.kuali.module.labor.service.LaborNightlyOutService#deleteCopiedLaborGenerealLedgerEntries()
097:             */
098:            public void deleteCopiedLaborGenerealLedgerEntries() {
099:                Collection<LaborGeneralLedgerEntry> generalLedgerEntries = businessObjectService
100:                        .findAll(LaborGeneralLedgerEntry.class);
101:                for (LaborGeneralLedgerEntry entry : generalLedgerEntries) {
102:                    businessObjectService.delete(entry);
103:                }
104:            }
105:
106:            /**
107:             * @see org.kuali.module.labor.service.LaborNightlyOutService#copyLaborGenerealLedgerEntries()
108:             */
109:            public void copyLaborGenerealLedgerEntries() {
110:                Date runDate = dateTimeService.getCurrentSqlDate();
111:                String reportDirectory = ReportRegistry.getReportsDirectory();
112:                OriginEntryGroup group = originEntryGroupService.createGroup(
113:                        runDate, OriginEntrySource.LABOR_LEDGER_GENERAL_LEDGER,
114:                        true, true, true);
115:
116:                // copy the labor general ledger entry to origin entry table
117:                Collection<LaborGeneralLedgerEntry> generalLedgerEntries = businessObjectService
118:                        .findAll(LaborGeneralLedgerEntry.class);
119:                int numberOfGLEntries = generalLedgerEntries.size();
120:
121:                for (LaborGeneralLedgerEntry entry : generalLedgerEntries) {
122:                    boolean isSaved = saveAsGLOriginEntry(entry, group);
123:                }
124:
125:                laborReportService.generateGLSummaryReport(group,
126:                        ReportRegistry.LABOR_GL_SUMMARY, reportDirectory,
127:                        runDate);
128:            }
129:
130:            /*
131:             * save the given pending ledger entry as a labor origin entry
132:             */
133:            private boolean saveAsLaborOriginEntry(
134:                    LaborLedgerPendingEntry pendingEntry, OriginEntryGroup group) {
135:                try {
136:                    LaborOriginEntry originEntry = new LaborOriginEntry();
137:                    ObjectUtil.buildObject(originEntry, pendingEntry);
138:
139:                    originEntry.setTransactionPostingDate(group.getDate());
140:                    originEntry.setEntryGroupId(group.getId());
141:
142:                    businessObjectService.save(originEntry);
143:                } catch (Exception e) {
144:                    LOG.debug("Fail to copy the pending entry as origin entry"
145:                            + e);
146:                    return false;
147:                }
148:                return true;
149:            }
150:
151:            /*
152:             * save the given pending ledger entry as a labor origin entry
153:             */
154:            private boolean saveAsGLOriginEntry(LaborGeneralLedgerEntry entry,
155:                    OriginEntryGroup group) {
156:                try {
157:                    OriginEntryFull originEntry = new OriginEntryFull();
158:                    ObjectUtil.buildObject(originEntry, entry);
159:
160:                    originEntry.setEntryGroupId(group.getId());
161:                    businessObjectService.save(originEntry);
162:                } catch (Exception e) {
163:                    LOG
164:                            .debug("Fail to copy the labor GL entry as an origin entry"
165:                                    + e);
166:                    return false;
167:                }
168:                return true;
169:            }
170:
171:            /**
172:             * Sets the businessObjectService attribute value.
173:             * 
174:             * @param businessObjectService The businessObjectService to set.
175:             */
176:            public void setBusinessObjectService(
177:                    BusinessObjectService businessObjectService) {
178:                this .businessObjectService = businessObjectService;
179:            }
180:
181:            /**
182:             * Sets the dateTimeService attribute value.
183:             * 
184:             * @param dateTimeService The dateTimeService to set.
185:             */
186:            public void setDateTimeService(DateTimeService dateTimeService) {
187:                this .dateTimeService = dateTimeService;
188:            }
189:
190:            /**
191:             * Sets the laborLedgerPendingEntryService attribute value.
192:             * 
193:             * @param laborLedgerPendingEntryService The laborLedgerPendingEntryService to set.
194:             */
195:            public void setLaborLedgerPendingEntryService(
196:                    LaborLedgerPendingEntryService laborLedgerPendingEntryService) {
197:                this .laborLedgerPendingEntryService = laborLedgerPendingEntryService;
198:            }
199:
200:            /**
201:             * Sets the laborReportService attribute value.
202:             * 
203:             * @param laborReportService The laborReportService to set.
204:             */
205:            public void setLaborReportService(
206:                    LaborReportService laborReportService) {
207:                this .laborReportService = laborReportService;
208:            }
209:
210:            /**
211:             * Sets the originEntryGroupService attribute value.
212:             * 
213:             * @param originEntryGroupService The originEntryGroupService to set.
214:             */
215:            public void setOriginEntryGroupService(
216:                    OriginEntryGroupService originEntryGroupService) {
217:                this.originEntryGroupService = originEntryGroupService;
218:            }
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.