Source Code Cross Referenced for OrganizationReversionProcessServiceImpl.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.sql.Date;
019:        import java.text.ParseException;
020:        import java.text.SimpleDateFormat;
021:        import java.util.ArrayList;
022:        import java.util.HashMap;
023:        import java.util.List;
024:        import java.util.Map;
025:
026:        import org.kuali.core.service.DateTimeService;
027:        import org.kuali.core.service.PersistenceService;
028:        import org.kuali.kfs.KFSConstants;
029:        import org.kuali.kfs.service.ParameterService;
030:        import org.kuali.kfs.service.impl.ParameterConstants;
031:        import org.kuali.module.chart.bo.OrganizationReversion;
032:        import org.kuali.module.chart.service.OrganizationReversionService;
033:        import org.kuali.module.chart.service.PriorYearAccountService;
034:        import org.kuali.module.gl.GLConstants;
035:        import org.kuali.module.gl.bo.OriginEntryGroup;
036:        import org.kuali.module.gl.bo.OriginEntrySource;
037:        import org.kuali.module.gl.service.BalanceService;
038:        import org.kuali.module.gl.service.OrgReversionUnitOfWorkService;
039:        import org.kuali.module.gl.service.OrganizationReversionCategoryLogic;
040:        import org.kuali.module.gl.service.OrganizationReversionProcessService;
041:        import org.kuali.module.gl.service.OriginEntryGroupService;
042:        import org.kuali.module.gl.service.OriginEntryService;
043:        import org.kuali.module.gl.service.ReportService;
044:        import org.kuali.module.gl.service.impl.orgreversion.OrganizationReversionProcess;
045:        import org.kuali.module.gl.util.Summary;
046:        import org.springframework.transaction.annotation.Transactional;
047:
048:        /**
049:         * The base implementation of OrganizationReversionProcessService
050:         */
051:        @Transactional
052:        public class OrganizationReversionProcessServiceImpl implements 
053:                OrganizationReversionProcessService {
054:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
055:                    .getLogger(OrganizationReversionProcessServiceImpl.class);
056:
057:            private static final String DATE_FORMAT = "yyyy-MM-dd";
058:
059:            private OrganizationReversionService organizationReversionService;
060:            private ParameterService parameterService;
061:            private BalanceService balanceService;
062:            private OriginEntryGroupService originEntryGroupService;
063:            private OriginEntryService originEntryService;
064:            private PersistenceService persistenceService;
065:            private DateTimeService dateTimeService;
066:            private OrganizationReversionCategoryLogic cashOrganizationReversionCategoryLogic;
067:            private PriorYearAccountService priorYearAccountService;
068:            private ReportService reportService;
069:            private OrgReversionUnitOfWorkService orgReversionUnitOfWorkService;
070:
071:            public void setBalanceService(BalanceService balanceService) {
072:                this .balanceService = balanceService;
073:            }
074:
075:            public void setCashOrganizationReversionCategoryLogic(
076:                    OrganizationReversionCategoryLogic cashOrganizationReversionCategoryLogic) {
077:                this .cashOrganizationReversionCategoryLogic = cashOrganizationReversionCategoryLogic;
078:            }
079:
080:            public void setDateTimeService(DateTimeService dateTimeService) {
081:                this .dateTimeService = dateTimeService;
082:            }
083:
084:            public void setOrganizationReversionService(
085:                    OrganizationReversionService organizationReversionService) {
086:                this .organizationReversionService = organizationReversionService;
087:            }
088:
089:            public void setOriginEntryGroupService(
090:                    OriginEntryGroupService originEntryGroupService) {
091:                this .originEntryGroupService = originEntryGroupService;
092:            }
093:
094:            public void setOriginEntryService(
095:                    OriginEntryService originEntryService) {
096:                this .originEntryService = originEntryService;
097:            }
098:
099:            public void setPersistenceService(
100:                    PersistenceService persistenceService) {
101:                this .persistenceService = persistenceService;
102:            }
103:
104:            public void setPriorYearAccountService(PriorYearAccountService pyas) {
105:                priorYearAccountService = pyas;
106:            }
107:
108:            /**
109:             * Sets the reportService attribute value.
110:             * 
111:             * @param reportService The reportService to set.
112:             */
113:            public void setReportService(ReportService reportService) {
114:                this .reportService = reportService;
115:            }
116:
117:            /**
118:             * Sets the orgReversionUnitOfWorkService attribute.
119:             * 
120:             * @param orgReversionUnitOfWorkService the service to set.
121:             */
122:            public void setOrgReversionUnitOfWorkService(
123:                    OrgReversionUnitOfWorkService orgReversionUnitOfWorkService) {
124:                this .orgReversionUnitOfWorkService = orgReversionUnitOfWorkService;
125:            }
126:
127:            /**
128:             * Runs the Organization Reversion Year End Process for the end of a fiscal year (ie, a process that
129:             * runs before the fiscal year end, and thus uses current account, etc.)
130:             * 
131:             * @param outputGroup the origin entry group that this process should save entries to
132:             * @param jobParameters the parameters used in the process
133:             * @param organizationReversionCounts a Map of named statistics generated by running the process
134:             * @see org.kuali.module.gl.service.OrganizationReversionProcessService#organizationReversionProcessEndOfYear(org.kuali.module.gl.bo.OriginEntryGroup, java.util.Map, java.util.Map)
135:             */
136:            public void organizationReversionProcessEndOfYear(
137:                    OriginEntryGroup outputGroup, Map jobParameters,
138:                    Map<String, Integer> organizationReversionCounts) {
139:                LOG.debug("organizationReversionProcessEndOfYear() started");
140:
141:                OrganizationReversionProcess orp = new OrganizationReversionProcess(
142:                        outputGroup, true, organizationReversionService,
143:                        balanceService, originEntryGroupService,
144:                        originEntryService, persistenceService,
145:                        dateTimeService,
146:                        cashOrganizationReversionCategoryLogic,
147:                        priorYearAccountService, orgReversionUnitOfWorkService,
148:                        jobParameters, organizationReversionCounts);
149:
150:                orp.organizationReversionProcess();
151:            }
152:
153:            /**
154:             * Organization Reversion Year End Process for the beginning of a fiscal year (ie, the process as it runs
155:             * after the fiscal year end, thus using prior year account, etc.)
156:             * 
157:             * @param outputGroup the origin entry group that this process should save entries to
158:             * @param jobParameters the parameters used in the process
159:             * @param organizationReversionCounts a Map of named statistics generated by running the process
160:             * @see org.kuali.module.gl.service.OrganizationReversionProcessService#organizationReversionProcessBeginningOfYear(org.kuali.module.gl.bo.OriginEntryGroup, java.util.Map, java.util.Map)
161:             */
162:            public void organizationReversionProcessBeginningOfYear(
163:                    OriginEntryGroup outputGroup, Map jobParameters,
164:                    Map<String, Integer> organizationReversionCounts) {
165:                LOG.debug("organizationReversionProcessEndOfYear() started");
166:
167:                OrganizationReversionProcess orp = new OrganizationReversionProcess(
168:                        outputGroup, false, organizationReversionService,
169:                        balanceService, originEntryGroupService,
170:                        originEntryService, persistenceService,
171:                        dateTimeService,
172:                        cashOrganizationReversionCategoryLogic,
173:                        priorYearAccountService, orgReversionUnitOfWorkService,
174:                        jobParameters, organizationReversionCounts);
175:
176:                orp.organizationReversionProcess();
177:            }
178:
179:            /**
180:             * Returns a Map with the properly initialized parameters for an organization reversion job that is about to run
181:             * @return a Map holding parameters for the job
182:             * @see org.kuali.module.gl.service.OrganizationReversionProcessService#getJobParameters()
183:             */
184:            public Map getJobParameters() {
185:                // Get job parameters
186:                Map jobParameters = new HashMap();
187:                String strTransactionDate = parameterService.getParameterValue(
188:                        ParameterConstants.GENERAL_LEDGER_BATCH.class,
189:                        GLConstants.ANNUAL_CLOSING_TRANSACTION_DATE_PARM);
190:                jobParameters
191:                        .put(
192:                                KFSConstants.UNALLOC_OBJECT_CD,
193:                                parameterService
194:                                        .getParameterValue(
195:                                                OrganizationReversion.class,
196:                                                GLConstants.OrganizationReversionProcess.UNALLOC_OBJECT_CODE_PARM));
197:                jobParameters
198:                        .put(
199:                                KFSConstants.BEG_BUD_CASH_OBJECT_CD,
200:                                parameterService
201:                                        .getParameterValue(
202:                                                OrganizationReversion.class,
203:                                                GLConstants.OrganizationReversionProcess.CARRY_FORWARD_OBJECT_CODE));
204:                jobParameters
205:                        .put(
206:                                KFSConstants.FUND_BAL_OBJECT_CD,
207:                                parameterService
208:                                        .getParameterValue(
209:                                                ParameterConstants.GENERAL_LEDGER_BATCH.class,
210:                                                GLConstants.ANNUAL_CLOSING_FUND_BALANCE_OBJECT_CODE_PARM));
211:                String strUniversityFiscalYear = parameterService
212:                        .getParameterValue(
213:                                ParameterConstants.GENERAL_LEDGER_BATCH.class,
214:                                GLConstants.ANNUAL_CLOSING_FISCAL_YEAR_PARM);
215:
216:                try {
217:                    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
218:                    java.util.Date jud = sdf.parse(strTransactionDate);
219:                    jobParameters.put(KFSConstants.TRANSACTION_DT,
220:                            new java.sql.Date(jud.getTime()));
221:                } catch (ParseException e) {
222:                    throw new IllegalArgumentException(
223:                            "TRANSACTION_DT is an invalid date");
224:                }
225:                try {
226:                    jobParameters.put(KFSConstants.UNIV_FISCAL_YR, new Integer(
227:                            strUniversityFiscalYear));
228:                } catch (NumberFormatException nfe) {
229:                    throw new IllegalArgumentException(
230:                            "UNIV_FISCAL_YR is an invalid year");
231:                }
232:                return jobParameters;
233:            }
234:
235:            /**
236:             * Generates the reports for the organization reversion process
237:             * @param outputGroup the origin entry group holding the origin entries created by the run
238:             * @param jobParameters the parameters used during the run
239:             * @param organizationReversionCounts the statistical counts generated by the run of the organization reversion process
240:             * @see org.kuali.module.gl.service.OrganizationReversionProcessService#generateOrganizationReversionProcessReports()
241:             */
242:            public void generateOrganizationReversionProcessReports(
243:                    OriginEntryGroup outputGroup, Map jobParameters,
244:                    Map<String, Integer> organizationReversionCounts) {
245:                // prepare statistics for report
246:                SimpleDateFormat reportDateFormat = new SimpleDateFormat(
247:                        DATE_FORMAT);
248:                jobParameters
249:                        .put(KFSConstants.TRANSACTION_DT, reportDateFormat
250:                                .format(jobParameters
251:                                        .get(KFSConstants.TRANSACTION_DT)));
252:
253:                Summary totalRecordCountSummary = new Summary();
254:                totalRecordCountSummary
255:                        .setSortOrder(Summary.TOTAL_RECORD_COUNT_SUMMARY_SORT_ORDER);
256:                totalRecordCountSummary
257:                        .setDescription("NUMBER OF GLBL RECORDS READ....:");
258:                totalRecordCountSummary.setCount(organizationReversionCounts
259:                        .get("balancesRead"));
260:
261:                Summary selectedRecordCountSummary = new Summary();
262:                selectedRecordCountSummary
263:                        .setSortOrder(Summary.SELECTED_RECORD_COUNT_SUMMARY_SORT_ORDER);
264:                selectedRecordCountSummary
265:                        .setDescription("NUMBER OF GLBL RECORDS SELECTED:");
266:                selectedRecordCountSummary.setCount(organizationReversionCounts
267:                        .get("balancesSelected"));
268:
269:                Summary sequenceRecordsWrittenSummary = new Summary();
270:                sequenceRecordsWrittenSummary
271:                        .setSortOrder(Summary.SEQUENCE_RECORDS_WRITTEN_SUMMARY_SORT_ORDER);
272:                sequenceRecordsWrittenSummary
273:                        .setDescription("NUMBER OF SEQ RECORDS WRITTEN..:");
274:                sequenceRecordsWrittenSummary
275:                        .setCount(organizationReversionCounts
276:                                .get("recordsWritten"));
277:
278:                List<Summary> summaries = new ArrayList<Summary>();
279:                summaries.add(totalRecordCountSummary);
280:                summaries.add(selectedRecordCountSummary);
281:                summaries.add(sequenceRecordsWrittenSummary);
282:
283:                Date runDate = new Date(dateTimeService.getCurrentDate()
284:                        .getTime());
285:                reportService.generateOrgReversionStatisticsReport(
286:                        jobParameters, summaries, runDate, outputGroup);
287:
288:            }
289:
290:            /**
291:             * Creates a properly initialized group for the organization reversion process to put origin entries in
292:             * @return OriginEntryGroup a properly initialized origin entry group
293:             * @see org.kuali.module.gl.service.OrganizationReversionProcessService#createOrganizationReversionProcessOriginEntryGroup()
294:             */
295:            public OriginEntryGroup createOrganizationReversionProcessOriginEntryGroup() {
296:                java.util.Date runDate = dateTimeService.getCurrentDate();
297:                // Create output group
298:                return originEntryGroupService.createGroup(new java.sql.Date(
299:                        runDate.getTime()),
300:                        OriginEntrySource.YEAR_END_ORG_REVERSION, true, false,
301:                        true);
302:            }
303:
304:            public void setParameterService(ParameterService parameterService) {
305:                this.parameterService = parameterService;
306:            }
307:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.