Source Code Cross Referenced for BudgetAdjustmentDocument.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.Copyable;
026:        import org.kuali.core.document.Correctable;
027:        import org.kuali.core.util.GeneralLedgerPendingEntrySequenceHelper;
028:        import org.kuali.core.util.KualiDecimal;
029:        import org.kuali.core.util.KualiInteger;
030:        import org.kuali.core.util.ObjectUtils;
031:        import org.kuali.core.web.format.CurrencyFormatter;
032:        import org.kuali.kfs.KFSConstants;
033:        import org.kuali.kfs.KFSPropertyConstants;
034:        import org.kuali.kfs.bo.AccountingLineParser;
035:        import org.kuali.kfs.bo.GeneralLedgerPendingEntry;
036:        import org.kuali.kfs.context.SpringContext;
037:        import org.kuali.kfs.document.AccountingDocumentBase;
038:        import org.kuali.kfs.rules.AccountingDocumentRuleUtil;
039:        import org.kuali.module.financial.bo.BudgetAdjustmentAccountingLine;
040:        import org.kuali.module.financial.bo.BudgetAdjustmentAccountingLineParser;
041:        import org.kuali.module.financial.bo.BudgetAdjustmentSourceAccountingLine;
042:        import org.kuali.module.financial.bo.BudgetAdjustmentTargetAccountingLine;
043:        import org.kuali.module.financial.bo.FiscalYearFunctionControl;
044:        import org.kuali.module.financial.rules.BudgetAdjustmentDocumentRule;
045:        import org.kuali.module.financial.service.FiscalYearFunctionControlService;
046:        import org.kuali.module.financial.service.UniversityDateService;
047:
048:        import edu.iu.uis.eden.exception.WorkflowException;
049:
050:        /**
051:         * This is the business object that represents the BudgetAdjustment document in Kuali.
052:         */
053:        public class BudgetAdjustmentDocument extends AccountingDocumentBase
054:                implements  Copyable, Correctable, AmountTotaling {
055:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
056:                    .getLogger(BudgetAdjustmentDocument.class);
057:
058:            private Integer nextPositionSourceLineNumber;
059:            private Integer nextPositionTargetLineNumber;
060:
061:            /**
062:             * Default constructor.
063:             */
064:            public BudgetAdjustmentDocument() {
065:                super ();
066:            }
067:
068:            /*******************************************************************************************************************************
069:             * BA Documents should only do SF checking on PLEs with a Balance Type of 'CB' - not 'BB' or 'MB'.
070:             * 
071:             * @Override
072:             * @see org.kuali.kfs.document.AccountingDocumentBase#getPendingLedgerEntriesForSufficientFundsChecking()
073:             */
074:            public List<GeneralLedgerPendingEntry> getPendingLedgerEntriesForSufficientFundsChecking() {
075:                List<GeneralLedgerPendingEntry> pendingLedgerEntries = new ArrayList();
076:
077:                GeneralLedgerPendingEntrySequenceHelper glpeSequenceHelper = new GeneralLedgerPendingEntrySequenceHelper();
078:                BudgetAdjustmentDocumentRule budgetAdjustmentDocumentRule = new BudgetAdjustmentDocumentRule();
079:
080:                BudgetAdjustmentDocument copiedBa = (BudgetAdjustmentDocument) ObjectUtils
081:                        .deepCopy(this );
082:                copiedBa.getGeneralLedgerPendingEntries().clear();
083:                for (BudgetAdjustmentAccountingLine fromLine : (List<BudgetAdjustmentAccountingLine>) copiedBa
084:                        .getSourceAccountingLines()) {
085:                    budgetAdjustmentDocumentRule
086:                            .processGenerateGeneralLedgerPendingEntries(
087:                                    copiedBa, fromLine, glpeSequenceHelper);
088:                }
089:
090:                for (GeneralLedgerPendingEntry ple : copiedBa
091:                        .getGeneralLedgerPendingEntries()) {
092:                    if (!KFSConstants.BALANCE_TYPE_BASE_BUDGET.equals(ple
093:                            .getFinancialBalanceTypeCode())
094:                            && !KFSConstants.BALANCE_TYPE_MONTHLY_BUDGET
095:                                    .equals(ple.getFinancialBalanceTypeCode())) {
096:                        pendingLedgerEntries.add(ple);
097:                    }
098:                }
099:                return pendingLedgerEntries;
100:            }
101:
102:            /**
103:             * @see org.kuali.kfs.document.AccountingDocumentBase#getSourceAccountingLineClass()
104:             */
105:            @Override
106:            public Class getSourceAccountingLineClass() {
107:                return BudgetAdjustmentSourceAccountingLine.class;
108:            }
109:
110:            /**
111:             * @see org.kuali.kfs.document.AccountingDocumentBase#getTargetAccountingLineClass()
112:             */
113:            @Override
114:            public Class getTargetAccountingLineClass() {
115:                return BudgetAdjustmentTargetAccountingLine.class;
116:            }
117:
118:            /**
119:             * generic, shared logic used to iniate a ba document
120:             */
121:            public void initiateDocument() {
122:                // setting default posting year. Trying to set currentYear first if it's allowed, if it isn't,
123:                // just set first allowed year. Note: allowedYears will never be empty because then
124:                // BudgetAdjustmentDocumentAuthorizer.canInitiate would have failed.
125:                List allowedYears = SpringContext.getBean(
126:                        FiscalYearFunctionControlService.class)
127:                        .getBudgetAdjustmentAllowedYears();
128:                Integer currentYearParam = SpringContext.getBean(
129:                        UniversityDateService.class).getCurrentFiscalYear();
130:
131:                FiscalYearFunctionControl fiscalYearFunctionControl = new FiscalYearFunctionControl();
132:                fiscalYearFunctionControl
133:                        .setUniversityFiscalYear(currentYearParam);
134:
135:                // use 'this.postingYear =' because setPostingYear has logic we want to circumvent on initiateDocument
136:                if (allowedYears.contains(fiscalYearFunctionControl)) {
137:                    this .postingYear = currentYearParam;
138:                } else {
139:                    this .postingYear = ((FiscalYearFunctionControl) allowedYears
140:                            .get(0)).getUniversityFiscalYear();
141:                }
142:            }
143:
144:            /**
145:             * @return Integer
146:             */
147:            public Integer getNextPositionSourceLineNumber() {
148:                return nextPositionSourceLineNumber;
149:            }
150:
151:            /**
152:             * @param nextPositionSourceLineNumber
153:             */
154:            public void setNextPositionSourceLineNumber(
155:                    Integer nextPositionSourceLineNumber) {
156:                this .nextPositionSourceLineNumber = nextPositionSourceLineNumber;
157:            }
158:
159:            /**
160:             * @return Integer
161:             */
162:            public Integer getNextPositionTargetLineNumber() {
163:                return nextPositionTargetLineNumber;
164:            }
165:
166:            /**
167:             * @param nextPositionTargetLineNumber
168:             */
169:            public void setNextPositionTargetLineNumber(
170:                    Integer nextPositionTargetLineNumber) {
171:                this .nextPositionTargetLineNumber = nextPositionTargetLineNumber;
172:            }
173:
174:            /**
175:             * Returns the total current budget amount from the source lines.
176:             * 
177:             * @return KualiDecimal
178:             */
179:            public KualiDecimal getSourceCurrentBudgetTotal() {
180:                KualiDecimal currentBudgetTotal = new KualiDecimal(0);
181:
182:                for (Iterator iter = sourceAccountingLines.iterator(); iter
183:                        .hasNext();) {
184:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
185:                            .next();
186:                    currentBudgetTotal = currentBudgetTotal.add(line
187:                            .getCurrentBudgetAdjustmentAmount());
188:                }
189:
190:                return currentBudgetTotal;
191:            }
192:
193:            /**
194:             * This method retrieves the total current budget amount formatted as currency.
195:             * 
196:             * @return String
197:             */
198:            public String getCurrencyFormattedSourceCurrentBudgetTotal() {
199:                return (String) new CurrencyFormatter()
200:                        .format(getSourceCurrentBudgetTotal());
201:            }
202:
203:            /**
204:             * Returns the total current budget income amount from the source lines.
205:             * 
206:             * @return KualiDecimal
207:             */
208:            public KualiDecimal getSourceCurrentBudgetIncomeTotal() {
209:                KualiDecimal total = new KualiDecimal(0);
210:
211:                for (Iterator iter = sourceAccountingLines.iterator(); iter
212:                        .hasNext();) {
213:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
214:                            .next();
215:                    if (AccountingDocumentRuleUtil.isIncome(line)) {
216:                        total = total.add(line
217:                                .getCurrentBudgetAdjustmentAmount());
218:                    }
219:                }
220:
221:                return total;
222:            }
223:
224:            /**
225:             * Returns the total current budget expense amount from the source lines.
226:             * 
227:             * @return KualiDecimal
228:             */
229:            public KualiDecimal getSourceCurrentBudgetExpenseTotal() {
230:                KualiDecimal total = new KualiDecimal(0);
231:
232:                for (Iterator iter = sourceAccountingLines.iterator(); iter
233:                        .hasNext();) {
234:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
235:                            .next();
236:                    if (AccountingDocumentRuleUtil.isExpense(line)) {
237:                        total = total.add(line
238:                                .getCurrentBudgetAdjustmentAmount());
239:                    }
240:                }
241:
242:                return total;
243:            }
244:
245:            /**
246:             * Returns the total current budget amount from the target lines.
247:             * 
248:             * @return KualiDecimal
249:             */
250:            public KualiDecimal getTargetCurrentBudgetTotal() {
251:                KualiDecimal currentBudgetTotal = new KualiDecimal(0);
252:
253:                for (Iterator iter = targetAccountingLines.iterator(); iter
254:                        .hasNext();) {
255:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
256:                            .next();
257:                    currentBudgetTotal = currentBudgetTotal.add(line
258:                            .getCurrentBudgetAdjustmentAmount());
259:                }
260:
261:                return currentBudgetTotal;
262:            }
263:
264:            /**
265:             * This method retrieves the total current budget amount formatted as currency.
266:             * 
267:             * @return String
268:             */
269:            public String getCurrencyFormattedTargetCurrentBudgetTotal() {
270:                return (String) new CurrencyFormatter()
271:                        .format(getTargetCurrentBudgetTotal());
272:            }
273:
274:            /**
275:             * Returns the total current budget income amount from the target lines.
276:             * 
277:             * @return KualiDecimal
278:             */
279:            public KualiDecimal getTargetCurrentBudgetIncomeTotal() {
280:                KualiDecimal total = new KualiDecimal(0);
281:
282:                for (Iterator iter = targetAccountingLines.iterator(); iter
283:                        .hasNext();) {
284:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
285:                            .next();
286:                    if (AccountingDocumentRuleUtil.isIncome(line)) {
287:                        total = total.add(line
288:                                .getCurrentBudgetAdjustmentAmount());
289:                    }
290:                }
291:
292:                return total;
293:            }
294:
295:            /**
296:             * Returns the total current budget expense amount from the target lines.
297:             * 
298:             * @return KualiDecimal
299:             */
300:            public KualiDecimal getTargetCurrentBudgetExpenseTotal() {
301:                KualiDecimal total = new KualiDecimal(0);
302:
303:                for (Iterator iter = targetAccountingLines.iterator(); iter
304:                        .hasNext();) {
305:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
306:                            .next();
307:                    if (AccountingDocumentRuleUtil.isExpense(line)) {
308:                        total = total.add(line
309:                                .getCurrentBudgetAdjustmentAmount());
310:                    }
311:                }
312:
313:                return total;
314:            }
315:
316:            /**
317:             * Returns the total base budget amount from the source lines.
318:             * 
319:             * @return KualiDecimal
320:             */
321:            public KualiInteger getSourceBaseBudgetTotal() {
322:                KualiInteger baseBudgetTotal = new KualiInteger(0);
323:
324:                for (Iterator iter = sourceAccountingLines.iterator(); iter
325:                        .hasNext();) {
326:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
327:                            .next();
328:                    baseBudgetTotal = baseBudgetTotal.add(line
329:                            .getBaseBudgetAdjustmentAmount());
330:                }
331:
332:                return baseBudgetTotal;
333:            }
334:
335:            /**
336:             * This method retrieves the total base budget amount formatted as currency.
337:             * 
338:             * @return String
339:             */
340:            public String getCurrencyFormattedSourceBaseBudgetTotal() {
341:                return (String) new CurrencyFormatter()
342:                        .format(getSourceBaseBudgetTotal());
343:            }
344:
345:            /**
346:             * Returns the total base budget income amount from the source lines.
347:             * 
348:             * @return KualiDecimal
349:             */
350:            public KualiInteger getSourceBaseBudgetIncomeTotal() {
351:                KualiInteger total = new KualiInteger(0);
352:
353:                for (Iterator iter = sourceAccountingLines.iterator(); iter
354:                        .hasNext();) {
355:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
356:                            .next();
357:                    if (AccountingDocumentRuleUtil.isIncome(line)) {
358:                        total = total.add(line.getBaseBudgetAdjustmentAmount());
359:                    }
360:                }
361:
362:                return total;
363:            }
364:
365:            /**
366:             * Returns the total base budget expense amount from the source lines.
367:             * 
368:             * @return KualiDecimal
369:             */
370:            public KualiInteger getSourceBaseBudgetExpenseTotal() {
371:                KualiInteger total = new KualiInteger(0);
372:
373:                for (Iterator iter = sourceAccountingLines.iterator(); iter
374:                        .hasNext();) {
375:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
376:                            .next();
377:                    if (AccountingDocumentRuleUtil.isExpense(line)) {
378:                        total = total.add(line.getBaseBudgetAdjustmentAmount());
379:                    }
380:                }
381:
382:                return total;
383:            }
384:
385:            /**
386:             * Returns the total base budget amount from the target lines.
387:             * 
388:             * @return KualiDecimal
389:             */
390:            public KualiInteger getTargetBaseBudgetTotal() {
391:                KualiInteger baseBudgetTotal = new KualiInteger(0);
392:
393:                for (Iterator iter = targetAccountingLines.iterator(); iter
394:                        .hasNext();) {
395:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
396:                            .next();
397:                    baseBudgetTotal = baseBudgetTotal.add(line
398:                            .getBaseBudgetAdjustmentAmount());
399:                }
400:
401:                return baseBudgetTotal;
402:            }
403:
404:            /**
405:             * This method retrieves the total base budget amount formatted as currency.
406:             * 
407:             * @return String
408:             */
409:            public String getCurrencyFormattedTargetBaseBudgetTotal() {
410:                return (String) new CurrencyFormatter()
411:                        .format(getTargetBaseBudgetTotal());
412:            }
413:
414:            /**
415:             * Returns the total base budget income amount from the target lines.
416:             * 
417:             * @return KualiDecimal
418:             */
419:            public KualiInteger getTargetBaseBudgetIncomeTotal() {
420:                KualiInteger total = new KualiInteger(0);
421:
422:                for (Iterator iter = targetAccountingLines.iterator(); iter
423:                        .hasNext();) {
424:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
425:                            .next();
426:                    if (AccountingDocumentRuleUtil.isIncome(line)) {
427:                        total = total.add(line.getBaseBudgetAdjustmentAmount());
428:                    }
429:                }
430:
431:                return total;
432:            }
433:
434:            /**
435:             * Returns the total base budget expense amount from the target lines.
436:             * 
437:             * @return KualiDecimal
438:             */
439:            public KualiInteger getTargetBaseBudgetExpenseTotal() {
440:                KualiInteger total = new KualiInteger(0);
441:
442:                for (Iterator iter = targetAccountingLines.iterator(); iter
443:                        .hasNext();) {
444:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
445:                            .next();
446:                    if (AccountingDocumentRuleUtil.isExpense(line)) {
447:                        total = total.add(line.getBaseBudgetAdjustmentAmount());
448:                    }
449:                }
450:
451:                return total;
452:            }
453:
454:            /**
455:             * Same as default implementation but uses getTargetCurrentBudgetTotal and getSourceCurrentBudgetTotal instead.
456:             * 
457:             * @see org.kuali.kfs.document.AccountingDocumentBase#getTotalDollarAmount()
458:             * @return KualiDecimal
459:             */
460:            @Override
461:            public KualiDecimal getTotalDollarAmount() {
462:                return getTargetCurrentBudgetTotal().equals(KualiDecimal.ZERO) ? getSourceCurrentBudgetTotal()
463:                        : getTargetCurrentBudgetTotal();
464:            }
465:
466:            /**
467:             * Negate accounting line budget amounts.
468:             * 
469:             * @see org.kuali.kfs.document.AccountingDocumentBase#toErrorCorrection()
470:             */
471:            @Override
472:            public void toErrorCorrection() throws WorkflowException {
473:                super .toErrorCorrection();
474:
475:                if (this .getSourceAccountingLines() != null) {
476:                    for (Iterator iter = this .getSourceAccountingLines()
477:                            .iterator(); iter.hasNext();) {
478:                        BudgetAdjustmentAccountingLine sourceLine = (BudgetAdjustmentAccountingLine) iter
479:                                .next();
480:                        sourceLine.setBaseBudgetAdjustmentAmount(sourceLine
481:                                .getBaseBudgetAdjustmentAmount().negated());
482:                        sourceLine.setCurrentBudgetAdjustmentAmount(sourceLine
483:                                .getCurrentBudgetAdjustmentAmount().negated());
484:                        sourceLine
485:                                .setFinancialDocumentMonth1LineAmount(sourceLine
486:                                        .getFinancialDocumentMonth1LineAmount()
487:                                        .negated());
488:                        sourceLine
489:                                .setFinancialDocumentMonth2LineAmount(sourceLine
490:                                        .getFinancialDocumentMonth2LineAmount()
491:                                        .negated());
492:                        sourceLine
493:                                .setFinancialDocumentMonth3LineAmount(sourceLine
494:                                        .getFinancialDocumentMonth3LineAmount()
495:                                        .negated());
496:                        sourceLine
497:                                .setFinancialDocumentMonth4LineAmount(sourceLine
498:                                        .getFinancialDocumentMonth4LineAmount()
499:                                        .negated());
500:                        sourceLine
501:                                .setFinancialDocumentMonth5LineAmount(sourceLine
502:                                        .getFinancialDocumentMonth5LineAmount()
503:                                        .negated());
504:                        sourceLine
505:                                .setFinancialDocumentMonth6LineAmount(sourceLine
506:                                        .getFinancialDocumentMonth6LineAmount()
507:                                        .negated());
508:                        sourceLine
509:                                .setFinancialDocumentMonth7LineAmount(sourceLine
510:                                        .getFinancialDocumentMonth7LineAmount()
511:                                        .negated());
512:                        sourceLine
513:                                .setFinancialDocumentMonth8LineAmount(sourceLine
514:                                        .getFinancialDocumentMonth8LineAmount()
515:                                        .negated());
516:                        sourceLine
517:                                .setFinancialDocumentMonth9LineAmount(sourceLine
518:                                        .getFinancialDocumentMonth9LineAmount()
519:                                        .negated());
520:                        sourceLine
521:                                .setFinancialDocumentMonth10LineAmount(sourceLine
522:                                        .getFinancialDocumentMonth10LineAmount()
523:                                        .negated());
524:                        sourceLine
525:                                .setFinancialDocumentMonth11LineAmount(sourceLine
526:                                        .getFinancialDocumentMonth11LineAmount()
527:                                        .negated());
528:                        sourceLine
529:                                .setFinancialDocumentMonth12LineAmount(sourceLine
530:                                        .getFinancialDocumentMonth12LineAmount()
531:                                        .negated());
532:                    }
533:                }
534:
535:                if (this .getTargetAccountingLines() != null) {
536:                    for (Iterator iter = this .getTargetAccountingLines()
537:                            .iterator(); iter.hasNext();) {
538:                        BudgetAdjustmentAccountingLine targetLine = (BudgetAdjustmentAccountingLine) iter
539:                                .next();
540:                        targetLine.setBaseBudgetAdjustmentAmount(targetLine
541:                                .getBaseBudgetAdjustmentAmount().negated());
542:                        targetLine.setCurrentBudgetAdjustmentAmount(targetLine
543:                                .getCurrentBudgetAdjustmentAmount().negated());
544:                        targetLine
545:                                .setFinancialDocumentMonth1LineAmount(targetLine
546:                                        .getFinancialDocumentMonth1LineAmount()
547:                                        .negated());
548:                        targetLine
549:                                .setFinancialDocumentMonth2LineAmount(targetLine
550:                                        .getFinancialDocumentMonth2LineAmount()
551:                                        .negated());
552:                        targetLine
553:                                .setFinancialDocumentMonth3LineAmount(targetLine
554:                                        .getFinancialDocumentMonth3LineAmount()
555:                                        .negated());
556:                        targetLine
557:                                .setFinancialDocumentMonth4LineAmount(targetLine
558:                                        .getFinancialDocumentMonth4LineAmount()
559:                                        .negated());
560:                        targetLine
561:                                .setFinancialDocumentMonth5LineAmount(targetLine
562:                                        .getFinancialDocumentMonth5LineAmount()
563:                                        .negated());
564:                        targetLine
565:                                .setFinancialDocumentMonth6LineAmount(targetLine
566:                                        .getFinancialDocumentMonth6LineAmount()
567:                                        .negated());
568:                        targetLine
569:                                .setFinancialDocumentMonth7LineAmount(targetLine
570:                                        .getFinancialDocumentMonth7LineAmount()
571:                                        .negated());
572:                        targetLine
573:                                .setFinancialDocumentMonth8LineAmount(targetLine
574:                                        .getFinancialDocumentMonth8LineAmount()
575:                                        .negated());
576:                        targetLine
577:                                .setFinancialDocumentMonth9LineAmount(targetLine
578:                                        .getFinancialDocumentMonth9LineAmount()
579:                                        .negated());
580:                        targetLine
581:                                .setFinancialDocumentMonth10LineAmount(targetLine
582:                                        .getFinancialDocumentMonth10LineAmount()
583:                                        .negated());
584:                        targetLine
585:                                .setFinancialDocumentMonth11LineAmount(targetLine
586:                                        .getFinancialDocumentMonth11LineAmount()
587:                                        .negated());
588:                        targetLine
589:                                .setFinancialDocumentMonth12LineAmount(targetLine
590:                                        .getFinancialDocumentMonth12LineAmount()
591:                                        .negated());
592:                    }
593:                }
594:            }
595:
596:            /**
597:             * @see org.kuali.core.document.DocumentBase#toStringMapper()
598:             */
599:            @Override
600:            protected LinkedHashMap toStringMapper() {
601:                LinkedHashMap m = new LinkedHashMap();
602:                m
603:                        .put(KFSPropertyConstants.DOCUMENT_NUMBER,
604:                                this .documentNumber);
605:                return m;
606:            }
607:
608:            /**
609:             * @see org.kuali.kfs.document.AccountingDocumentBase#getAccountingLineParser()
610:             */
611:            @Override
612:            public AccountingLineParser getAccountingLineParser() {
613:                return new BudgetAdjustmentAccountingLineParser();
614:            }
615:
616:            /**
617:             * The base checks that the posting year is the current year, not a requirement for the ba document.
618:             * 
619:             * @see org.kuali.core.document.TransactionalDocumentBase#getAllowsCopy()
620:             */
621:            @Override
622:            public boolean getAllowsCopy() {
623:                return true;
624:            }
625:
626:            /**
627:             * The base checks that the posting year is the current year, not a requirement for the ba document.
628:             * 
629:             * @see org.kuali.core.document.TransactionalDocumentBase#getAllowsErrorCorrection()
630:             */
631:            @Override
632:            public boolean getAllowsErrorCorrection() {
633:                return true;
634:            }
635:
636:            /**
637:             * @see org.kuali.kfs.document.AccountingDocumentBase#getSourceAccountingLinesSectionTitle()
638:             */
639:            @Override
640:            public String getSourceAccountingLinesSectionTitle() {
641:                return KFSConstants.BudgetAdjustmentDocumentConstants.SOURCE_BA;
642:            }
643:
644:            /**
645:             * @see org.kuali.kfs.document.AccountingDocumentBase#getTargetAccountingLinesSectionTitle()
646:             */
647:            @Override
648:            public String getTargetAccountingLinesSectionTitle() {
649:                return KFSConstants.BudgetAdjustmentDocumentConstants.TARGET_BA;
650:            }
651:
652:            /**
653:             * @see org.kuali.core.document.DocumentBase#populateDocumentForRouting()
654:             */
655:            @Override
656:            public void populateDocumentForRouting() {
657:                super .populateDocumentForRouting();
658:
659:                // set amount fields of line for routing to current amount field
660:                for (Iterator iter = this .getSourceAccountingLines().iterator(); iter
661:                        .hasNext();) {
662:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
663:                            .next();
664:                    line.setAmount(line.getCurrentBudgetAdjustmentAmount());
665:                }
666:
667:                for (Iterator iter = this .getTargetAccountingLines().iterator(); iter
668:                        .hasNext();) {
669:                    BudgetAdjustmentAccountingLine line = (BudgetAdjustmentAccountingLine) iter
670:                            .next();
671:                    line.setAmount(line.getCurrentBudgetAdjustmentAmount());
672:                }
673:            }
674:
675:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.