Source Code Cross Referenced for LaborJournalVoucherDocument.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.ArrayList;
019:        import java.util.List;
020:
021:        import org.kuali.core.bo.DocumentType;
022:        import org.kuali.core.document.AmountTotaling;
023:        import org.kuali.core.exceptions.ValidationException;
024:        import org.kuali.core.rule.event.KualiDocumentEvent;
025:        import org.kuali.kfs.KFSConstants;
026:        import org.kuali.kfs.bo.AccountingLineParser;
027:        import org.kuali.kfs.context.SpringContext;
028:        import org.kuali.module.financial.document.JournalVoucherDocument;
029:        import org.kuali.module.labor.LaborConstants.JournalVoucherOffsetType;
030:        import org.kuali.module.labor.bo.LaborJournalVoucherAccountingLineParser;
031:        import org.kuali.module.labor.bo.LaborJournalVoucherDetail;
032:        import org.kuali.module.labor.bo.LaborLedgerPendingEntry;
033:        import org.kuali.module.labor.service.LaborLedgerPendingEntryService;
034:
035:        // @latex.ClassSignatureStart
036:        /**
037:         * Labor Document class for the Labor Ledger Journal Voucher.
038:         */
039:        public class LaborJournalVoucherDocument extends JournalVoucherDocument
040:                implements  LaborLedgerPostingDocument, AmountTotaling {
041:            // @latex.ClassSignatureStop
042:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
043:                    .getLogger(LaborJournalVoucherDocument.class);
044:            private String offsetTypeCode = JournalVoucherOffsetType.NO_OFFSET.typeCode;
045:            private List<LaborLedgerPendingEntry> laborLedgerPendingEntries;
046:            private DocumentType documentType;
047:
048:            /**
049:             * Constructs a LaborJournalVoucherDocument.java.
050:             */
051:            public LaborJournalVoucherDocument() {
052:                super ();
053:                setLaborLedgerPendingEntries(new ArrayList<LaborLedgerPendingEntry>());
054:            }
055:
056:            /**
057:             * @see org.kuali.kfs.document.AccountingDocumentBase#getSourceAccountingLineClass()
058:             */
059:            @Override
060:            public Class getSourceAccountingLineClass() {
061:                return LaborJournalVoucherDetail.class;
062:            }
063:
064:            /**
065:             * @see org.kuali.module.labor.document.LaborLedgerPostingDocument#getLaborLedgerPendingEntry(int)
066:             */
067:            public LaborLedgerPendingEntry getLaborLedgerPendingEntry(int index) {
068:                while (laborLedgerPendingEntries.size() <= index) {
069:                    laborLedgerPendingEntries
070:                            .add(new LaborLedgerPendingEntry());
071:                }
072:                return laborLedgerPendingEntries.get(index);
073:            }
074:
075:            /**
076:             * @see org.kuali.kfs.document.AccountingDocumentBase#prepareForSave(org.kuali.core.rule.event.KualiDocumentEvent)
077:             */
078:            @Override
079:            public void prepareForSave(KualiDocumentEvent event) {
080:                super .prepareForSave(event);
081:                if (!SpringContext
082:                        .getBean(LaborLedgerPendingEntryService.class)
083:                        .generateLaborLedgerPendingEntries(this )) {
084:                    logErrors();
085:                    throw new ValidationException(
086:                            "labor ledger LLPE generation failed");
087:                }
088:            }
089:
090:            /**
091:             * Gets the offsetTypeCode attribute.
092:             * 
093:             * @return Returns the offsetTypeCode.
094:             */
095:            public String getOffsetTypeCode() {
096:                return offsetTypeCode;
097:            }
098:
099:            /**
100:             * Sets the offsetTypeCode attribute value.
101:             * 
102:             * @param offsetTypeCode The offsetTypeCode to set.
103:             */
104:            public void setOffsetTypeCode(String offsetTypeCode) {
105:                this .offsetTypeCode = offsetTypeCode;
106:            }
107:
108:            /**
109:             * Gets the laborLedgerPendingEntries attribute.
110:             * 
111:             * @return Returns the laborLedgerPendingEntries.
112:             */
113:            public List<LaborLedgerPendingEntry> getLaborLedgerPendingEntries() {
114:                return laborLedgerPendingEntries;
115:            }
116:
117:            /**
118:             * Sets the laborLedgerPendingEntries attribute value.
119:             * 
120:             * @param laborLedgerPendingEntries The laborLedgerPendingEntries to set.
121:             */
122:            public void setLaborLedgerPendingEntries(
123:                    List<LaborLedgerPendingEntry> laborLedgerPendingEntries) {
124:                this .laborLedgerPendingEntries = laborLedgerPendingEntries;
125:            }
126:
127:            /**
128:             * Gets the documentType attribute.
129:             * 
130:             * @return Returns the documentType.
131:             */
132:            public DocumentType getDocumentType() {
133:                return documentType;
134:            }
135:
136:            /**
137:             * Sets the documentType attribute value.
138:             * 
139:             * @param documentType The documentType to set.
140:             */
141:            public void setDocumentType(DocumentType documentType) {
142:                this .documentType = documentType;
143:            }
144:
145:            /**
146:             * Used to get the appropriate <code>{@link AccountingLineParser}</code> for the <code>Document</code>
147:             * 
148:             * @return AccountingLineParser
149:             */
150:            @Override
151:            public AccountingLineParser getAccountingLineParser() {
152:                return new LaborJournalVoucherAccountingLineParser(
153:                        getBalanceTypeCode());
154:            }
155:
156:            /**
157:             * Override to call super and then iterate over all GLPEs and update the approved code appropriately.
158:             * 
159:             * @see Document#handleRouteStatusChange()
160:             */
161:            @Override
162:            public void handleRouteStatusChange() {
163:                super .handleRouteStatusChange();
164:                if (getDocumentHeader().getWorkflowDocument()
165:                        .stateIsProcessed()) {
166:                    changeLedgerPendingEntriesApprovedStatusCode();
167:                } else if (getDocumentHeader().getWorkflowDocument()
168:                        .stateIsCanceled()
169:                        || getDocumentHeader().getWorkflowDocument()
170:                                .stateIsDisapproved()) {
171:                    removeLedgerPendingEntries();
172:                }
173:            }
174:
175:            /**
176:             * This method iterates over all of the pending entries for a document and sets their approved status code to APPROVED "A".
177:             */
178:            private void changeLedgerPendingEntriesApprovedStatusCode() {
179:                for (LaborLedgerPendingEntry pendingEntry : laborLedgerPendingEntries) {
180:                    pendingEntry
181:                            .setFinancialDocumentApprovedCode(KFSConstants.DocumentStatusCodes.APPROVED);
182:                }
183:            }
184:
185:            /**
186:             * This method calls the service to remove all of the pending entries associated with this document
187:             */
188:            private void removeLedgerPendingEntries() {
189:                LaborLedgerPendingEntryService laborLedgerPendingEntryService = SpringContext
190:                        .getBean(LaborLedgerPendingEntryService.class);
191:                laborLedgerPendingEntryService.delete(getDocumentHeader()
192:                        .getDocumentNumber());
193:            }
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.