Source Code Cross Referenced for Summary.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 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.util;
017:
018:        import java.util.ArrayList;
019:        import java.util.List;
020:
021:        import org.kuali.kfs.KFSConstants;
022:
023:        /**
024:         * This class represents a summary amount used in reporst
025:         */
026:        public class Summary implements  Comparable {
027:            /**
028:             * This number is used by TransactionReport when sorting the list of Summary objects passed to
029:             * TransactionReport.generateReport(). Lowest number prints first.
030:             */
031:            public static final int TOTAL_RECORD_COUNT_SUMMARY_SORT_ORDER = 1;
032:            public static final int SELECTED_RECORD_COUNT_SUMMARY_SORT_ORDER = 2;
033:            public static final int SEQUENCE_RECORDS_WRITTEN_SUMMARY_SORT_ORDER = 3;
034:            private int sortOrder;
035:
036:            /**
037:             * This is the description that prints for the summary line.
038:             */
039:            private String description;
040:
041:            /**
042:             * This is the count that displays. FIXME: Make this documentation a bit more clear.
043:             */
044:            private long count;
045:
046:            /**
047:             * 
048:             */
049:            public Summary() {
050:                super ();
051:            }
052:
053:            /**
054:             * Constructs a Summary.java.
055:             * @param sortOrder
056:             * @param description
057:             * @param count
058:             */
059:            public Summary(int sortOrder, String description, long count) {
060:                this .sortOrder = sortOrder;
061:                this .description = description;
062:                this .count = count;
063:            }
064:
065:            /**
066:             * Constructs a Summary.java.
067:             * @param sortOrder
068:             * @param description
069:             * @param count
070:             */
071:            public Summary(int sortOrder, String description, Integer count) {
072:                this .sortOrder = sortOrder;
073:                this .description = description;
074:                if (count == null) {
075:                    this .count = 0;
076:                } else {
077:                    this .count = count.longValue();
078:                }
079:            }
080:
081:            /**
082:             * Compare this Summary object with another summary object
083:             * 
084:             * (non-Javadoc)
085:             * 
086:             * @see java.lang.Comparable#compareTo(java.lang.Object)
087:             */
088:            public int compareTo(Object arg0) {
089:                if (arg0 instanceof  Summary) {
090:                    Summary otherObject = (Summary) arg0;
091:                    Integer otherSort = new Integer(otherObject.getSortOrder());
092:                    Integer this Sort = new Integer(sortOrder);
093:                    return this Sort.compareTo(otherSort);
094:                } else {
095:                    return 0;
096:                }
097:            }
098:
099:            /**
100:             * Returns true if the description of this summary object and the passed in summary object are the same
101:             * 
102:             * @see java.lang.Object#equals(java.lang.Object)
103:             */
104:            @Override
105:            public boolean equals(Object object) {
106:                if (this  == object)
107:                    return true;
108:                if (!(object instanceof  Summary))
109:                    return false;
110:
111:                Summary that = (Summary) object;
112:                return this .description.equals(that.getDescription());
113:            }
114:
115:            /**
116:             * Build a report summary list for labor general ledger posting
117:             * 
118:             * @param destination description of summary displayed
119:             * @param startingOrder order how information is displayed
120:             * @return a list of summary objects
121:             */
122:            public static List<Summary> buildDefualtReportSummary(
123:                    String destination, int startingOrder) {
124:                List<Summary> reportSummary = new ArrayList<Summary>();
125:                updateReportSummary(reportSummary, destination,
126:                        KFSConstants.OperationType.INSERT, 0, startingOrder++);
127:                updateReportSummary(reportSummary, destination,
128:                        KFSConstants.OperationType.UPDATE, 0, startingOrder++);
129:                updateReportSummary(reportSummary, destination,
130:                        KFSConstants.OperationType.DELETE, 0, startingOrder++);
131:                return reportSummary;
132:            }
133:
134:            /**
135:             * Update the report summary with the given information
136:             * 
137:             * @param reportSummary list of summaries
138:             * @param destinationName description of summary displayed
139:             * @param operationType description of what action is related to the summary (i.e. insert, updated, deleted)
140:             * @param count count of how many "objects" are affected
141:             * @param order order how information is displayed
142:             */
143:            public static void updateReportSummary(List<Summary> reportSummary,
144:                    String destinationName, String operationType, int count,
145:                    int order) {
146:                StringBuilder summaryDescription = buildSummaryDescription(
147:                        destinationName, operationType);
148:                updateReportSummary(reportSummary, summaryDescription
149:                        .toString(), count, order);
150:            }
151:
152:            /**
153:             * Update the report summary with the given information
154:             * 
155:             * @param reportSummary list of summaries
156:             * @param summaryDescription description of summary displayed
157:             * @param count count of how many "objects" are affected
158:             * @param order order how information is displayed
159:             */
160:            public static void updateReportSummary(List<Summary> reportSummary,
161:                    String summaryDescription, int count, int order) {
162:                Summary inputSummary = new Summary(order, summaryDescription,
163:                        count);
164:
165:                int index = reportSummary.indexOf(inputSummary);
166:                if (index >= 0) {
167:                    Summary summary = reportSummary.get(index);
168:                    summary.setCount(summary.getCount() + count);
169:                } else {
170:                    reportSummary.add(inputSummary);
171:                }
172:            }
173:
174:            /**
175:             * Build the description of summary with the given information
176:             * 
177:             * @param destinationName description of summary displayed
178:             * @param operationType description of what action is related to the summary (i.e. insert, updated, deleted)
179:             * @return
180:             */
181:            public static StringBuilder buildSummaryDescription(
182:                    String destinationName, String operationType) {
183:                StringBuilder summaryDescription = new StringBuilder();
184:                summaryDescription.append("Number of ").append(destinationName)
185:                        .append(" records ").append(operationType).append(":");
186:                return summaryDescription;
187:            }
188:
189:            public long getCount() {
190:                return count;
191:            }
192:
193:            public void setCount(long count) {
194:                this .count = count;
195:            }
196:
197:            public String getDescription() {
198:                return description;
199:            }
200:
201:            public void setDescription(String description) {
202:                this .description = description;
203:            }
204:
205:            public int getSortOrder() {
206:                return sortOrder;
207:            }
208:
209:            public void setSortOrder(int sortOrder) {
210:                this.sortOrder = sortOrder;
211:            }
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.