Source Code Cross Referenced for ProcurementCardDocument.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » financial » 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.financial.document 
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:
017:        package org.kuali.module.financial.document;
018:
019:        import java.util.ArrayList;
020:        import java.util.Iterator;
021:        import java.util.LinkedHashMap;
022:        import java.util.List;
023:
024:        import org.kuali.core.document.AmountTotaling;
025:        import org.kuali.core.document.Document;
026:        import org.kuali.core.service.DocumentService;
027:        import org.kuali.core.util.TypedArrayList;
028:        import org.kuali.kfs.KFSPropertyConstants;
029:        import org.kuali.kfs.bo.SourceAccountingLine;
030:        import org.kuali.kfs.bo.TargetAccountingLine;
031:        import org.kuali.kfs.context.SpringContext;
032:        import org.kuali.kfs.document.AccountingDocumentBase;
033:        import org.kuali.module.financial.bo.ProcurementCardHolder;
034:        import org.kuali.module.financial.bo.ProcurementCardSourceAccountingLine;
035:        import org.kuali.module.financial.bo.ProcurementCardTargetAccountingLine;
036:        import org.kuali.module.financial.bo.ProcurementCardTransactionDetail;
037:
038:        import edu.iu.uis.eden.EdenConstants;
039:        import edu.iu.uis.eden.clientapp.vo.DocumentRouteStatusChangeVO;
040:
041:        /**
042:         * This is the Procurement Card Document Class. The procurement cards distributes expenses from clearing accounts. It is a two-sided
043:         * document, but only target lines are displayed because source lines cannot be changed. Transaction, Card, and Vendor information
044:         * are associated with the document to help better distribute the expense.
045:         */
046:        public class ProcurementCardDocument extends AccountingDocumentBase
047:                implements  AmountTotaling {
048:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
049:                    .getLogger(ProcurementCardDocument.class);
050:
051:            private ProcurementCardHolder procurementCardHolder;
052:
053:            private List transactionEntries;
054:
055:            /**
056:             * Default constructor.
057:             */
058:            public ProcurementCardDocument() {
059:                super ();
060:                transactionEntries = new TypedArrayList(
061:                        ProcurementCardTransactionDetail.class);
062:            }
063:
064:            /**
065:             * @return Returns the transactionEntries.
066:             */
067:            public List getTransactionEntries() {
068:                return transactionEntries;
069:            }
070:
071:            /**
072:             * @param transactionEntries The transactionEntries to set.
073:             */
074:            public void setTransactionEntries(List transactionEntries) {
075:                this .transactionEntries = transactionEntries;
076:            }
077:
078:            /**
079:             * Gets the procurementCardHolder attribute.
080:             * 
081:             * @return Returns the procurementCardHolder.
082:             */
083:            public ProcurementCardHolder getProcurementCardHolder() {
084:                return procurementCardHolder;
085:            }
086:
087:            /**
088:             * Sets the procurementCardHolder attribute value.
089:             * 
090:             * @param procurementCardHolder The procurementCardHolder to set.
091:             */
092:            public void setProcurementCardHolder(
093:                    ProcurementCardHolder procurementCardHolder) {
094:                this .procurementCardHolder = procurementCardHolder;
095:            }
096:
097:            /**
098:             * Removes the target accounting line at the given index from the transaction detail entry.
099:             * 
100:             * @param index
101:             */
102:            public void removeTargetAccountingLine(int index) {
103:                ProcurementCardTargetAccountingLine line = (ProcurementCardTargetAccountingLine) getTargetAccountingLines()
104:                        .get(index);
105:
106:                for (Iterator iter = transactionEntries.iterator(); iter
107:                        .hasNext();) {
108:                    ProcurementCardTransactionDetail transactionEntry = (ProcurementCardTransactionDetail) iter
109:                            .next();
110:                    if (transactionEntry
111:                            .getFinancialDocumentTransactionLineNumber()
112:                            .equals(
113:                                    line
114:                                            .getFinancialDocumentTransactionLineNumber())) {
115:                        transactionEntry.getTargetAccountingLines()
116:                                .remove(line);
117:                    }
118:                }
119:            }
120:
121:            /**
122:             * Override to set the accounting line in the transaction detail object.
123:             * 
124:             * @see org.kuali.kfs.document.AccountingDocument#addSourceAccountingLine(SourceAccountingLine)
125:             */
126:            @Override
127:            public void addSourceAccountingLine(SourceAccountingLine sourceLine) {
128:                ProcurementCardSourceAccountingLine line = (ProcurementCardSourceAccountingLine) sourceLine;
129:
130:                line.setSequenceNumber(this .getNextSourceLineNumber());
131:
132:                for (Iterator iter = transactionEntries.iterator(); iter
133:                        .hasNext();) {
134:                    ProcurementCardTransactionDetail transactionEntry = (ProcurementCardTransactionDetail) iter
135:                            .next();
136:                    if (transactionEntry
137:                            .getFinancialDocumentTransactionLineNumber()
138:                            .equals(
139:                                    line
140:                                            .getFinancialDocumentTransactionLineNumber())) {
141:                        transactionEntry.getSourceAccountingLines().add(line);
142:                    }
143:                }
144:
145:                this .nextSourceLineNumber = new Integer(this 
146:                        .getNextSourceLineNumber().intValue() + 1);
147:            }
148:
149:            /**
150:             * Override to set the accounting line in the transaction detail object.
151:             * 
152:             * @see org.kuali.kfs.document.AccountingDocument#addTargetAccountingLine(TargetAccountingLine)
153:             */
154:            @Override
155:            public void addTargetAccountingLine(TargetAccountingLine targetLine) {
156:                ProcurementCardTargetAccountingLine line = (ProcurementCardTargetAccountingLine) targetLine;
157:
158:                line.setSequenceNumber(this .getNextTargetLineNumber());
159:
160:                for (Iterator iter = transactionEntries.iterator(); iter
161:                        .hasNext();) {
162:                    ProcurementCardTransactionDetail transactionEntry = (ProcurementCardTransactionDetail) iter
163:                            .next();
164:                    if (transactionEntry
165:                            .getFinancialDocumentTransactionLineNumber()
166:                            .equals(
167:                                    line
168:                                            .getFinancialDocumentTransactionLineNumber())) {
169:                        transactionEntry.getTargetAccountingLines().add(line);
170:                    }
171:                }
172:
173:                this .nextTargetLineNumber = new Integer(this 
174:                        .getNextTargetLineNumber().intValue() + 1);
175:            }
176:
177:            /**
178:             * Override to get source accounting lines out of transactions
179:             * 
180:             * @see org.kuali.kfs.document.AccountingDocument#getSourceAccountingLines()
181:             */
182:            @Override
183:            public List getSourceAccountingLines() {
184:                List sourceAccountingLines = new ArrayList();
185:
186:                for (Iterator iter = transactionEntries.iterator(); iter
187:                        .hasNext();) {
188:                    ProcurementCardTransactionDetail transactionEntry = (ProcurementCardTransactionDetail) iter
189:                            .next();
190:                    for (Iterator iterator = transactionEntry
191:                            .getSourceAccountingLines().iterator(); iterator
192:                            .hasNext();) {
193:                        SourceAccountingLine sourceLine = (SourceAccountingLine) iterator
194:                                .next();
195:                        sourceAccountingLines.add(sourceLine);
196:                    }
197:                }
198:
199:                return sourceAccountingLines;
200:            }
201:
202:            /**
203:             * Override to get target accounting lines out of transactions
204:             * 
205:             * @see org.kuali.kfs.document.AccountingDocument#getTargetAccountingLines()
206:             */
207:            @Override
208:            public List getTargetAccountingLines() {
209:                List targetAccountingLines = new ArrayList();
210:
211:                for (Iterator iter = transactionEntries.iterator(); iter
212:                        .hasNext();) {
213:                    ProcurementCardTransactionDetail transactionEntry = (ProcurementCardTransactionDetail) iter
214:                            .next();
215:                    for (Iterator iterator = transactionEntry
216:                            .getTargetAccountingLines().iterator(); iterator
217:                            .hasNext();) {
218:                        TargetAccountingLine targetLine = (TargetAccountingLine) iterator
219:                                .next();
220:                        targetAccountingLines.add(targetLine);
221:                    }
222:                }
223:
224:                return targetAccountingLines;
225:            }
226:
227:            /**
228:             * @see org.kuali.kfs.document.AccountingDocumentBase#getSourceAccountingLineClass()
229:             */
230:            @Override
231:            public Class getSourceAccountingLineClass() {
232:                return ProcurementCardSourceAccountingLine.class;
233:            }
234:
235:            /**
236:             * @see org.kuali.kfs.document.AccountingDocumentBase#getTargetAccountingLineClass()
237:             */
238:            @Override
239:            public Class getTargetAccountingLineClass() {
240:                return ProcurementCardTargetAccountingLine.class;
241:            }
242:
243:            /**
244:             * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
245:             */
246:            @Override
247:            protected LinkedHashMap toStringMapper() {
248:                LinkedHashMap m = new LinkedHashMap();
249:                m
250:                        .put(KFSPropertyConstants.DOCUMENT_NUMBER,
251:                                this .documentNumber);
252:                return m;
253:            }
254:
255:            @Override
256:            public void doRouteStatusChange(
257:                    DocumentRouteStatusChangeVO statusChangeEvent)
258:                    throws Exception {
259:                if (EdenConstants.ROUTE_HEADER_ENROUTE_CD
260:                        .equals(statusChangeEvent.getNewRouteStatus())) {
261:                    Document retrievedDocument = SpringContext.getBean(
262:                            DocumentService.class).getByDocumentHeaderId(
263:                            statusChangeEvent.getRouteHeaderId().toString());
264:                    if (EdenConstants.ROUTE_HEADER_ENROUTE_CD
265:                            .equals(retrievedDocument.getDocumentHeader()
266:                                    .getWorkflowDocument().getRouteHeader()
267:                                    .getDocRouteStatus())
268:                            && !EdenConstants.ROUTE_HEADER_ENROUTE_CD
269:                                    .equals(retrievedDocument
270:                                            .getDocumentHeader()
271:                                            .getFinancialDocumentStatusCode())) {
272:                        throw new RuntimeException(
273:                                "KFS document status is out of sync with Workflow document status");
274:                    }
275:                }
276:            }
277:
278:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.