Source Code Cross Referenced for SufficientFundBalances.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » bo » 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.bo 
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.gl.bo;
018:
019:        import java.sql.Date;
020:        import java.text.NumberFormat;
021:        import java.text.ParseException;
022:        import java.text.SimpleDateFormat;
023:        import java.util.LinkedHashMap;
024:
025:        import org.kuali.core.bo.PersistableBusinessObjectBase;
026:        import org.kuali.core.util.KualiDecimal;
027:        import org.kuali.kfs.KFSPropertyConstants;
028:        import org.kuali.module.chart.bo.Account;
029:        import org.kuali.module.chart.bo.Chart;
030:        import org.kuali.module.chart.bo.ObjectCode;
031:        import org.kuali.module.gl.GLConstants;
032:
033:        /**
034:         * This class represents sufficient fund balances
035:         */
036:        public class SufficientFundBalances extends
037:                PersistableBusinessObjectBase {
038:
039:            private Integer universityFiscalYear;
040:            private String chartOfAccountsCode;
041:            private String accountNumber;
042:            private String financialObjectCode;
043:            private String accountSufficientFundsCode;
044:            private KualiDecimal currentBudgetBalanceAmount;
045:            private KualiDecimal accountActualExpenditureAmt;
046:            private KualiDecimal accountEncumbranceAmount;
047:            private Date transactionDateTimeStamp;
048:            private ObjectCode objectCode;
049:            private Chart chart;
050:            private Account account;
051:
052:            public static final String BLANKS = "                 ";
053:            public static final String DATE_FORMAT_STRING = "yyyy-MM-dd";
054:
055:            /**
056:             * Default constructor.
057:             */
058:            public SufficientFundBalances() {
059:
060:            }
061:
062:            /**
063:             * Constructs a SufficientFundBalances.java.
064:             * @param line
065:             */
066:            public SufficientFundBalances(String line) {
067:                setFromTextFile(line);
068:            }
069:
070:            /**
071:             * This method sets this object's attributes from the passed in line
072:             * 
073:             * @param line with sufficient fund balance related attributes
074:             */
075:            public void setFromTextFile(String line) {
076:
077:                // Just in case
078:                line = line + "                   ";
079:
080:                if (!GLConstants.getSpaceUniversityFiscalYear().equals(
081:                        line.substring(0, 4))) {
082:                    setUniversityFiscalYear(new Integer(line.substring(0, 4)));
083:                } else {
084:                    setUniversityFiscalYear(null);
085:                }
086:                setChartOfAccountsCode(line.substring(4, 6).trim());
087:                setAccountNumber(line.substring(6, 13).trim());
088:                setFinancialObjectCode(line.substring(13, 17).trim());
089:                setAccountSufficientFundsCode(line.substring(17, 24).trim());
090:                setCurrentBudgetBalanceAmount(new KualiDecimal(line.substring(
091:                        24, 41).trim()));
092:                setAccountActualExpenditureAmt(new KualiDecimal(line.substring(
093:                        41, 58).trim()));
094:                setAccountEncumbranceAmount(new KualiDecimal(line.substring(58,
095:                        75).trim()));
096:                setTransactionDateTimeStamp(parseDate(line.substring(75, 85),
097:                        true));
098:            }
099:
100:            /**
101:             * This method returns a string representing this sufficient fund balance object and its attributes
102:             * 
103:             * @return String representing this sufficient fund balance object and its attributes
104:             */
105:            public String getLine() {
106:                NumberFormat nf = NumberFormat.getInstance();
107:                nf.setMaximumFractionDigits(2);
108:                nf.setMinimumFractionDigits(0);
109:                nf.setMinimumIntegerDigits(1);
110:                nf.setGroupingUsed(false);
111:
112:                StringBuffer sb = new StringBuffer();
113:                if (universityFiscalYear == null) {
114:                    sb.append(GLConstants.getSpaceUniversityFiscalYear());
115:                } else {
116:                    sb.append(universityFiscalYear);
117:                }
118:                sb.append(getField(2, chartOfAccountsCode));
119:                sb.append(getField(7, accountNumber));
120:                sb.append(getField(4, financialObjectCode));
121:                sb.append(getField(1, accountSufficientFundsCode));
122:                if (currentBudgetBalanceAmount == null) {
123:                    sb.append(BLANKS);
124:                } else {
125:                    String a = nf.format(currentBudgetBalanceAmount
126:                            .doubleValue());
127:                    sb.append(BLANKS.substring(0, 17 - a.length()));
128:                    sb.append(a);
129:                }
130:                if (accountActualExpenditureAmt == null) {
131:                    sb.append(BLANKS);
132:                } else {
133:                    String a = nf.format(accountActualExpenditureAmt
134:                            .doubleValue());
135:                    sb.append(BLANKS.substring(0, 17 - a.length()));
136:                    sb.append(a);
137:                }
138:                if (accountEncumbranceAmount == null) {
139:                    sb.append(BLANKS);
140:                } else {
141:                    String a = nf
142:                            .format(accountEncumbranceAmount.doubleValue());
143:                    sb.append(BLANKS.substring(0, 17 - a.length()));
144:                    sb.append(a);
145:                }
146:                return sb.toString();
147:            }
148:
149:            private static String SPACES = "          ";
150:
151:            /**
152:             * Returns value passed in with additional spaces if need be 
153:             * 
154:             * @param size
155:             * @param value
156:             * @return
157:             */
158:            private String getField(int size, String value) {
159:                if (value == null) {
160:                    return SPACES.substring(0, size);
161:                } else {
162:                    if (value.length() < size) {
163:                        return value
164:                                + SPACES.substring(0, size - value.length());
165:                    } else {
166:                        return value;
167:                    }
168:                }
169:            }
170:
171:            /**
172:             * This method parses a date as yyyy-MM-dd
173:             * 
174:             * @param sdate
175:             * @param beLenientWithDates
176:             * @return
177:             */
178:            private java.sql.Date parseDate(String sdate,
179:                    boolean beLenientWithDates) {
180:                if ((sdate == null) || (sdate.trim().length() == 0)) {
181:                    return null;
182:                } else {
183:                    SimpleDateFormat sdf = new SimpleDateFormat(
184:                            DATE_FORMAT_STRING);
185:                    sdf.setLenient(beLenientWithDates);
186:
187:                    try {
188:                        java.util.Date d = sdf.parse(sdate);
189:                        return new Date(d.getTime());
190:                    } catch (ParseException e) {
191:                        return null;
192:                    }
193:                }
194:            }
195:
196:            /**
197:             * This method returns a string representation of date as yyyy-MM-dd 
198:             * 
199:             * @param date
200:             * @return
201:             */
202:            private String formatDate(Date date) {
203:                if (date == null) {
204:                    return "          ";
205:                } else {
206:                    SimpleDateFormat sdf = new SimpleDateFormat(
207:                            DATE_FORMAT_STRING);
208:                    return sdf.format(date);
209:                }
210:            }
211:
212:            /**
213:             * Gets the universityFiscalYear attribute.
214:             * 
215:             * @return Returns the universityFiscalYear
216:             */
217:            public Integer getUniversityFiscalYear() {
218:                return universityFiscalYear;
219:            }
220:
221:            /**
222:             * Sets the universityFiscalYear attribute.
223:             * 
224:             * @param universityFiscalYear The universityFiscalYear to set.
225:             */
226:            public void setUniversityFiscalYear(Integer universityFiscalYear) {
227:                this .universityFiscalYear = universityFiscalYear;
228:            }
229:
230:            /**
231:             * Gets the chartOfAccountsCode attribute.
232:             * 
233:             * @return Returns the chartOfAccountsCode
234:             */
235:            public String getChartOfAccountsCode() {
236:                return chartOfAccountsCode;
237:            }
238:
239:            /**
240:             * Sets the chartOfAccountsCode attribute.
241:             * 
242:             * @param chartOfAccountsCode The chartOfAccountsCode to set.
243:             */
244:            public void setChartOfAccountsCode(String chartOfAccountsCode) {
245:                this .chartOfAccountsCode = chartOfAccountsCode;
246:            }
247:
248:            /**
249:             * Gets the accountNumber attribute.
250:             * 
251:             * @return Returns the accountNumber
252:             */
253:            public String getAccountNumber() {
254:                return accountNumber;
255:            }
256:
257:            /**
258:             * Sets the accountNumber attribute.
259:             * 
260:             * @param accountNumber The accountNumber to set.
261:             */
262:            public void setAccountNumber(String accountNumber) {
263:                this .accountNumber = accountNumber;
264:            }
265:
266:            /**
267:             * Gets the financialObjectCode attribute.
268:             * 
269:             * @return Returns the financialObjectCode
270:             */
271:            public String getFinancialObjectCode() {
272:                return financialObjectCode;
273:            }
274:
275:            /**
276:             * Sets the financialObjectCode attribute.
277:             * 
278:             * @param financialObjectCode The financialObjectCode to set.
279:             */
280:            public void setFinancialObjectCode(String financialObjectCode) {
281:                this .financialObjectCode = financialObjectCode;
282:            }
283:
284:            /**
285:             * Gets the accountSufficientFundsCode attribute.
286:             * 
287:             * @return Returns the accountSufficientFundsCode
288:             */
289:            public String getAccountSufficientFundsCode() {
290:                return accountSufficientFundsCode;
291:            }
292:
293:            /**
294:             * Sets the accountSufficientFundsCode attribute.
295:             * 
296:             * @param accountSufficientFundsCode The accountSufficientFundsCode to set.
297:             */
298:            public void setAccountSufficientFundsCode(
299:                    String accountSufficientFundsCode) {
300:                this .accountSufficientFundsCode = accountSufficientFundsCode;
301:            }
302:
303:            /**
304:             * Gets the currentBudgetBalanceAmount attribute.
305:             * 
306:             * @return Returns the currentBudgetBalanceAmount
307:             */
308:            public KualiDecimal getCurrentBudgetBalanceAmount() {
309:                return currentBudgetBalanceAmount;
310:            }
311:
312:            /**
313:             * Sets the currentBudgetBalanceAmount attribute.
314:             * 
315:             * @param currentBudgetBalanceAmount The currentBudgetBalanceAmount to set.
316:             */
317:            public void setCurrentBudgetBalanceAmount(
318:                    KualiDecimal currentBudgetBalanceAmount) {
319:                this .currentBudgetBalanceAmount = currentBudgetBalanceAmount;
320:            }
321:
322:            /**
323:             * Gets the accountActualExpenditureAmt attribute.
324:             * 
325:             * @return Returns the accountActualExpenditureAmt
326:             */
327:            public KualiDecimal getAccountActualExpenditureAmt() {
328:                return accountActualExpenditureAmt;
329:            }
330:
331:            /**
332:             * Sets the accountActualExpenditureAmt attribute.
333:             * 
334:             * @param accountActualExpenditureAmt The accountActualExpenditureAmt to set.
335:             */
336:            public void setAccountActualExpenditureAmt(
337:                    KualiDecimal accountActualExpenditureAmt) {
338:                this .accountActualExpenditureAmt = accountActualExpenditureAmt;
339:            }
340:
341:            /**
342:             * Gets the accountEncumbranceAmount attribute.
343:             * 
344:             * @return Returns the accountEncumbranceAmount
345:             */
346:            public KualiDecimal getAccountEncumbranceAmount() {
347:                return accountEncumbranceAmount;
348:            }
349:
350:            /**
351:             * Sets the accountEncumbranceAmount attribute.
352:             * 
353:             * @param accountEncumbranceAmount The accountEncumbranceAmount to set.
354:             */
355:            public void setAccountEncumbranceAmount(
356:                    KualiDecimal accountEncumbranceAmount) {
357:                this .accountEncumbranceAmount = accountEncumbranceAmount;
358:            }
359:
360:            /**
361:             * Gets the transactionDateTimeStamp attribute.
362:             * 
363:             * @return Returns the transactionDateTimeStamp
364:             */
365:            public Date getTransactionDateTimeStamp() {
366:                return transactionDateTimeStamp;
367:            }
368:
369:            /**
370:             * Sets the transactionDateTimeStamp attribute.
371:             * 
372:             * @param transactionDateTimeStamp The transactionDateTimeStamp to set.
373:             */
374:            public void setTransactionDateTimeStamp(
375:                    Date transactionDateTimeStamp) {
376:                this .transactionDateTimeStamp = transactionDateTimeStamp;
377:            }
378:
379:            /**
380:             * Gets the objectCode attribute.
381:             * 
382:             * @return Returns the objectCode
383:             */
384:            public ObjectCode getObjectCode() {
385:                return objectCode;
386:            }
387:
388:            /**
389:             * Sets the objectCode attribute.
390:             * 
391:             * @param objectCode The objectCode to set.
392:             * @deprecated
393:             */
394:            public void setObjectCode(ObjectCode objectCode) {
395:                this .objectCode = objectCode;
396:            }
397:
398:            /**
399:             * Gets the chart attribute.
400:             * 
401:             * @return Returns the chart
402:             */
403:            public Chart getChart() {
404:                return chart;
405:            }
406:
407:            /**
408:             * Sets the chart attribute.
409:             * 
410:             * @param chart The chart to set.
411:             * @deprecated
412:             */
413:            public void setChart(Chart chart) {
414:                this .chart = chart;
415:            }
416:
417:            /**
418:             * Gets the account attribute.
419:             * 
420:             * @return Returns the account
421:             */
422:            public Account getAccount() {
423:                return account;
424:            }
425:
426:            /**
427:             * Sets the account attribute.
428:             * 
429:             * @param account The account to set.
430:             * @deprecated
431:             */
432:            public void setAccount(Account account) {
433:                this .account = account;
434:            }
435:
436:            /**
437:             * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
438:             */
439:            protected LinkedHashMap toStringMapper() {
440:                LinkedHashMap m = new LinkedHashMap();
441:                m.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR,
442:                        this.universityFiscalYear.toString());
443:                m.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE,
444:                        this.chartOfAccountsCode);
445:                m.put(KFSPropertyConstants.ACCOUNT_NUMBER, this.accountNumber);
446:                m.put(KFSPropertyConstants.FINANCIAL_OBJECT_CODE,
447:                        this.financialObjectCode);
448:                return m;
449:            }
450:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.