Source Code Cross Referenced for DocumentGroupData.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » util » 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.util 
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.gl.util;
017:
018:        import java.util.HashSet;
019:        import java.util.Iterator;
020:        import java.util.Set;
021:
022:        import org.apache.commons.lang.StringUtils;
023:        import org.kuali.module.gl.bo.CollectorDetail;
024:        import org.kuali.module.gl.bo.OriginEntryFull;
025:        import org.kuali.module.gl.bo.Transaction;
026:
027:        /**
028:         * This class represents document group-related data
029:         */
030:        public class DocumentGroupData {
031:            protected String documentNumber;
032:            protected String financialDocumentTypeCode;
033:            protected String financialSystemOriginationCode;
034:
035:            public DocumentGroupData(Transaction entry) {
036:                documentNumber = entry.getDocumentNumber();
037:                financialDocumentTypeCode = entry
038:                        .getFinancialDocumentTypeCode();
039:                financialSystemOriginationCode = entry
040:                        .getFinancialSystemOriginationCode();
041:            }
042:
043:            public DocumentGroupData(String documentNumber,
044:                    String financialDocumentTypeCode,
045:                    String financialSystemOriginationCode) {
046:                this .documentNumber = documentNumber;
047:                this .financialDocumentTypeCode = financialDocumentTypeCode;
048:                this .financialSystemOriginationCode = financialSystemOriginationCode;
049:            }
050:
051:            /**
052:             * Returns true if DocumentGroupData objects have the same document number, document type code, and financial system origination code
053:             * 
054:             * @see java.lang.Object#equals(java.lang.Object)
055:             */
056:            @Override
057:            public boolean equals(Object obj) {
058:                if (obj == null || !(obj instanceof  DocumentGroupData)) {
059:                    return false;
060:                }
061:                DocumentGroupData o2 = (DocumentGroupData) obj;
062:                return StringUtils.equals(documentNumber, o2.documentNumber)
063:                        && StringUtils.equals(financialDocumentTypeCode,
064:                                o2.financialDocumentTypeCode)
065:                        && StringUtils.equals(financialSystemOriginationCode,
066:                                o2.financialSystemOriginationCode);
067:            }
068:
069:            /**
070:             * Returns true if this document group data object's and the transaction have the same document number, document type code, and origination code match the passed 
071:             * 
072:             * @param transaction transaction to compare
073:             * @return true if this document group data object's and the transaction have the same document number, document type code, and origination code match the passed
074:             */
075:            public boolean matchesTransaction(Transaction transaction) {
076:                return StringUtils.equals(documentNumber, transaction
077:                        .getDocumentNumber())
078:                        && StringUtils.equals(financialDocumentTypeCode,
079:                                transaction.getFinancialDocumentTypeCode())
080:                        && StringUtils
081:                                .equals(
082:                                        financialSystemOriginationCode,
083:                                        transaction
084:                                                .getFinancialSystemOriginationCode());
085:            }
086:
087:            public boolean matchesCollectorDetail(CollectorDetail detail) {
088:                return StringUtils.equals(documentNumber, detail
089:                        .getDocumentNumber())
090:                        && StringUtils.equals(financialDocumentTypeCode, detail
091:                                .getFinancialDocumentTypeCode())
092:                        && StringUtils.equals(financialSystemOriginationCode,
093:                                detail.getFinancialSystemOriginationCode());
094:            }
095:
096:            /**
097:             * 
098:             * @see java.lang.Object#hashCode()
099:             */
100:            @Override
101:            public int hashCode() {
102:                // hash based on the doc #, because it's likely to have the most variation within an origin entry doc
103:                if (documentNumber == null) {
104:                    return "".hashCode();
105:                }
106:                return documentNumber.hashCode();
107:            }
108:
109:            /**
110:             * This returns an origin entry with document number, document type code, origination code set from this DocumentGroupData's document number, document type code, and origination code
111:             * 
112:             * @return populated origin entry  
113:             */
114:            public OriginEntryFull populateDocumentGroupDataFieldsInOriginEntry() {
115:                OriginEntryFull entry = new OriginEntryFull();
116:                entry.setDocumentNumber(documentNumber);
117:                entry.setFinancialDocumentTypeCode(financialDocumentTypeCode);
118:                entry
119:                        .setFinancialSystemOriginationCode(financialSystemOriginationCode);
120:                return entry;
121:            }
122:
123:            /**
124:             * Gets the documentNumber attribute.
125:             * 
126:             * @return Returns the documentNumber.
127:             */
128:            public String getDocumentNumber() {
129:                return documentNumber;
130:            }
131:
132:            /**
133:             * Sets the documentNumber attribute value.
134:             * 
135:             * @param documentNumber The documentNumber to set.
136:             */
137:            public void setDocumentNumber(String documentNumber) {
138:                this .documentNumber = documentNumber;
139:            }
140:
141:            /**
142:             * Gets the financialDocumentTypeCode attribute.
143:             * 
144:             * @return Returns the financialDocumentTypeCode.
145:             */
146:            public String getFinancialDocumentTypeCode() {
147:                return financialDocumentTypeCode;
148:            }
149:
150:            /**
151:             * Sets the financialDocumentTypeCode attribute value.
152:             * 
153:             * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
154:             */
155:            public void setFinancialDocumentTypeCode(
156:                    String financialDocumentTypeCode) {
157:                this .financialDocumentTypeCode = financialDocumentTypeCode;
158:            }
159:
160:            /**
161:             * Gets the financialSystemOriginationCode attribute.
162:             * 
163:             * @return Returns the financialSystemOriginationCode.
164:             */
165:            public String getFinancialSystemOriginationCode() {
166:                return financialSystemOriginationCode;
167:            }
168:
169:            /**
170:             * Sets the financialSystemOriginationCode attribute value.
171:             * 
172:             * @param financialSystemOriginationCode The financialSystemOriginationCode to set.
173:             */
174:            public void setFinancialSystemOriginationCode(
175:                    String financialSystemOriginationCode) {
176:                this .financialSystemOriginationCode = financialSystemOriginationCode;
177:            }
178:
179:            /**
180:             * Given an iterator of {@link Transaction} objects, return a set of all the document groups (doc #, doc type, origination code)
181:             * for these transactions
182:             * 
183:             * @param transactions iterator of transactions
184:             * @return Set of all of the document groups for this these trasnactions
185:             */
186:            public static <E extends Transaction> Set<DocumentGroupData> getDocumentGroupDatasForTransactions(
187:                    Iterator<E> transactions) {
188:                Set<DocumentGroupData> documentGroupDatas = new HashSet<DocumentGroupData>();
189:                while (transactions.hasNext()) {
190:                    Transaction transaction = transactions.next();
191:                    documentGroupDatas.add(new DocumentGroupData(transaction));
192:                }
193:                return documentGroupDatas;
194:            }
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.