Source Code Cross Referenced for LaborCorrectionDocument.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » labor » document » 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.document 
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.document;
017:
018:        import java.util.Iterator;
019:
020:        import org.kuali.core.document.AmountTotaling;
021:        import org.kuali.core.service.BusinessObjectService;
022:        import org.kuali.core.service.DateTimeService;
023:        import org.kuali.kfs.KFSConstants;
024:        import org.kuali.kfs.context.SpringContext;
025:        import org.kuali.module.gl.bo.OriginEntryGroup;
026:        import org.kuali.module.gl.bo.OriginEntrySource;
027:        import org.kuali.module.gl.document.CorrectionDocument;
028:        import org.kuali.module.gl.service.OriginEntryGroupService;
029:        import org.kuali.module.labor.bo.LaborOriginEntry;
030:        import org.kuali.module.labor.service.LaborCorrectionDocumentService;
031:        import org.kuali.module.labor.service.LaborOriginEntryService;
032:        import org.kuali.module.labor.service.LaborReportService;
033:        import org.kuali.module.labor.service.LaborScrubberService;
034:        import org.kuali.module.labor.util.ReportRegistry;
035:
036:        import edu.iu.uis.eden.clientapp.vo.DocumentRouteLevelChangeVO;
037:
038:        /**
039:         * labor Document class for the Labor Ledger Correction Process.
040:         */
041:        public class LaborCorrectionDocument extends CorrectionDocument
042:                implements  AmountTotaling {
043:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
044:                    .getLogger(LaborCorrectionDocument.class);
045:
046:            /**
047:             * Constructs a LaborCorrectionDocument.java.
048:             */
049:            public LaborCorrectionDocument() {
050:                super ();
051:            }
052:
053:            /**
054:             * Constant for the workgroup approval routing level
055:             */
056:            private static final Integer WORKGROUP_APPROVAL_ROUTE_LEVEL = new Integer(
057:                    1);
058:
059:            /**
060:             * @param change
061:             * @see org.kuali.core.document.DocumentBase#handleRouteLevelChange(edu.iu.uis.eden.clientapp.vo.DocumentRouteLevelChangeVO)
062:             */
063:            @Override
064:            public void handleRouteLevelChange(DocumentRouteLevelChangeVO change) {
065:
066:                if (WORKGROUP_APPROVAL_ROUTE_LEVEL.equals(change
067:                        .getNewRouteLevel())) {
068:                    String correctionType = getCorrectionTypeCode();
069:                    if (LaborCorrectionDocumentService.CORRECTION_TYPE_MANUAL
070:                            .equals(correctionType)
071:                            || LaborCorrectionDocumentService.CORRECTION_TYPE_CRITERIA
072:                                    .equals(correctionType)) {
073:                        String docId = getDocumentHeader().getDocumentNumber();
074:                        // this code is performed asynchronously
075:                        // First, save the origin entries to the origin entry table
076:                        DateTimeService dateTimeService = SpringContext
077:                                .getBean(DateTimeService.class);
078:                        LaborOriginEntryService laborOriginEntryService = SpringContext
079:                                .getBean(LaborOriginEntryService.class);
080:                        LaborCorrectionDocumentService laborCorrectionDocumentService = SpringContext
081:                                .getBean(LaborCorrectionDocumentService.class);
082:                        Iterator<LaborOriginEntry> outputEntries = laborCorrectionDocumentService
083:                                .retrievePersistedOutputOriginEntriesAsIterator(this );
084:                        // Create output group
085:                        java.sql.Date today = dateTimeService
086:                                .getCurrentSqlDate();
087:                        // Scrub is set to false when the document is initiated. When the document is final, it will be changed to true
088:                        OriginEntryGroup oeg = laborOriginEntryService
089:                                .copyEntries(
090:                                        today,
091:                                        OriginEntrySource.LABOR_CORRECTION_PROCESS_EDOC,
092:                                        true, false, true, outputEntries);
093:                        // Now, run the reports
094:                        LaborReportService reportService = SpringContext
095:                                .getBean(LaborReportService.class);
096:                        LaborScrubberService laborScrubberService = SpringContext
097:                                .getBean(LaborScrubberService.class);
098:                        setCorrectionOutputGroupId(oeg.getId());
099:                        // not using the document service to save because it touches workflow, just save the doc BO as a regular BO
100:                        SpringContext.getBean(BusinessObjectService.class)
101:                                .save(this );
102:                        LOG.debug("handleRouteStatusChange() Run reports");
103:                        String reportsDirectory = ReportRegistry
104:                                .getReportsDirectory();
105:                        reportService.generateCorrectionOnlineReport(this ,
106:                                reportsDirectory, today);
107:                        // Run the scrubber on this group to generate a bunch of reports. The scrubber won't save anything when running it
108:                        // this way.
109:                        laborScrubberService.scrubGroupReportOnly(oeg, docId);
110:                    }
111:                }
112:            }
113:
114:            /**
115:             * If the document final, change the process flag on the output origin entry group (if necessary)
116:             * 
117:             * @see org.kuali.core.document.DocumentBase#handleRouteStatusChange()
118:             */
119:            @Override
120:            public void handleRouteStatusChange() {
121:                LOG.debug("handleRouteStatusChange() started");
122:                if (getDocumentHeader().getWorkflowDocument().stateIsCanceled()) {
123:                    getDocumentHeader().setFinancialDocumentStatusCode(
124:                            KFSConstants.DocumentStatusCodes.CANCELLED);
125:                } else if (getDocumentHeader().getWorkflowDocument()
126:                        .stateIsEnroute()) {
127:                    getDocumentHeader().setFinancialDocumentStatusCode(
128:                            KFSConstants.DocumentStatusCodes.ENROUTE);
129:                }
130:                if (getDocumentHeader().getWorkflowDocument()
131:                        .stateIsDisapproved()) {
132:                    getDocumentHeader().setFinancialDocumentStatusCode(
133:                            KFSConstants.DocumentStatusCodes.DISAPPROVED);
134:                }
135:                if (getDocumentHeader().getWorkflowDocument()
136:                        .stateIsProcessed()) {
137:                    getDocumentHeader().setFinancialDocumentStatusCode(
138:                            KFSConstants.DocumentStatusCodes.APPROVED);
139:                }
140:
141:                LaborCorrectionDocumentService laborCorrectionDocumentService = SpringContext
142:                        .getBean(LaborCorrectionDocumentService.class);
143:                OriginEntryGroupService originEntryGroupService = SpringContext
144:                        .getBean(OriginEntryGroupService.class);
145:
146:                String docId = getDocumentHeader().getDocumentNumber();
147:                LaborCorrectionDocument doc = laborCorrectionDocumentService
148:                        .findByCorrectionDocumentHeaderId(docId);
149:
150:                if (getDocumentHeader().getWorkflowDocument().stateIsFinal()) {
151:                    String correctionType = doc.getCorrectionTypeCode();
152:                    if (LaborCorrectionDocumentService.CORRECTION_TYPE_REMOVE_GROUP_FROM_PROCESSING
153:                            .equals(correctionType)) {
154:                        SpringContext.getBean(OriginEntryGroupService.class)
155:                                .dontProcessGroup(
156:                                        doc.getCorrectionInputGroupId());
157:                    } else if (LaborCorrectionDocumentService.CORRECTION_TYPE_MANUAL
158:                            .equals(correctionType)
159:                            || LaborCorrectionDocumentService.CORRECTION_TYPE_CRITERIA
160:                                    .equals(correctionType)) {
161:                        OriginEntryGroup outputGroup = originEntryGroupService
162:                                .getExactMatchingEntryGroup(doc
163:                                        .getCorrectionOutputGroupId()
164:                                        .intValue());
165:                        if (!doc.getCorrectionFileDelete()) {
166:                            LOG
167:                                    .debug("handleRouteStatusChange() Mark group as to be processed");
168:                            outputGroup.setProcess(true);
169:                            originEntryGroupService.save(outputGroup);
170:                        }
171:                    } else {
172:                        LOG.error("GLCP doc " + doc.getDocumentNumber()
173:                                + " has an unknown correction type code: "
174:                                + correctionType);
175:                    }
176:                }
177:            }
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.