Source Code Cross Referenced for BudgetXml.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » kra » budget » xml » 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.kra.budget.xml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2006-2007 The Kuali Foundation.
0003:         * 
0004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
0005:         * you may not use this file except in compliance with the License.
0006:         * You may obtain a copy of the License at
0007:         * 
0008:         * http://www.opensource.org/licenses/ecl1.php
0009:         * 
0010:         * Unless required by applicable law or agreed to in writing, software
0011:         * distributed under the License is distributed on an "AS IS" BASIS,
0012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013:         * See the License for the specific language governing permissions and
0014:         * limitations under the License.
0015:         */
0016:        package org.kuali.module.kra.budget.xml;
0017:
0018:        import java.math.BigDecimal;
0019:        import java.text.DateFormat;
0020:        import java.text.SimpleDateFormat;
0021:        import java.util.Calendar;
0022:        import java.util.Date;
0023:        import java.util.GregorianCalendar;
0024:        import java.util.Iterator;
0025:        import java.util.List;
0026:        import java.util.Locale;
0027:
0028:        import org.apache.commons.lang.ObjectUtils;
0029:        import org.kuali.core.util.KualiInteger;
0030:        import org.kuali.kfs.context.SpringContext;
0031:        import org.kuali.module.kra.KraConstants;
0032:        import org.kuali.module.kra.budget.bo.Budget;
0033:        import org.kuali.module.kra.budget.bo.BudgetInstitutionCostShare;
0034:        import org.kuali.module.kra.budget.bo.BudgetModular;
0035:        import org.kuali.module.kra.budget.bo.BudgetModularPeriod;
0036:        import org.kuali.module.kra.budget.bo.BudgetNonpersonnel;
0037:        import org.kuali.module.kra.budget.bo.BudgetPeriod;
0038:        import org.kuali.module.kra.budget.bo.BudgetPeriodInstitutionCostShare;
0039:        import org.kuali.module.kra.budget.bo.BudgetPeriodThirdPartyCostShare;
0040:        import org.kuali.module.kra.budget.bo.BudgetTask;
0041:        import org.kuali.module.kra.budget.bo.BudgetTaskPeriodIndirectCost;
0042:        import org.kuali.module.kra.budget.bo.BudgetThirdPartyCostShare;
0043:        import org.kuali.module.kra.budget.document.BudgetDocument;
0044:        import org.kuali.module.kra.budget.service.BudgetIndirectCostService;
0045:        import org.kuali.module.kra.budget.service.BudgetModularService;
0046:        import org.kuali.module.kra.budget.service.BudgetNonpersonnelService;
0047:        import org.kuali.module.kra.budget.web.struts.form.BudgetCostShareFormHelper;
0048:        import org.kuali.module.kra.budget.web.struts.form.BudgetIndirectCostFormHelper;
0049:        import org.kuali.module.kra.budget.web.struts.form.BudgetNonpersonnelFormHelper;
0050:        import org.kuali.module.kra.budget.web.struts.form.BudgetOverviewFormHelper;
0051:        import org.kuali.module.kra.budget.web.struts.form.BudgetOverviewFormHelper.BudgetOverviewPersonnelHelper;
0052:        import org.w3c.dom.Document;
0053:        import org.w3c.dom.Element;
0054:
0055:        /**
0056:         * This class creates an XML representation of a Budget's data.
0057:         */
0058:        public class BudgetXml {
0059:
0060:            // The following field is hard coded as checks in nih-2590, nih-398, nih-modular, and NSFSummaryProposalBudget. Hence if
0061:            // this field name is changed, the XLTs have to be updated. This also prevents us from using the more elegant:
0062:            // SpringContext.getBean(KualiConfigurationService.class).getParameterValue(ParameterConstants.RESEARCH_ADMINISTRATION_DOCUMENT.class,
0063:            // KraConstants.TO_BE_NAMED_LABEL)
0064:            private static final String TO_BE_NAMED = "To Be Named";
0065:
0066:            private static final String OUTPUT_PERCENT_SYMBOL = "%";
0067:
0068:            /**
0069:             * Driving method for this class. Functions as a hub calling helper methods.
0070:             * 
0071:             * @param budgetDoc data representation of a budget
0072:             * @param xmlDoc target xml representation for the budget. This field will be side effected.
0073:             * @param imagesUrl location of the images the stylesheets use
0074:             * @param param a parameter that is to be added to the XML as PARAMETER1. Useful for custom functions of a style sheet.
0075:             * @throws Exception
0076:             */
0077:            public static void makeXml(BudgetDocument budgetDoc,
0078:                    Document xmlDoc, String imagesUrl, String param)
0079:                    throws Exception {
0080:                Budget budget = budgetDoc.getBudget();
0081:
0082:                // Initialize data needed. This is data true for the budget as global. There is some data in createTaskPeriodsElement
0083:                // that is only true for a certain task / period.
0084:                List nonpersonnelCategories = SpringContext.getBean(
0085:                        BudgetNonpersonnelService.class)
0086:                        .getAllNonpersonnelCategories();
0087:                if (budget.isAgencyModularIndicator()) {
0088:                    SpringContext.getBean(BudgetModularService.class)
0089:                            .generateModularBudget(budget,
0090:                                    nonpersonnelCategories);
0091:                }
0092:                SpringContext.getBean(BudgetIndirectCostService.class)
0093:                        .refreshIndirectCost(budgetDoc);
0094:                BudgetIndirectCostFormHelper budgetIndirectCostFormHelper = new BudgetIndirectCostFormHelper(
0095:                        budget.getTasks(), budget.getPeriods(), budget
0096:                                .getIndirectCost()
0097:                                .getBudgetTaskPeriodIndirectCostItems());
0098:
0099:                // Start of XML elements
0100:                Element proposalElement = xmlDoc.createElement("PROPOSAL");
0101:                xmlDoc.appendChild(proposalElement);
0102:
0103:                Element budgetElement = xmlDoc.createElement("BUDGET");
0104:                proposalElement.appendChild(budgetElement);
0105:
0106:                budgetElement.setAttribute("BUDGET_NUMBER", budget
0107:                        .getDocumentNumber());
0108:                budgetElement.setAttribute("CURRENT_BASE", budget
0109:                        .getIndirectCost().getBudgetBaseCode());
0110:                budgetElement.setAttribute("PURPOSE", budget.getIndirectCost()
0111:                        .getPurpose() == null ? "" : budget.getIndirectCost()
0112:                        .getPurpose().getPurposeDescription());
0113:                budgetElement.setAttribute("GRANT_NUMBER", budget
0114:                        .getElectronicResearchAdministrationGrantNumber());
0115:
0116:                // Code to get the current date/time
0117:                Calendar calendar = new GregorianCalendar();
0118:                Date date = calendar.getTime();
0119:                DateFormat localFormat = DateFormat.getDateTimeInstance();
0120:
0121:                budgetElement.setAttribute("XML_CREATE_DATE_TIME", localFormat
0122:                        .format(date));
0123:                budgetElement.setAttribute("IMAGES_URL", imagesUrl);
0124:                budgetElement.setAttribute("PARAMETER1", param);
0125:
0126:                budgetElement.appendChild(createProjectDirectorElement(budget,
0127:                        xmlDoc));
0128:                budgetElement.appendChild(createAgencyElement(budget, xmlDoc));
0129:                budgetElement.appendChild(createTasksElement(budget, xmlDoc));
0130:                budgetElement.appendChild(createPeriodsElement(budget, xmlDoc));
0131:                budgetElement.appendChild(createCostShareElement(
0132:                        budgetIndirectCostFormHelper, budget, xmlDoc));
0133:                budgetElement.appendChild(createInflationRatesElement(budget,
0134:                        xmlDoc));
0135:                budgetElement.appendChild(createTaskPeriodsElement(
0136:                        nonpersonnelCategories, budgetIndirectCostFormHelper,
0137:                        budget, xmlDoc));
0138:                budgetElement.appendChild(createIndirectCostElement(
0139:                        budgetIndirectCostFormHelper, budget, xmlDoc));
0140:                budgetElement.appendChild(createModularBudgetElement(budget,
0141:                        xmlDoc));
0142:            }
0143:
0144:            /**
0145:             * Creates PROJECT_DIRECTOR node.
0146:             * 
0147:             * @param budget
0148:             * @param xmlDoc
0149:             * @return resulting node
0150:             */
0151:            private static Element createProjectDirectorElement(Budget budget,
0152:                    Document xmlDoc) {
0153:                Element projectDirectorElement = xmlDoc
0154:                        .createElement("PROJECT_DIRECTOR");
0155:
0156:                if (budget.isProjectDirectorToBeNamedIndicator()) {
0157:                    projectDirectorElement.setAttribute("FIRST_NAME",
0158:                            TO_BE_NAMED);
0159:                } else if (budget.getProjectDirector() != null) {
0160:                    projectDirectorElement.setAttribute("FIRST_NAME",
0161:                            ObjectUtils.toString(budget.getProjectDirector()
0162:                                    .getUniversalUser().getPersonFirstName()));
0163:
0164:                    projectDirectorElement.setAttribute("LAST_NAME",
0165:                            ObjectUtils.toString(budget.getProjectDirector()
0166:                                    .getUniversalUser().getPersonLastName()));
0167:
0168:                    projectDirectorElement.setAttribute("USER_ID",
0169:                            ObjectUtils
0170:                                    .toString(budget.getProjectDirector()
0171:                                            .getUniversalUser()
0172:                                            .getPersonEmailAddress()));
0173:                }
0174:
0175:                return projectDirectorElement;
0176:            }
0177:
0178:            /**
0179:             * Creates AGENCY node.
0180:             * 
0181:             * @param budget
0182:             * @param xmlDoc
0183:             * @return resulting node
0184:             */
0185:            private static Element createAgencyElement(Budget budget,
0186:                    Document xmlDoc) {
0187:                Element agencyElement = xmlDoc.createElement("AGENCY");
0188:
0189:                if (budget.isAgencyToBeNamedIndicator()) {
0190:                    agencyElement.setAttribute("AGENCY_FULL_NAME", TO_BE_NAMED);
0191:                } else if (budget.getBudgetAgency() != null) {
0192:                    agencyElement.setAttribute("AGENCY_NUMBER", ObjectUtils
0193:                            .toString(budget.getBudgetAgency()
0194:                                    .getAgencyNumber()));
0195:
0196:                    agencyElement.setAttribute("AGENCY_FULL_NAME", ObjectUtils
0197:                            .toString(budget.getBudgetAgency().getFullName()));
0198:
0199:                    agencyElement.setAttribute("AGENCY_REPORT_NAME",
0200:                            ObjectUtils.toString(budget.getBudgetAgency()
0201:                                    .getReportingName()));
0202:                }
0203:
0204:                return agencyElement;
0205:            }
0206:
0207:            /**
0208:             * Creates TASKS node.
0209:             * 
0210:             * @param budget
0211:             * @param xmlDoc
0212:             * @return resulting node
0213:             */
0214:            private static Element createTasksElement(Budget budget,
0215:                    Document xmlDoc) {
0216:                Element tasksElement = xmlDoc.createElement("TASKS");
0217:
0218:                Iterator iter = budget.getTasks().iterator();
0219:                for (int i = 0; iter.hasNext(); i++) {
0220:                    BudgetTask currentTask = (BudgetTask) iter.next();
0221:                    Element taskElement = xmlDoc.createElement("TASK");
0222:                    // Setup with the default location attribute
0223:                    taskElement.setAttribute("LOCATION", "ON");
0224:
0225:                    Element taskSequenceNumberElement = xmlDoc
0226:                            .createElement("TASK_SEQUENCE_NUMBER");
0227:                    taskSequenceNumberElement.appendChild(xmlDoc
0228:                            .createTextNode(currentTask
0229:                                    .getBudgetTaskSequenceNumber().toString()));
0230:                    taskElement.appendChild(taskSequenceNumberElement);
0231:
0232:                    Element taskNumberElement = xmlDoc
0233:                            .createElement("TASK_NUMBER");
0234:                    taskNumberElement.appendChild(xmlDoc.createTextNode(Integer
0235:                            .toString(i + 1)));
0236:                    taskElement.appendChild(taskNumberElement);
0237:
0238:                    Element taskNameElement = xmlDoc.createElement("TASK_NAME");
0239:                    taskNameElement.appendChild(xmlDoc
0240:                            .createTextNode(currentTask.getBudgetTaskName()));
0241:                    taskElement.appendChild(taskNameElement);
0242:
0243:                    tasksElement.appendChild(taskElement);
0244:                }
0245:
0246:                return tasksElement;
0247:            }
0248:
0249:            /**
0250:             * Creates PERIODS node.
0251:             * 
0252:             * @param budget
0253:             * @param xmlDoc
0254:             * @return resulting node
0255:             */
0256:            private static Element createPeriodsElement(Budget budget,
0257:                    Document xmlDoc) {
0258:                Element periodsElement = xmlDoc.createElement("PERIODS");
0259:
0260:                DateFormat dateFormatterKra = new SimpleDateFormat("MM/dd/yyyy"); // this is also in BudgetPeriod
0261:                DateFormat dateFormatterLong = DateFormat.getDateInstance(
0262:                        DateFormat.LONG, Locale.US);
0263:
0264:                Iterator iter = budget.getPeriods().iterator();
0265:                for (int i = 0; iter.hasNext(); i++) {
0266:                    BudgetPeriod currentPeriod = (BudgetPeriod) iter.next();
0267:                    Element periodElement = xmlDoc.createElement("PERIOD");
0268:
0269:                    Element periodSequenceNumberElement = xmlDoc
0270:                            .createElement("PERIOD_SEQUENCE_NUMBER");
0271:                    periodSequenceNumberElement
0272:                            .appendChild(xmlDoc
0273:                                    .createTextNode(currentPeriod
0274:                                            .getBudgetPeriodSequenceNumber()
0275:                                            .toString()));
0276:                    periodElement.appendChild(periodSequenceNumberElement);
0277:
0278:                    Element periodNumberElement = xmlDoc
0279:                            .createElement("PERIOD_NUMBER");
0280:                    periodNumberElement.appendChild(xmlDoc
0281:                            .createTextNode(Integer.toString(i + 1)));
0282:                    periodElement.appendChild(periodNumberElement);
0283:
0284:                    Element periodStartDateElement = xmlDoc
0285:                            .createElement("START_DATE");
0286:                    periodStartDateElement.appendChild(xmlDoc
0287:                            .createTextNode(dateFormatterKra
0288:                                    .format(currentPeriod
0289:                                            .getBudgetPeriodBeginDate())));
0290:                    periodElement.appendChild(periodStartDateElement);
0291:
0292:                    Element periodStartDateStringElement = xmlDoc
0293:                            .createElement("START_DATE_STRING");
0294:                    periodStartDateStringElement.appendChild(xmlDoc
0295:                            .createTextNode(dateFormatterLong
0296:                                    .format(currentPeriod
0297:                                            .getBudgetPeriodBeginDate())));
0298:                    periodElement.appendChild(periodStartDateStringElement);
0299:
0300:                    Element periodStopDateElement = xmlDoc
0301:                            .createElement("STOP_DATE");
0302:                    periodStopDateElement.appendChild(xmlDoc
0303:                            .createTextNode(dateFormatterKra
0304:                                    .format(currentPeriod
0305:                                            .getBudgetPeriodEndDate())));
0306:                    periodElement.appendChild(periodStopDateElement);
0307:
0308:                    Element periodStopDateStringElement = xmlDoc
0309:                            .createElement("STOP_DATE_STRING");
0310:                    periodStopDateStringElement.appendChild(xmlDoc
0311:                            .createTextNode(dateFormatterLong
0312:                                    .format(currentPeriod
0313:                                            .getBudgetPeriodEndDate())));
0314:                    periodElement.appendChild(periodStopDateStringElement);
0315:                    periodsElement.appendChild(periodElement);
0316:                }
0317:
0318:                return periodsElement;
0319:            }
0320:
0321:            /**
0322:             * Creates COST_SHARE node.
0323:             * 
0324:             * @param budgetIndirectCostFormHelper
0325:             * @param budget
0326:             * @param xmlDoc
0327:             * @return resulting node
0328:             */
0329:            private static Element createCostShareElement(
0330:                    BudgetIndirectCostFormHelper budgetIndirectCostFormHelper,
0331:                    Budget budget, Document xmlDoc) throws Exception {
0332:                Element costShareElement = xmlDoc.createElement("COST_SHARE");
0333:
0334:                costShareElement.setAttribute(
0335:                        "INSTITUTION_COST_SHARE_INDICATOR", "YES");
0336:                costShareElement.setAttribute(
0337:                        "THIRD_PARTY_COST_SHARE_INDICATOR", "NO");
0338:
0339:                BudgetCostShareFormHelper budgetCostShareFormHelper = new BudgetCostShareFormHelper(
0340:                        budget.getPeriods(), budget.getPersonnel(), budget
0341:                                .getNonpersonnelItems(), budget
0342:                                .getInstitutionCostSharePersonnelItems(),
0343:                        budget.getInstitutionCostShareItems(), budget
0344:                                .getThirdPartyCostShareItems(),
0345:                        budgetIndirectCostFormHelper);
0346:
0347:                costShareElement.appendChild(createInstitutionCostShareElement(
0348:                        budgetCostShareFormHelper, budget, xmlDoc));
0349:                costShareElement
0350:                        .appendChild(createInstitutionIndirectCostShareElement(
0351:                                budgetIndirectCostFormHelper, budget, xmlDoc));
0352:                costShareElement.appendChild(createThirdPartyCostShareElement(
0353:                        budgetCostShareFormHelper, budget, xmlDoc));
0354:                costShareElement
0355:                        .appendChild(createSubcontractorCostShareElement(
0356:                                budgetCostShareFormHelper, budget, xmlDoc));
0357:
0358:                return costShareElement;
0359:            }
0360:
0361:            /**
0362:             * Creates INSTITUTION_COST_SHARE node.
0363:             * 
0364:             * @param budgetCostShareFormHelper
0365:             * @param budget
0366:             * @param xmlDoc
0367:             * @return resulting node
0368:             */
0369:            private static Element createInstitutionCostShareElement(
0370:                    BudgetCostShareFormHelper budgetCostShareFormHelper,
0371:                    Budget budget, Document xmlDoc) throws Exception {
0372:                Element institutionCostShareElement = xmlDoc
0373:                        .createElement("INSTITUTION_COST_SHARE");
0374:                Element institutionCostSharePeriodsElement = xmlDoc
0375:                        .createElement("INSTITUTION_COST_SHARE_PERIODS");
0376:
0377:                institutionCostSharePeriodsElement.setAttribute(
0378:                        "TOTAL_INSTITUTION_BUDGETED", budgetCostShareFormHelper
0379:                                .getInstitutionDirect().getTotalTotalBudgeted()
0380:                                .toString());
0381:                institutionCostSharePeriodsElement.setAttribute(
0382:                        "TOTAL_INSTITUTION_AMOUNT_DISTRIBUTED",
0383:                        budgetCostShareFormHelper.getInstitutionDirect()
0384:                                .getTotalAmountDistributed().toString());
0385:                institutionCostSharePeriodsElement.setAttribute(
0386:                        "TOTAL_INSTITUTION_BALANCE", budgetCostShareFormHelper
0387:                                .getInstitutionDirect()
0388:                                .getTotalBalanceToBeDistributed().toString());
0389:
0390:                for (int i = 0; i < budget.getPeriods().size(); i++) {
0391:                    Element institutionCostSharePeriodElement = xmlDoc
0392:                            .createElement("INSTITUTION_COST_SHARE_PERIOD");
0393:                    institutionCostSharePeriodElement.setAttribute(
0394:                            "PERIOD_NUMBER", Integer.toString(i + 1));
0395:
0396:                    Element institutionTotalBudgetedElement = xmlDoc
0397:                            .createElement("INSTITUTION_TOTAL_BUDGETED");
0398:                    institutionTotalBudgetedElement
0399:                            .appendChild(xmlDoc
0400:                                    .createTextNode(budgetCostShareFormHelper
0401:                                            .getInstitutionDirect()
0402:                                            .getTotalBudgeted()[i].toString()));
0403:                    institutionCostSharePeriodElement
0404:                            .appendChild(institutionTotalBudgetedElement);
0405:
0406:                    Element institutionAmountDistributedElement = xmlDoc
0407:                            .createElement("INSTITUTION_AMOUNT_DISTRIBUTED");
0408:                    institutionAmountDistributedElement.appendChild(xmlDoc
0409:                            .createTextNode(budgetCostShareFormHelper
0410:                                    .getInstitutionDirect()
0411:                                    .getAmountDistributed()[i].toString()));
0412:                    institutionCostSharePeriodElement
0413:                            .appendChild(institutionAmountDistributedElement);
0414:
0415:                    Element institutionBalanceElement = xmlDoc
0416:                            .createElement("INSTITUTION_BALANCE");
0417:                    institutionBalanceElement
0418:                            .appendChild(xmlDoc
0419:                                    .createTextNode(budgetCostShareFormHelper
0420:                                            .getInstitutionDirect()
0421:                                            .getBalanceToBeDistributed()[i]
0422:                                            .toString()));
0423:                    institutionCostSharePeriodElement
0424:                            .appendChild(institutionBalanceElement);
0425:
0426:                    institutionCostSharePeriodsElement
0427:                            .appendChild(institutionCostSharePeriodElement);
0428:                }
0429:                institutionCostShareElement
0430:                        .appendChild(institutionCostSharePeriodsElement);
0431:
0432:                Element institutionCostShareChartOrgsElement = xmlDoc
0433:                        .createElement("INSTITUTION_COST_SHARE_CHART_ORGS");
0434:                for (int i = 0; i < budget.getInstitutionCostShareItems()
0435:                        .size(); i++) {
0436:                    BudgetInstitutionCostShare budgetInstitutionCostShare = budget
0437:                            .getInstitutionCostShareItem(i);
0438:
0439:                    Element institutionCostShareChartOrgElement = xmlDoc
0440:                            .createElement("INSTITUTION_COST_SHARE_CHART_ORG");
0441:                    institutionCostShareChartOrgElement
0442:                            .setAttribute("CHART", budgetInstitutionCostShare
0443:                                    .getChartOfAccountsCode());
0444:                    institutionCostShareChartOrgElement.setAttribute("ORG",
0445:                            budgetInstitutionCostShare.getOrganizationCode());
0446:                    institutionCostShareChartOrgElement.setAttribute("TOTAL",
0447:                            budgetCostShareFormHelper.getInstitutionDirect()
0448:                                    .getTotalSource()[i].toString());
0449:
0450:                    Iterator innerIter = budgetInstitutionCostShare
0451:                            .getBudgetPeriodCostShare().iterator();
0452:                    for (int j = 0; innerIter.hasNext(); j++) {
0453:                        BudgetPeriodInstitutionCostShare periodInstitutionCostShare = (BudgetPeriodInstitutionCostShare) innerIter
0454:                                .next();
0455:
0456:                        Element institutionCostShareChartOrgPeriodElement = xmlDoc
0457:                                .createElement("INSTITUTION_COST_SHARE_CHART_ORG_PERIOD");
0458:                        institutionCostShareChartOrgPeriodElement.setAttribute(
0459:                                "PERIOD_NUMBER", Integer.toString(j + 1));
0460:
0461:                        Element institutionCostShareChartOrgPeriodAmountElement = xmlDoc
0462:                                .createElement("INSTITUTION_COST_SHARE_CHART_ORG_PERIOD_AMOUNT");
0463:                        institutionCostShareChartOrgPeriodAmountElement
0464:                                .appendChild(xmlDoc.createTextNode(ObjectUtils
0465:                                        .toString(periodInstitutionCostShare
0466:                                                .getBudgetCostShareAmount())));
0467:                        institutionCostShareChartOrgPeriodElement
0468:                                .appendChild(institutionCostShareChartOrgPeriodAmountElement);
0469:
0470:                        institutionCostShareChartOrgElement
0471:                                .appendChild(institutionCostShareChartOrgPeriodElement);
0472:                    }
0473:                    institutionCostShareChartOrgsElement
0474:                            .appendChild(institutionCostShareChartOrgElement);
0475:                }
0476:                institutionCostShareElement
0477:                        .appendChild(institutionCostShareChartOrgsElement);
0478:
0479:                return institutionCostShareElement;
0480:            }
0481:
0482:            /**
0483:             * Creates INSTITUTION_INDIRECT_COST_SHARE node.
0484:             * 
0485:             * @param budgetCostShareFormHelper
0486:             * @param budget
0487:             * @param xmlDoc
0488:             * @return resulting node
0489:             */
0490:            private static Element createInstitutionIndirectCostShareElement(
0491:                    BudgetIndirectCostFormHelper budgetIndirectCostFormHelper,
0492:                    Budget budget, Document xmlDoc) {
0493:                Element institutionIndirectCostShareElement = xmlDoc
0494:                        .createElement("INSTITUTION_INDIRECT_COST_SHARE");
0495:
0496:                institutionIndirectCostShareElement.setAttribute(
0497:                        "TOTAL_INDIRECT_COST_SHARE",
0498:                        budgetIndirectCostFormHelper.getPeriodSubTotal()
0499:                                .getCostShareCalculatedIndirectCost()
0500:                                .toString());
0501:                institutionIndirectCostShareElement.setAttribute(
0502:                        "TOTAL_UNRECOVERED_INDIRECT_COST",
0503:                        budgetIndirectCostFormHelper.getPeriodSubTotal()
0504:                                .getCostShareUnrecoveredIndirectCost()
0505:                                .toString());
0506:
0507:                for (int i = 0; i < budget.getPeriods().size(); i++) {
0508:                    BudgetTaskPeriodIndirectCost periodTotal = budgetIndirectCostFormHelper
0509:                            .getPeriodTotal(i);
0510:
0511:                    Element institutionIndirectCostSharePeriodElement = xmlDoc
0512:                            .createElement("INSTITUTION_INDIRECT_COST_SHARE_PERIOD");
0513:                    institutionIndirectCostSharePeriodElement.setAttribute(
0514:                            "PERIOD_NUMBER", Integer.toString(i + 1));
0515:
0516:                    Element indirectCostOnCostShareElement = xmlDoc
0517:                            .createElement("INDIRECT_COST_ON_COST_SHARE");
0518:                    indirectCostOnCostShareElement.appendChild(xmlDoc
0519:                            .createTextNode(periodTotal
0520:                                    .getCostShareCalculatedIndirectCost()
0521:                                    .toString()));
0522:                    institutionIndirectCostSharePeriodElement
0523:                            .appendChild(indirectCostOnCostShareElement);
0524:
0525:                    Element unrecoveredIndirectCostElement = xmlDoc
0526:                            .createElement("UNRECOVERED_INDIRECT_COST");
0527:                    unrecoveredIndirectCostElement.appendChild(xmlDoc
0528:                            .createTextNode(periodTotal
0529:                                    .getCostShareUnrecoveredIndirectCost()
0530:                                    .toString()));
0531:                    institutionIndirectCostSharePeriodElement
0532:                            .appendChild(unrecoveredIndirectCostElement);
0533:
0534:                    institutionIndirectCostShareElement
0535:                            .appendChild(institutionIndirectCostSharePeriodElement);
0536:                }
0537:
0538:                return institutionIndirectCostShareElement;
0539:            }
0540:
0541:            /**
0542:             * Creates THIRD_PARTY_COST_SHARE node.
0543:             * 
0544:             * @param budgetCostShareFormHelper
0545:             * @param budget
0546:             * @param xmlDoc
0547:             * @return resulting node
0548:             */
0549:            private static Element createThirdPartyCostShareElement(
0550:                    BudgetCostShareFormHelper budgetCostShareFormHelper,
0551:                    Budget budget, Document xmlDoc) {
0552:                Element thirdPartyCostShareElement = xmlDoc
0553:                        .createElement("THIRD_PARTY_COST_SHARE");
0554:
0555:                Element thirdPartyCostSharePeriodsElement = xmlDoc
0556:                        .createElement("THIRD_PARTY_COST_SHARE_PERIODS");
0557:                thirdPartyCostSharePeriodsElement.setAttribute(
0558:                        "THIRD_PARTY_TOTAL_BUDGETED", budgetCostShareFormHelper
0559:                                .getThirdPartyDirect().getTotalTotalBudgeted()
0560:                                .toString());
0561:                thirdPartyCostSharePeriodsElement.setAttribute(
0562:                        "THIRD_PARTY_AMOUNT_DISTRIBUTED",
0563:                        budgetCostShareFormHelper.getThirdPartyDirect()
0564:                                .getTotalAmountDistributed().toString());
0565:                thirdPartyCostSharePeriodsElement.setAttribute(
0566:                        "THIRD_PARTY_BALANCE", budgetCostShareFormHelper
0567:                                .getThirdPartyDirect()
0568:                                .getTotalBalanceToBeDistributed().toString());
0569:
0570:                for (int i = 0; i < budget.getPeriods().size(); i++) {
0571:                    Element thirdPartyCostSharePeriodElement = xmlDoc
0572:                            .createElement("THIRD_PARTY_COST_SHARE_PERIOD");
0573:                    thirdPartyCostSharePeriodElement.setAttribute(
0574:                            "PERIOD_NUMBER", Integer.toString(i + 1));
0575:
0576:                    Element thirdPartyTotalBudgetedElement = xmlDoc
0577:                            .createElement("THIRD_PARTY_TOTAL_BUDGETED");
0578:                    thirdPartyTotalBudgetedElement
0579:                            .appendChild(xmlDoc
0580:                                    .createTextNode(budgetCostShareFormHelper
0581:                                            .getThirdPartyDirect()
0582:                                            .getTotalBudgeted()[i].toString()));
0583:                    thirdPartyCostSharePeriodElement
0584:                            .appendChild(thirdPartyTotalBudgetedElement);
0585:
0586:                    Element thirdPartyAmountDistributedElement = xmlDoc
0587:                            .createElement("THIRD_PARTY_AMOUNT_DISTRIBUTED");
0588:                    thirdPartyAmountDistributedElement.appendChild(xmlDoc
0589:                            .createTextNode(budgetCostShareFormHelper
0590:                                    .getThirdPartyDirect()
0591:                                    .getAmountDistributed()[i].toString()));
0592:                    thirdPartyCostSharePeriodElement
0593:                            .appendChild(thirdPartyAmountDistributedElement);
0594:
0595:                    Element thirdPartyBalanceElement = xmlDoc
0596:                            .createElement("THIRD_PARTY_BALANCE");
0597:                    thirdPartyBalanceElement
0598:                            .appendChild(xmlDoc
0599:                                    .createTextNode(budgetCostShareFormHelper
0600:                                            .getThirdPartyDirect()
0601:                                            .getBalanceToBeDistributed()[i]
0602:                                            .toString()));
0603:                    thirdPartyCostSharePeriodElement
0604:                            .appendChild(thirdPartyBalanceElement);
0605:
0606:                    thirdPartyCostSharePeriodsElement
0607:                            .appendChild(thirdPartyCostSharePeriodElement);
0608:                }
0609:                thirdPartyCostShareElement
0610:                        .appendChild(thirdPartyCostSharePeriodsElement);
0611:
0612:                Element thirdPartyCostShareSourcesElement = xmlDoc
0613:                        .createElement("THIRD_PARTY_COST_SHARE_SOURCES");
0614:                for (int i = 0; i < budget.getThirdPartyCostShareItems().size(); i++) {
0615:                    BudgetThirdPartyCostShare budgetThirdPartyCostShare = budget
0616:                            .getThirdPartyCostShareItem(i);
0617:
0618:                    Element thirdPartyCostShareSourceElement = xmlDoc
0619:                            .createElement("THIRD_PARTY_COST_SHARE_SOURCE");
0620:                    thirdPartyCostShareSourceElement.setAttribute("SOURCE",
0621:                            budgetThirdPartyCostShare
0622:                                    .getBudgetCostShareSourceName());
0623:                    thirdPartyCostShareSourceElement.setAttribute("TOTAL",
0624:                            budgetCostShareFormHelper.getThirdPartyDirect()
0625:                                    .getTotalSource()[i].toString());
0626:
0627:                    Iterator innerIter = budgetThirdPartyCostShare
0628:                            .getBudgetPeriodCostShare().iterator();
0629:                    for (int j = 0; innerIter.hasNext(); j++) {
0630:                        BudgetPeriodThirdPartyCostShare periodThirdPartyCostShare = (BudgetPeriodThirdPartyCostShare) innerIter
0631:                                .next();
0632:
0633:                        Element thirdPartyCostSharePeriodAmount = xmlDoc
0634:                                .createElement("THIRD_PARTY_COST_SHARE_PERIOD_AMOUNT");
0635:                        thirdPartyCostSharePeriodAmount.setAttribute(
0636:                                "PERIOD_NUMBER", Integer.toString(j + 1));
0637:                        thirdPartyCostSharePeriodAmount
0638:                                .appendChild(xmlDoc
0639:                                        .createTextNode(periodThirdPartyCostShare
0640:                                                .getBudgetCostShareAmount() != null ? periodThirdPartyCostShare
0641:                                                .getBudgetCostShareAmount()
0642:                                                .toString()
0643:                                                : "0"));
0644:
0645:                        thirdPartyCostShareSourcesElement
0646:                                .appendChild(thirdPartyCostSharePeriodAmount);
0647:                    }
0648:                    thirdPartyCostShareSourcesElement
0649:                            .appendChild(thirdPartyCostShareSourceElement);
0650:                }
0651:                thirdPartyCostShareElement
0652:                        .appendChild(thirdPartyCostShareSourcesElement);
0653:
0654:                return thirdPartyCostShareElement;
0655:            }
0656:
0657:            /**
0658:             * Creates SUBCONTRACTOR_COST_SHARE node.
0659:             * 
0660:             * @param budgetCostShareFormHelper
0661:             * @param budget
0662:             * @param xmlDoc
0663:             * @return resulting node
0664:             */
0665:            private static Element createSubcontractorCostShareElement(
0666:                    BudgetCostShareFormHelper budgetCostShareFormHelper,
0667:                    Budget budget, Document xmlDoc) {
0668:                Element subcontractorCostShareElement = xmlDoc
0669:                        .createElement("SUBCONTRACTOR_COST_SHARE");
0670:                Element subcontractorCostShareSourcesElement = xmlDoc
0671:                        .createElement("SUBCONTRACTOR_COST_SHARE_SOURCES");
0672:
0673:                for (BudgetCostShareFormHelper.Subcontractor subcontractor : budgetCostShareFormHelper
0674:                        .getSubcontractors()) {
0675:                    Element subconstractorCostShareSource = xmlDoc
0676:                            .createElement("SUBCONTRACTOR_COST_SHARE_SOURCE");
0677:
0678:                    subconstractorCostShareSource.setAttribute("NAME",
0679:                            subcontractor.getBudgetNonpersonnelDescription());
0680:                    subconstractorCostShareSource.setAttribute("TOTAL",
0681:                            subcontractor.getTotalPeriodAmount().toString());
0682:
0683:                    for (int i = 0; i < subcontractor.getPeriodAmounts().length; i++) {
0684:                        Element subcontractorSourcePeriod = xmlDoc
0685:                                .createElement("SUBCONTRACTOR_SOURCE_PERIOD");
0686:                        subcontractorSourcePeriod.setAttribute("PERIOD_NUMBER",
0687:                                Integer.toString(i + 1));
0688:
0689:                        Element subcontractorAmount = xmlDoc
0690:                                .createElement("SUBCONTRACTOR_AMOUNT");
0691:                        subcontractorAmount.appendChild(xmlDoc
0692:                                .createTextNode(subcontractor
0693:                                        .getPeriodAmounts()[i].toString()));
0694:                        subcontractorSourcePeriod
0695:                                .appendChild(subcontractorAmount);
0696:
0697:                        subconstractorCostShareSource
0698:                                .appendChild(subcontractorSourcePeriod);
0699:                    }
0700:
0701:                    subcontractorCostShareSourcesElement
0702:                            .appendChild(subconstractorCostShareSource);
0703:                }
0704:
0705:                subcontractorCostShareElement
0706:                        .appendChild(subcontractorCostShareSourcesElement);
0707:
0708:                return subcontractorCostShareElement;
0709:            }
0710:
0711:            /**
0712:             * Creates INFLATION_RATES node.
0713:             * 
0714:             * @param budget
0715:             * @param xmlDoc
0716:             * @return resulting node
0717:             */
0718:            private static Element createInflationRatesElement(Budget budget,
0719:                    Document xmlDoc) {
0720:                Element inflationRatesElement = xmlDoc
0721:                        .createElement("INFLATION_RATES");
0722:
0723:                inflationRatesElement.setAttribute("PERSONNEL", ObjectUtils
0724:                        .toString(budget.getBudgetPersonnelInflationRate()
0725:                                .toString()));
0726:
0727:                inflationRatesElement.setAttribute("NON_PERSONNEL", ObjectUtils
0728:                        .toString(budget.getBudgetNonpersonnelInflationRate()
0729:                                .toString()));
0730:
0731:                return inflationRatesElement;
0732:            }
0733:
0734:            /**
0735:             * Creates TASK_PERIODS node.
0736:             * 
0737:             * @param nonpersonnelCategories
0738:             * @param budgetIndirectCostFormHelper
0739:             * @param budget
0740:             * @param xmlDoc
0741:             * @return resulting node
0742:             */
0743:            private static Element createTaskPeriodsElement(
0744:                    List nonpersonnelCategories,
0745:                    BudgetIndirectCostFormHelper budgetIndirectCostFormHelper,
0746:                    Budget budget, Document xmlDoc) {
0747:                Element taskPeriodsElement = xmlDoc
0748:                        .createElement("TASK_PERIODS");
0749:
0750:                for (int i = 0; i < budget.getTasks().size(); i++) {
0751:                    BudgetTask currentTask = (BudgetTask) budget.getTasks()
0752:                            .get(i);
0753:
0754:                    for (int j = 0; j < budget.getPeriods().size(); j++) {
0755:                        BudgetPeriod currentPeriod = (BudgetPeriod) budget
0756:                                .getPeriods().get(j);
0757:
0758:                        Element taskPeriodElement = xmlDoc
0759:                                .createElement("TASK_PERIOD");
0760:                        taskPeriodElement.setAttribute("TASK_NUMBER", Integer
0761:                                .toString(i + 1));
0762:                        taskPeriodElement.setAttribute("PERIOD_NUMBER", ""
0763:                                + Integer.toString(j + 1));
0764:
0765:                        // Collect necessary data based on current task / period.
0766:                        BudgetOverviewFormHelper budgetOverviewFormHelper = new BudgetOverviewFormHelper();
0767:                        BudgetNonpersonnelFormHelper budgetNonpersonnelFormHelper = budgetOverviewFormHelper
0768:                                .recalculate(
0769:                                        currentTask
0770:                                                .getBudgetTaskSequenceNumber(),
0771:                                        currentPeriod
0772:                                                .getBudgetPeriodSequenceNumber(),
0773:                                        nonpersonnelCategories,
0774:                                        budgetIndirectCostFormHelper, budget);
0775:
0776:                        taskPeriodElement.setAttribute(
0777:                                "TOTAL_AGENCY_REQUEST_DIRECT_COST",
0778:                                budgetOverviewFormHelper
0779:                                        .getTotalDirectCostsAgencyRequest()
0780:                                        .toString());
0781:                        taskPeriodElement
0782:                                .setAttribute(
0783:                                        "TOTAL_INSTITUTION_DIRECT_COST",
0784:                                        budgetOverviewFormHelper
0785:                                                .getTotalDirectCostsInstitutionCostShare()
0786:                                                .toString());
0787:                        taskPeriodElement.setAttribute(
0788:                                "TOTAL_THIRD_PARTY_DIRECT_COST",
0789:                                budgetOverviewFormHelper
0790:                                        .getTotalDirectThirdPartyCostShare()
0791:                                        .toString());
0792:
0793:                        taskPeriodElement.setAttribute(
0794:                                "TOTAL_AGENCY_REQUEST_INDIRECT_COST",
0795:                                budgetOverviewFormHelper
0796:                                        .getTotalIndirectCostsAgencyRequest()
0797:                                        .toString());
0798:                        taskPeriodElement
0799:                                .setAttribute(
0800:                                        "TOTAL_INSTITUTION_INDIRECT_COST",
0801:                                        budgetOverviewFormHelper
0802:                                                .getTotalIndirectCostsInstitutionCostShare()
0803:                                                .toString());
0804:                        taskPeriodElement
0805:                                .setAttribute(
0806:                                        "TOTAL_INSTITUTION_UNRECOVERED_INDIRECT_COST",
0807:                                        budgetOverviewFormHelper
0808:                                                .getTotalIndirectCostsInstitutionCostShareUnrecovered()
0809:                                                .toString());
0810:
0811:                        // Not so sure why this exists as there doesn't appear to be a third party Indirect Cost. Maybe legacy XSLT support?
0812:                        taskPeriodElement.setAttribute(
0813:                                "TOTAL_THIRD_PARTY_INDIRECT_COST", "0");
0814:
0815:                        taskPeriodElement.setAttribute("TOTAL_AGENCY_COST",
0816:                                budgetOverviewFormHelper
0817:                                        .getTotalCostsAgencyRequest()
0818:                                        .toString());
0819:                        taskPeriodElement.setAttribute(
0820:                                "TOTAL_INSTITUTION_COST",
0821:                                budgetOverviewFormHelper
0822:                                        .getTotalCostsInstitutionCostShare()
0823:                                        .toString());
0824:                        taskPeriodElement.setAttribute(
0825:                                "TOTAL_THIRD_PARTY_COST",
0826:                                budgetOverviewFormHelper
0827:                                        .getTotalCostsThirdPartyCostShare()
0828:                                        .toString());
0829:
0830:                        taskPeriodElement.appendChild(setupPersonnel(
0831:                                budgetOverviewFormHelper, xmlDoc));
0832:                        taskPeriodElement.appendChild(setupNonPersonnel(
0833:                                currentTask, currentPeriod,
0834:                                budgetNonpersonnelFormHelper, budget, xmlDoc));
0835:
0836:                        taskPeriodsElement.appendChild(taskPeriodElement);
0837:                    }
0838:                }
0839:
0840:                return taskPeriodsElement;
0841:            }
0842:
0843:            /**
0844:             * Creates PERSONNEL node.
0845:             * 
0846:             * @param budgetOverviewFormHelper
0847:             * @param xmlDoc
0848:             * @return resulting node
0849:             */
0850:            private static Element setupPersonnel(
0851:                    BudgetOverviewFormHelper budgetOverviewFormHelper,
0852:                    Document xmlDoc) {
0853:                Element personnelElement = xmlDoc.createElement("PERSONNEL");
0854:
0855:                List<BudgetOverviewPersonnelHelper> budgetOverviewPersonnelHelpers = budgetOverviewFormHelper
0856:                        .getBudgetOverviewPersonnelHelpers();
0857:                for (BudgetOverviewPersonnelHelper budgetOverviewPersonnelHelper : budgetOverviewPersonnelHelpers) {
0858:                    Element personElement = xmlDoc.createElement("PERSON");
0859:
0860:                    Element nameElement = xmlDoc.createElement("NAME");
0861:                    nameElement.appendChild(xmlDoc
0862:                            .createTextNode(budgetOverviewPersonnelHelper
0863:                                    .getPersonName()));
0864:                    personElement.appendChild(nameElement);
0865:
0866:                    Element roleElement = xmlDoc.createElement("ROLE");
0867:                    roleElement
0868:                            .appendChild(xmlDoc.createTextNode(ObjectUtils
0869:                                    .toString(budgetOverviewPersonnelHelper
0870:                                            .getRole())));
0871:                    personElement.appendChild(roleElement);
0872:
0873:                    Element appointmentElement = xmlDoc
0874:                            .createElement("APPOINTMENT");
0875:                    appointmentElement.setAttribute("APPOINTMENT_TYPE",
0876:                            budgetOverviewPersonnelHelper
0877:                                    .getAppointmentTypeDescription());
0878:                    appointmentElement.setAttribute("APPOINTMENT_CODE",
0879:                            budgetOverviewPersonnelHelper
0880:                                    .getInstitutionAppointmentTypeCode());
0881:                    personElement.appendChild(appointmentElement);
0882:
0883:                    personElement
0884:                            .setAttribute(
0885:                                    "PROJECT_DIRECTOR",
0886:                                    ObjectUtils
0887:                                            .toString(
0888:                                                    budgetOverviewPersonnelHelper
0889:                                                            .isPersonProjectDirectorIndicator())
0890:                                            .toUpperCase());
0891:
0892:                    // CREATE_TIMESTAMP was dropped in KRA, it is replaced with this field
0893:                    personElement.setAttribute("SEQUENCE_NUMBER", ObjectUtils
0894:                            .toString(budgetOverviewPersonnelHelper
0895:                                    .getBudgetUserSequenceNumber()));
0896:
0897:                    personElement.setAttribute("PERIOD_SALARY",
0898:                            budgetOverviewPersonnelHelper
0899:                                    .getUserBudgetPeriodSalaryAmount());
0900:                    personElement
0901:                            .setAttribute(
0902:                                    "SUMMER_WEEKS",
0903:                                    budgetOverviewPersonnelHelper
0904:                                            .getPersonWeeksAmount() == null ? "0"
0905:                                            : ObjectUtils
0906:                                                    .toString(budgetOverviewPersonnelHelper
0907:                                                            .getPersonWeeksAmount()));
0908:
0909:                    personElement.setAttribute("AGENCY_PERCENT_SALARY",
0910:                            ObjectUtils.toString(budgetOverviewPersonnelHelper
0911:                                    .getAgencyPercentEffortAmount())
0912:                                    + OUTPUT_PERCENT_SYMBOL);
0913:                    personElement.setAttribute("AGENCY_HOURS", ObjectUtils
0914:                            .toString(budgetOverviewPersonnelHelper
0915:                                    .getUserAgencyHours()));
0916:                    personElement.setAttribute("AGENCY_AMOUNT_SALARY",
0917:                            ObjectUtils.toString(budgetOverviewPersonnelHelper
0918:                                    .getAgencyRequestTotalAmount()));
0919:                    personElement
0920:                            .setAttribute(
0921:                                    "INSTITUTION_PERCENT_SALARY",
0922:                                    ObjectUtils
0923:                                            .toString(budgetOverviewPersonnelHelper
0924:                                                    .getInstitutionCostSharePercentEffortAmount())
0925:                                            + OUTPUT_PERCENT_SYMBOL);
0926:                    personElement.setAttribute("INSTITUTION_HOURS", ObjectUtils
0927:                            .toString(budgetOverviewPersonnelHelper
0928:                                    .getUserInstitutionHours()));
0929:                    personElement
0930:                            .setAttribute(
0931:                                    "INSTITUTION_AMOUNT_SALARY",
0932:                                    ObjectUtils
0933:                                            .toString(budgetOverviewPersonnelHelper
0934:                                                    .getInstitutionCostShareRequestTotalAmount()));
0935:                    personElement.setAttribute("AGENCY_FRINGE_BENEFIT_RATE",
0936:                            ObjectUtils.toString(budgetOverviewPersonnelHelper
0937:                                    .getContractsAndGrantsFringeRateAmount())
0938:                                    + OUTPUT_PERCENT_SYMBOL);
0939:                    personElement.setAttribute("AGENCY_FRINGE_BENEFIT_AMOUNT",
0940:                            ObjectUtils.toString(budgetOverviewPersonnelHelper
0941:                                    .getAgencyFringeBenefitTotalAmount()));
0942:                    personElement.setAttribute(
0943:                            "INSTITUTION_FRINGE_BENEFIT_RATE",
0944:                            ObjectUtils.toString(budgetOverviewPersonnelHelper
0945:                                    .getInstitutionCostShareFringeRateAmount())
0946:                                    + OUTPUT_PERCENT_SYMBOL);
0947:                    personElement
0948:                            .setAttribute(
0949:                                    "INSTITUTION_FRINGE_BENEFIT_AMOUNT",
0950:                                    ObjectUtils
0951:                                            .toString(budgetOverviewPersonnelHelper
0952:                                                    .getInstitutionCostShareFringeBenefitTotalAmount()));
0953:
0954:                    // Following calculation should probably be somewhere else.
0955:                    /** TODO Create App KFSConstants for the below or move into Personnel? Does it already exist there? */
0956:                    KualiInteger agencyPercentEffortAmount = budgetOverviewPersonnelHelper
0957:                            .getAgencyPercentEffortAmount() == null ? new KualiInteger(
0958:                            0)
0959:                            : budgetOverviewPersonnelHelper
0960:                                    .getAgencyPercentEffortAmount();
0961:                    KualiInteger institutionCostSharePercentEffortAmount = budgetOverviewPersonnelHelper
0962:                            .getInstitutionCostSharePercentEffortAmount() == null ? new KualiInteger(
0963:                            0)
0964:                            : budgetOverviewPersonnelHelper
0965:                                    .getInstitutionCostSharePercentEffortAmount();
0966:                    BigDecimal combinedPercentEffort = agencyPercentEffortAmount
0967:                            .add(institutionCostSharePercentEffortAmount)
0968:                            .divide(new KualiInteger(100));
0969:                    String calendarMonths = "";
0970:                    String academicMonths = "";
0971:                    String summerMonths = "";
0972:                    if (budgetOverviewFormHelper.FULL_YEAR_APPOINTMENTS
0973:                            .contains(budgetOverviewPersonnelHelper
0974:                                    .getInstitutionAppointmentTypeCode())
0975:                            || budgetOverviewFormHelper.GRADUATE_RA_APPOINTMENTS
0976:                                    .contains(budgetOverviewPersonnelHelper
0977:                                            .getInstitutionAppointmentTypeCode())) {
0978:                        BigDecimal personMonths = new BigDecimal(
0979:                                12 * combinedPercentEffort.doubleValue())
0980:                                .setScale(1, BigDecimal.ROUND_HALF_DOWN);
0981:                        calendarMonths = personMonths.toString();
0982:                    } else if (budgetOverviewFormHelper.SUMMER_GRID_APPOINTMENT
0983:                            .contains(budgetOverviewPersonnelHelper
0984:                                    .getInstitutionAppointmentTypeCode())) {
0985:                        // AS
0986:                        BigDecimal personMonths = new BigDecimal(
0987:                                3 * combinedPercentEffort.doubleValue())
0988:                                .setScale(1, BigDecimal.ROUND_HALF_DOWN);
0989:                        summerMonths = personMonths.toString();
0990:                    } else if (budgetOverviewFormHelper.SUMMER_GRID_APPOINTMENTS
0991:                            .contains(budgetOverviewPersonnelHelper
0992:                                    .getInstitutionAppointmentTypeCode())) {
0993:                        // A2 & AS, note that AS got caught above though and it should. Just trying to avoid creating another application
0994:                        // constant
0995:                        // as personnel already uses this one.
0996:                        BigDecimal personMonths = new BigDecimal(
0997:                                9 * combinedPercentEffort.doubleValue())
0998:                                .setScale(1, BigDecimal.ROUND_HALF_DOWN);
0999:                        academicMonths = personMonths.toString();
1000:                    } else if (budgetOverviewFormHelper.HOURLY_APPOINTMENTS
1001:                            .contains(budgetOverviewPersonnelHelper
1002:                                    .getInstitutionAppointmentTypeCode())) {
1003:                        KualiInteger totalsHours = budgetOverviewPersonnelHelper
1004:                                .getUserAgencyHours().add(
1005:                                        budgetOverviewPersonnelHelper
1006:                                                .getUserInstitutionHours());
1007:
1008:                        // 173.33 = 2080 hours per year / 12 months
1009:                        calendarMonths = ""
1010:                                + totalsHours
1011:                                        .divide(new BigDecimal(173.33))
1012:                                        .setScale(1, BigDecimal.ROUND_HALF_DOWN);
1013:                    }
1014:                    personElement.setAttribute("CALENDAR_MONTHS",
1015:                            calendarMonths);
1016:                    personElement.setAttribute("ACADEMIC_MONTHS",
1017:                            academicMonths);
1018:                    personElement.setAttribute("SUMMER_MONTHS", summerMonths);
1019:
1020:                    personnelElement.appendChild(personElement);
1021:                }
1022:
1023:                personnelElement.setAttribute("TOTAL_AGENCY_SALARY",
1024:                        budgetOverviewFormHelper
1025:                                .getPersonnelSalaryAgencyRequest().toString());
1026:                personnelElement.setAttribute("TOTAL_AGENCY_FRINGE_BENEFITS",
1027:                        budgetOverviewFormHelper
1028:                                .getPersonnelFringeBenefitsAgencyRequest()
1029:                                .toString());
1030:                personnelElement.setAttribute("TOTAL_AGENCY_PERSONNEL",
1031:                        budgetOverviewFormHelper
1032:                                .getTotalPersonnelAgencyRequest().toString());
1033:                personnelElement.setAttribute("TOTAL_INSTITUTION_SALARY",
1034:                        budgetOverviewFormHelper
1035:                                .getPersonnelSalaryInstitutionCostShare()
1036:                                .toString());
1037:                personnelElement
1038:                        .setAttribute(
1039:                                "TOTAL_INSTITUTION_FRINGE_BENEFITS",
1040:                                budgetOverviewFormHelper
1041:                                        .getPersonnelFringeBenefitsInstitutionCostShare()
1042:                                        .toString());
1043:                personnelElement.setAttribute("TOTAL_INSTITUTION_PERSONNEL",
1044:                        budgetOverviewFormHelper
1045:                                .getTotalPersonnelInstitutionCostShare()
1046:                                .toString());
1047:
1048:                return personnelElement;
1049:            }
1050:
1051:            /**
1052:             * Creates NON_PERSONNEL node.
1053:             * 
1054:             * @param currentTask
1055:             * @param currentPeriod
1056:             * @param budgetNonpersonnelFormHelper
1057:             * @param budget
1058:             * @param xmlDoc
1059:             * @return resulting node
1060:             */
1061:            private static Element setupNonPersonnel(BudgetTask currentTask,
1062:                    BudgetPeriod currentPeriod,
1063:                    BudgetNonpersonnelFormHelper budgetNonpersonnelFormHelper,
1064:                    Budget budget, Document xmlDoc) {
1065:                Element nonpersonnelElement = xmlDoc
1066:                        .createElement("NON_PERSONNEL");
1067:                nonpersonnelElement.setAttribute(
1068:                        "TOTAL_AGENCY_REQUESTED_AMOUNT",
1069:                        budgetNonpersonnelFormHelper
1070:                                .getNonpersonnelAgencyTotal().toString());
1071:                nonpersonnelElement
1072:                        .setAttribute("TOTAL_INSTITUTION_COST_SHARE_AMOUNT",
1073:                                budgetNonpersonnelFormHelper
1074:                                        .getNonpersonnelUnivCostShareTotal()
1075:                                        .toString());
1076:                nonpersonnelElement.setAttribute(
1077:                        "TOTAL_THIRD_PARTY_COST_SHARE_AMOUNT",
1078:                        budgetNonpersonnelFormHelper
1079:                                .getNonpersonnelThirdPartyCostShareTotal()
1080:                                .toString());
1081:
1082:                for (Iterator iter = budget.getNonpersonnelItems().iterator(); iter
1083:                        .hasNext();) {
1084:                    BudgetNonpersonnel currentItem = (BudgetNonpersonnel) iter
1085:                            .next();
1086:
1087:                    if (currentPeriod.getBudgetPeriodSequenceNumber().equals(
1088:                            currentItem.getBudgetPeriodSequenceNumber())
1089:                            && currentTask
1090:                                    .getBudgetTaskSequenceNumber()
1091:                                    .equals(
1092:                                            currentItem
1093:                                                    .getBudgetTaskSequenceNumber())) {
1094:                        Element nonpersonnelItemElement = xmlDoc
1095:                                .createElement("NON_PERSONNEL_ITEM");
1096:
1097:                        Element categoryElement = xmlDoc
1098:                                .createElement("CATEGORY");
1099:                        categoryElement.appendChild(xmlDoc
1100:                                .createTextNode(currentItem
1101:                                        .getNonpersonnelObjectCode()
1102:                                        .getNonpersonnelCategory().getName()));
1103:                        nonpersonnelItemElement.appendChild(categoryElement);
1104:
1105:                        Element subCategoryElement = xmlDoc
1106:                                .createElement("SUB_CATEGORY");
1107:                        subCategoryElement
1108:                                .appendChild(xmlDoc
1109:                                        .createTextNode(currentItem
1110:                                                .getNonpersonnelObjectCode()
1111:                                                .getNonpersonnelSubCategory()
1112:                                                .getName()));
1113:                        nonpersonnelItemElement.appendChild(subCategoryElement);
1114:
1115:                        Element descriptionElement = xmlDoc
1116:                                .createElement("DESCRIPTION");
1117:                        descriptionElement
1118:                                .appendChild(xmlDoc
1119:                                        .createTextNode(ObjectUtils
1120:                                                .toString(currentItem
1121:                                                        .getBudgetNonpersonnelDescription())));
1122:                        nonpersonnelItemElement.appendChild(descriptionElement);
1123:
1124:                        Element agencyRequestAmountElement = xmlDoc
1125:                                .createElement("AGENCY_REQUEST_AMOUNT");
1126:                        agencyRequestAmountElement.appendChild(xmlDoc
1127:                                .createTextNode(currentItem
1128:                                        .getAgencyRequestAmount().toString()));
1129:                        nonpersonnelItemElement
1130:                                .appendChild(agencyRequestAmountElement);
1131:
1132:                        Element institutionCostShareAmountElement = xmlDoc
1133:                                .createElement("INSTITUTION_COST_SHARE_AMOUNT");
1134:                        institutionCostShareAmountElement.appendChild(xmlDoc
1135:                                .createTextNode(currentItem
1136:                                        .getBudgetInstitutionCostShareAmount()
1137:                                        .toString()));
1138:                        nonpersonnelItemElement
1139:                                .appendChild(institutionCostShareAmountElement);
1140:
1141:                        Element thirdPartyCostShareAmountElement = xmlDoc
1142:                                .createElement("THIRD_PARTY_COST_SHARE_AMOUNT");
1143:                        thirdPartyCostShareAmountElement.appendChild(xmlDoc
1144:                                .createTextNode(currentItem
1145:                                        .getBudgetThirdPartyCostShareAmount()
1146:                                        .toString()));
1147:                        nonpersonnelItemElement
1148:                                .appendChild(thirdPartyCostShareAmountElement);
1149:
1150:                        nonpersonnelElement
1151:                                .appendChild(nonpersonnelItemElement);
1152:                    }
1153:                }
1154:                return nonpersonnelElement;
1155:            }
1156:
1157:            /**
1158:             * Creates INDIRECT_COST node.
1159:             * 
1160:             * @param budgetIndirectCostFormHelper
1161:             * @param budget
1162:             * @param xmlDoc
1163:             * @return resulting node
1164:             */
1165:            private static Element createIndirectCostElement(
1166:                    BudgetIndirectCostFormHelper budgetIndirectCostFormHelper,
1167:                    Budget budget, Document xmlDoc) {
1168:                Element indirectCostElement = xmlDoc
1169:                        .createElement("INDIRECT_COST");
1170:                indirectCostElement.setAttribute("BASE_TYPE", budget
1171:                        .getIndirectCost().getBudgetBaseCode());
1172:                if (KraConstants.DATABASE_TRUE_VALUE.equals(budget
1173:                        .getIndirectCost().getBudgetManualRateIndicator())) {
1174:                    indirectCostElement.setAttribute("IDC_RATE", "MANUAL");
1175:                } else {
1176:                    indirectCostElement.setAttribute("IDC_RATE", "SYSTEM");
1177:                }
1178:
1179:                for (int i = 0; i < budget.getTasks().size(); i++) {
1180:                    Element indirectCostTaskElement = xmlDoc
1181:                            .createElement("INDIRECT_COST_TASK");
1182:                    indirectCostTaskElement.setAttribute("TASK_NUMBER", Integer
1183:                            .toString(i + 1));
1184:
1185:                    for (int j = 0; j < budget.getPeriods().size(); j++) {
1186:                        Element indirectCostTaskPeriodElement = xmlDoc
1187:                                .createElement("INDIRECT_COST_TASK_PERIOD");
1188:                        indirectCostTaskPeriodElement.setAttribute(
1189:                                "PERIOD_NUMBER", Integer.toString(j + 1));
1190:
1191:                        // Pick the correct task / period item.
1192:                        BudgetTaskPeriodIndirectCost indirectCostItem = null;
1193:                        for (Iterator indirectCostItemsIter = budget
1194:                                .getIndirectCost()
1195:                                .getBudgetTaskPeriodIndirectCostItems()
1196:                                .iterator(); indirectCostItemsIter.hasNext();) {
1197:                            indirectCostItem = (BudgetTaskPeriodIndirectCost) indirectCostItemsIter
1198:                                    .next();
1199:
1200:                            if (indirectCostItem
1201:                                    .getBudgetTaskSequenceNumber()
1202:                                    .equals(
1203:                                            budget
1204:                                                    .getTask(i)
1205:                                                    .getBudgetTaskSequenceNumber())
1206:                                    && indirectCostItem
1207:                                            .getBudgetPeriodSequenceNumber()
1208:                                            .equals(
1209:                                                    budget
1210:                                                            .getPeriod(j)
1211:                                                            .getBudgetPeriodSequenceNumber())) {
1212:                                break;
1213:                            }
1214:                        }
1215:
1216:                        indirectCostTaskPeriodElement.setAttribute("RATE",
1217:                                ObjectUtils.toString(indirectCostItem
1218:                                        .getIndirectCostRate())
1219:                                        + OUTPUT_PERCENT_SYMBOL);
1220:
1221:                        createIndirectCostElementHelper(
1222:                                "INDIRECT_COST_TASK_PERIOD_AGENCY_AMOUNT",
1223:                                "INDIRECT_COST_TASK_PERIOD_INSTITUTION",
1224:                                xmlDoc, indirectCostTaskPeriodElement,
1225:                                indirectCostItem);
1226:
1227:                        indirectCostTaskElement
1228:                                .appendChild(indirectCostTaskPeriodElement);
1229:                    }
1230:
1231:                    Element indirectCostTaskSubtotalElement = xmlDoc
1232:                            .createElement("INDIRECT_COST_TASK_SUBTOTAL");
1233:
1234:                    createIndirectCostElementHelper(
1235:                            "INDIRECT_COST_TASK_SUBTOTAL_AGENCY_AMOUNT",
1236:                            "INDIRECT_COST_TASK_SUBTOTAL_INSTITUTION",
1237:                            xmlDoc,
1238:                            indirectCostTaskSubtotalElement,
1239:                            (BudgetTaskPeriodIndirectCost) budgetIndirectCostFormHelper
1240:                                    .getTaskTotals().get(i));
1241:
1242:                    indirectCostTaskElement
1243:                            .appendChild(indirectCostTaskSubtotalElement);
1244:                    indirectCostElement.appendChild(indirectCostTaskElement);
1245:                }
1246:
1247:                Element indirectCostSummaryElement = xmlDoc
1248:                        .createElement("INDIRECT_COST_SUMMARY");
1249:
1250:                for (int i = 0; i < budget.getPeriods().size(); i++) {
1251:                    Element indirectCostSummaryPeriodElement = xmlDoc
1252:                            .createElement("INDIRECT_COST_SUMMARY_PERIOD");
1253:                    indirectCostSummaryPeriodElement.setAttribute(
1254:                            "PERIOD_NUMBER", Integer.toString(i + 1));
1255:
1256:                    createIndirectCostElementHelper(
1257:                            "INDIRECT_COST_SUMMARY_PERIOD_AGENCY_AMOUNT",
1258:                            "INDIRECT_COST_SUMMARY_PERIOD_INSTITUTION",
1259:                            xmlDoc,
1260:                            indirectCostSummaryPeriodElement,
1261:                            (BudgetTaskPeriodIndirectCost) budgetIndirectCostFormHelper
1262:                                    .getPeriodTotals().get(i));
1263:
1264:                    indirectCostSummaryElement
1265:                            .appendChild(indirectCostSummaryPeriodElement);
1266:                }
1267:
1268:                Element indirectCostSummaryTotalElement = xmlDoc
1269:                        .createElement("INDIRECT_COST_SUMMARY_TOTAL");
1270:
1271:                createIndirectCostElementHelper(
1272:                        "INDIRECT_COST_SUMMARY_TOTAL_AGENCY_AMOUNT",
1273:                        "INDIRECT_COST_SUMMARY_TOTAL_INSTITUTION", xmlDoc,
1274:                        indirectCostSummaryTotalElement,
1275:                        budgetIndirectCostFormHelper.getPeriodSubTotal());
1276:
1277:                indirectCostSummaryElement
1278:                        .appendChild(indirectCostSummaryTotalElement);
1279:                indirectCostElement.appendChild(indirectCostSummaryElement);
1280:
1281:                return indirectCostElement;
1282:            }
1283:
1284:            /**
1285:             * Helper for INDIRECT_COST node (createIndirectCostElement). Side effecting on indirectCostTaskPeriodElement argument.
1286:             * 
1287:             * @param agencyAmountLabel
1288:             * @param institutionAmountLabel
1289:             * @param xmlDoc
1290:             * @param indirectCostTaskPeriodElement
1291:             * @param indirectCostItem
1292:             */
1293:            private static void createIndirectCostElementHelper(
1294:                    String agencyAmountLabel, String institutionAmountLabel,
1295:                    Document xmlDoc, Element indirectCostTaskPeriodElement,
1296:                    BudgetTaskPeriodIndirectCost indirectCostItem) {
1297:                Element indirectCostTaskPeriodAgencyAmountElement = xmlDoc
1298:                        .createElement(agencyAmountLabel);
1299:
1300:                Element tdcElement = xmlDoc.createElement("TDC");
1301:                tdcElement.appendChild(xmlDoc.createTextNode(ObjectUtils
1302:                        .toString(indirectCostItem.getTotalDirectCost())));
1303:                indirectCostTaskPeriodAgencyAmountElement
1304:                        .appendChild(tdcElement);
1305:
1306:                Element agencyBaseElement = xmlDoc.createElement("AGENCY_BASE");
1307:                agencyBaseElement.appendChild(xmlDoc.createTextNode(ObjectUtils
1308:                        .toString(indirectCostItem.getBaseCost())));
1309:                indirectCostTaskPeriodAgencyAmountElement
1310:                        .appendChild(agencyBaseElement);
1311:
1312:                Element agencyCalculatedIndirectCostElement = xmlDoc
1313:                        .createElement("AGENCY_CALCULATED_INDIRECT_COST");
1314:                agencyCalculatedIndirectCostElement.appendChild(xmlDoc
1315:                        .createTextNode(ObjectUtils.toString(indirectCostItem
1316:                                .getCalculatedIndirectCost())));
1317:                indirectCostTaskPeriodAgencyAmountElement
1318:                        .appendChild(agencyCalculatedIndirectCostElement);
1319:
1320:                indirectCostTaskPeriodElement
1321:                        .appendChild(indirectCostTaskPeriodAgencyAmountElement);
1322:
1323:                Element indirectCostTaskPeriodInstitutionElement = xmlDoc
1324:                        .createElement(institutionAmountLabel);
1325:
1326:                Element institutionBaseElement = xmlDoc
1327:                        .createElement("INSTITUTION_BASE");
1328:                institutionBaseElement.appendChild(xmlDoc
1329:                        .createTextNode(ObjectUtils.toString(indirectCostItem
1330:                                .getCostShareBaseCost())));
1331:                indirectCostTaskPeriodInstitutionElement
1332:                        .appendChild(institutionBaseElement);
1333:
1334:                Element institutionCalculatedIndirectCostElement = xmlDoc
1335:                        .createElement("INSTITUTION_CALCULATED_INDIRECT_COST");
1336:                institutionCalculatedIndirectCostElement.appendChild(xmlDoc
1337:                        .createTextNode(ObjectUtils.toString(indirectCostItem
1338:                                .getCostShareCalculatedIndirectCost())));
1339:                indirectCostTaskPeriodInstitutionElement
1340:                        .appendChild(institutionCalculatedIndirectCostElement);
1341:
1342:                Element unrecoveredIndirectCostElement = xmlDoc
1343:                        .createElement("UNRECOVERED_INDIRECT_COST");
1344:                unrecoveredIndirectCostElement.appendChild(xmlDoc
1345:                        .createTextNode(ObjectUtils.toString(indirectCostItem
1346:                                .getCostShareUnrecoveredIndirectCost())));
1347:                indirectCostTaskPeriodInstitutionElement
1348:                        .appendChild(unrecoveredIndirectCostElement);
1349:
1350:                indirectCostTaskPeriodElement
1351:                        .appendChild(indirectCostTaskPeriodInstitutionElement);
1352:            }
1353:
1354:            /**
1355:             * Creates MODULAR_BUDGET node.
1356:             * 
1357:             * @param budget
1358:             * @param xmlDoc
1359:             * @return resulting node
1360:             */
1361:            private static Element createModularBudgetElement(Budget budget,
1362:                    Document xmlDoc) {
1363:                Element modularBudgetElement = xmlDoc
1364:                        .createElement("MODULAR_BUDGET");
1365:
1366:                if (budget.isAgencyModularIndicator()) {
1367:                    BudgetModular budgetModular = (BudgetModular) budget
1368:                            .getModularBudget();
1369:
1370:                    Element modularBudgetPeriodsElement = xmlDoc
1371:                            .createElement("MODULAR_BUDGET_PERIODS");
1372:                    Iterator budgetModularIter = budgetModular
1373:                            .getBudgetModularPeriods().iterator();
1374:                    for (int i = 0; budgetModularIter.hasNext(); i++) {
1375:                        BudgetModularPeriod budgetModularPeriod = (BudgetModularPeriod) budgetModularIter
1376:                                .next();
1377:                        Element modularBudgetPeriod = xmlDoc
1378:                                .createElement("MODULAR_BUDGET_PERIOD");
1379:                        modularBudgetPeriod.setAttribute("PERIOD_NUMBER",
1380:                                Integer.toString(i + 1));
1381:
1382:                        Element modularDirectCost = xmlDoc
1383:                                .createElement("MODULAR_DIRECT_COST");
1384:                        modularDirectCost
1385:                                .appendChild(xmlDoc
1386:                                        .createTextNode(budgetModularPeriod
1387:                                                .getActualDirectCostAmount()
1388:                                                .toString()));
1389:                        modularBudgetPeriod.appendChild(modularDirectCost);
1390:
1391:                        Element adjustedModularDirectCost = xmlDoc
1392:                                .createElement("ADJUSTED_MODULAR_DIRECT_COST");
1393:                        adjustedModularDirectCost
1394:                                .appendChild(xmlDoc
1395:                                        .createTextNode(budgetModularPeriod
1396:                                                .getBudgetAdjustedModularDirectCostAmount()
1397:                                                .toString()));
1398:                        modularBudgetPeriod
1399:                                .appendChild(adjustedModularDirectCost);
1400:
1401:                        Element modularAdjustment = xmlDoc
1402:                                .createElement("MODULAR_ADJUSTMENT");
1403:                        modularAdjustment.appendChild(xmlDoc
1404:                                .createTextNode(ObjectUtils
1405:                                        .toString(budgetModularPeriod
1406:                                                .getModularVarianceAmount())));
1407:                        modularBudgetPeriod.appendChild(modularAdjustment);
1408:
1409:                        modularBudgetPeriodsElement
1410:                                .appendChild(modularBudgetPeriod);
1411:                    }
1412:                    modularBudgetElement
1413:                            .appendChild(modularBudgetPeriodsElement);
1414:
1415:                    Element modularBudgetDescriptionsElement = xmlDoc
1416:                            .createElement("MODULAR_BUDGET_DESCRIPTIONS");
1417:
1418:                    Element modularBudgetPersonnelDescriptionElement = xmlDoc
1419:                            .createElement("MODULAR_BUDGET_PERSONNEL_DESCRIPTION");
1420:                    modularBudgetPersonnelDescriptionElement.appendChild(xmlDoc
1421:                            .createTextNode(ObjectUtils.toString(budgetModular
1422:                                    .getBudgetModularPersonnelDescription())));
1423:                    modularBudgetDescriptionsElement
1424:                            .appendChild(modularBudgetPersonnelDescriptionElement);
1425:
1426:                    Element modularBudgetConsortiumDescriptionElement = xmlDoc
1427:                            .createElement("MODULAR_BUDGET_CONSORTIUM_DESCRIPTION");
1428:                    modularBudgetConsortiumDescriptionElement
1429:                            .appendChild(xmlDoc
1430:                                    .createTextNode(ObjectUtils
1431:                                            .toString(budgetModular
1432:                                                    .getBudgetModularConsortiumDescription())));
1433:                    modularBudgetDescriptionsElement
1434:                            .appendChild(modularBudgetConsortiumDescriptionElement);
1435:
1436:                    Element modularBudgetVariableAdjustmentDescriptionElement = xmlDoc
1437:                            .createElement("MODULAR_BUDGET_VARIABLE_ADJUSTMENT_DESCRIPTION");
1438:                    modularBudgetVariableAdjustmentDescriptionElement
1439:                            .appendChild(xmlDoc
1440:                                    .createTextNode(ObjectUtils
1441:                                            .toString(budgetModular
1442:                                                    .getBudgetModularVariableAdjustmentDescription())));
1443:                    modularBudgetDescriptionsElement
1444:                            .appendChild(modularBudgetVariableAdjustmentDescriptionElement);
1445:
1446:                    modularBudgetElement
1447:                            .appendChild(modularBudgetDescriptionsElement);
1448:                }
1449:
1450:                return modularBudgetElement;
1451:            }
1452:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.