Source Code Cross Referenced for BudgetOverviewFormHelper.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » kra » budget » web » struts » form » 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.web.struts.form 
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.web.struts.form;
0017:
0018:        import java.util.ArrayList;
0019:        import java.util.Collections;
0020:        import java.util.Iterator;
0021:        import java.util.List;
0022:
0023:        import org.apache.commons.lang.ObjectUtils;
0024:        import org.kuali.core.util.KualiDecimal;
0025:        import org.kuali.core.util.KualiInteger;
0026:        import org.kuali.kfs.context.SpringContext;
0027:        import org.kuali.kfs.service.ParameterService;
0028:        import org.kuali.kfs.service.impl.ParameterConstants;
0029:        import org.kuali.module.kra.KraConstants;
0030:        import org.kuali.module.kra.budget.bo.Budget;
0031:        import org.kuali.module.kra.budget.bo.BudgetModular;
0032:        import org.kuali.module.kra.budget.bo.BudgetModularPeriod;
0033:        import org.kuali.module.kra.budget.bo.BudgetNonpersonnel;
0034:        import org.kuali.module.kra.budget.bo.BudgetPeriod;
0035:        import org.kuali.module.kra.budget.bo.BudgetTask;
0036:        import org.kuali.module.kra.budget.bo.BudgetTaskPeriodIndirectCost;
0037:        import org.kuali.module.kra.budget.bo.BudgetUser;
0038:        import org.kuali.module.kra.budget.bo.UserAppointmentTask;
0039:        import org.kuali.module.kra.budget.bo.UserAppointmentTaskPeriod;
0040:        import org.kuali.module.kra.budget.document.BudgetDocument;
0041:        import org.kuali.module.kra.budget.service.BudgetIndirectCostService;
0042:        import org.kuali.module.kra.budget.service.BudgetModularService;
0043:        import org.kuali.module.kra.budget.service.BudgetPeriodService;
0044:        import org.kuali.module.kra.budget.service.BudgetTaskService;
0045:        import org.kuali.module.kra.budget.web.struts.action.BudgetAction;
0046:
0047:        /**
0048:         * This is used by the UI to get totals, counts, and other things needed to render the page properly.
0049:         */
0050:        public class BudgetOverviewFormHelper {
0051:
0052:            // No getters for the following fields since they are only needed locally for initialization
0053:            private final String TO_BE_NAMED;
0054:            public final List HOURLY_APPOINTMENTS;
0055:            public final List GRADUATE_RA_APPOINTMENTS;
0056:            public final List FULL_YEAR_APPOINTMENTS;
0057:            public final String SUMMER_GRID_APPOINTMENT;
0058:            public final List SUMMER_GRID_APPOINTMENTS;
0059:
0060:            public final String GRADUATE_ASSISTANT_NONPERSONNEL_CATEGORY_CODE;
0061:            public final String GRADUATE_ASSISTANT_NONPERSONNEL_SUBCATEGORY_CODE;
0062:            public final String GRADUATE_ASSISTANT_NONPERSONNEL_DESCRIPTION;
0063:
0064:            // Helper objects
0065:            private List<BudgetOverviewPersonnelHelper> budgetOverviewPersonnelHelpers = new ArrayList<BudgetOverviewPersonnelHelper>();
0066:            private BudgetTaskPeriodIndirectCost indirectCostItem = new BudgetTaskPeriodIndirectCost();
0067:            private KualiInteger modularBudgetTotalConsortiumAmount;
0068:
0069:            // Personnel Expenses -- initialized to 0 for easy of summation in setupPersonnel
0070:            private KualiInteger personnelSalaryAgencyRequest = new KualiInteger(
0071:                    0);
0072:            private KualiInteger personnelSalaryInstitutionCostShare = new KualiInteger(
0073:                    0);
0074:            private KualiInteger personnelFringeBenefitsAgencyRequest = new KualiInteger(
0075:                    0);
0076:            private KualiInteger personnelFringeBenefitsInstitutionCostShare = new KualiInteger(
0077:                    0);
0078:
0079:            // Total Direct Costs
0080:            private KualiInteger totalDirectCostsAgencyRequest;
0081:            private KualiInteger totalDirectCostsInstitutionCostShare;
0082:            private KualiInteger totalDirectThirdPartyCostShare;
0083:
0084:            // Modular
0085:            private boolean overviewShowModular;
0086:            private KualiInteger modularAdjustmentAgencyRequest;
0087:            private KualiInteger adjustedDirectCostsAgencyRequest;
0088:
0089:            // Total Costs
0090:            private KualiInteger totalCostsAgencyRequest;
0091:            private KualiInteger totalCostsInstitutionCostShare;
0092:            private KualiInteger totalCostsThirdPartyCostShare;
0093:
0094:            // What this instance of BudgetOverviewFormHelper represents
0095:            private BudgetPeriod budgetPeriod;
0096:            private BudgetTask budgetTask;
0097:
0098:            // Helper for use on RF Linking
0099:            private boolean selected;
0100:
0101:            /**
0102:             * Constructs a BudgetOverviewFormHelper. Sets necessary constants.
0103:             */
0104:            public BudgetOverviewFormHelper() {
0105:                ParameterService parameterService = SpringContext
0106:                        .getBean(ParameterService.class);
0107:                this .TO_BE_NAMED = parameterService
0108:                        .getParameterValue(
0109:                                ParameterConstants.RESEARCH_ADMINISTRATION_DOCUMENT.class,
0110:                                KraConstants.TO_BE_NAMED_LABEL);
0111:                this .HOURLY_APPOINTMENTS = parameterService
0112:                        .getParameterValues(
0113:                                BudgetDocument.class,
0114:                                KraConstants.KRA_BUDGET_PERSONNEL_HOURLY_APPOINTMENT_TYPES);
0115:                this .GRADUATE_RA_APPOINTMENTS = parameterService
0116:                        .getParameterValues(
0117:                                BudgetDocument.class,
0118:                                KraConstants.KRA_BUDGET_PERSONNEL_GRADUATE_RESEARCH_ASSISTANT_APPOINTMENT_TYPES);
0119:                this .FULL_YEAR_APPOINTMENTS = parameterService
0120:                        .getParameterValues(
0121:                                BudgetDocument.class,
0122:                                KraConstants.KRA_BUDGET_PERSONNEL_FULL_YEAR_APPOINTMENT_TYPES);
0123:                this .SUMMER_GRID_APPOINTMENT = parameterService
0124:                        .getParameterValue(
0125:                                BudgetDocument.class,
0126:                                KraConstants.KRA_BUDGET_PERSONNEL_SUMMER_GRID_APPOINTMENT_TYPE);
0127:                this .SUMMER_GRID_APPOINTMENTS = parameterService
0128:                        .getParameterValues(
0129:                                BudgetDocument.class,
0130:                                KraConstants.KRA_BUDGET_PERSONNEL_SUMMER_GRID_APPOINTMENT_TYPES);
0131:
0132:                this .GRADUATE_ASSISTANT_NONPERSONNEL_CATEGORY_CODE = parameterService
0133:                        .getParameterValue(
0134:                                ParameterConstants.RESEARCH_ADMINISTRATION_DOCUMENT.class,
0135:                                KraConstants.GRADUATE_ASSISTANT_NONPERSONNEL_CATEGORY_CODE);
0136:                this .GRADUATE_ASSISTANT_NONPERSONNEL_SUBCATEGORY_CODE = parameterService
0137:                        .getParameterValue(
0138:                                ParameterConstants.RESEARCH_ADMINISTRATION_DOCUMENT.class,
0139:                                KraConstants.GRADUATE_ASSISTANT_NONPERSONNEL_SUB_CATEGORY_CODE);
0140:                this .GRADUATE_ASSISTANT_NONPERSONNEL_DESCRIPTION = parameterService
0141:                        .getParameterValue(
0142:                                ParameterConstants.RESEARCH_ADMINISTRATION_DOCUMENT.class,
0143:                                KraConstants.GRADUATE_ASSISTANT_NONPERSONNEL_DESCRIPTION);
0144:            }
0145:
0146:            /**
0147:             * Constructs a BudgetOverviewFormHelper based on data extracted from a BudgetForm. Will add NonpersonnelCategories,
0148:             * BudgetNonpersonnelFormHelper, and BudgetIndirectCostFormHelper to BudgetForum. Runs
0149:             * BudgetModularService.generateModularBudget and BudgetIndirectCostService.refreshIndirectCost to satisfy requirements of
0150:             * recalculate which is called as the final step.
0151:             * 
0152:             * @param budgetForm
0153:             */
0154:            public BudgetOverviewFormHelper(BudgetForm budgetForm)
0155:                    throws Exception {
0156:                this ();
0157:
0158:                Budget budget = budgetForm.getBudgetDocument().getBudget();
0159:
0160:                // set up data that reculculate requires to run
0161:                BudgetAction.setupNonpersonnelCategories(budgetForm);
0162:                if (isOverviewShowModular(budgetForm.getCurrentTaskNumber(),
0163:                        budget)) {
0164:                    SpringContext.getBean(BudgetModularService.class)
0165:                            .generateModularBudget(budget,
0166:                                    budgetForm.getNonpersonnelCategories());
0167:                }
0168:                SpringContext.getBean(BudgetIndirectCostService.class)
0169:                        .refreshIndirectCost(budgetForm.getBudgetDocument());
0170:                budgetForm
0171:                        .setBudgetIndirectCostFormHelper(new BudgetIndirectCostFormHelper(
0172:                                budget.getTasks(), budget.getPeriods(), budget
0173:                                        .getIndirectCost()
0174:                                        .getBudgetTaskPeriodIndirectCostItems()));
0175:
0176:                budgetForm.setBudgetNonpersonnelFormHelper(recalculate(
0177:                        budgetForm.getCurrentTaskNumber(), budgetForm
0178:                                .getCurrentPeriodNumber(), budgetForm
0179:                                .getNonpersonnelCategories(), budgetForm
0180:                                .getBudgetIndirectCostFormHelper(), budget));
0181:            }
0182:
0183:            /**
0184:             * <p>
0185:             * Constructor for BudgetOverviewFormHelper with detailed argument list. Populars several interesting objects in class scope
0186:             * that may be used to reduce service calls. Could be changed to pass those local variables as arguments if that is needed.
0187:             * </p>
0188:             * <p>
0189:             * <b>Note that BudgetIndirectCostService.refreshIndirectCost and BudgetModularService.generateModularBudget has to have been
0190:             * called before this.</b>
0191:             * </p>
0192:             * 
0193:             * @param currentTaskNumber determines for which task the calculations should be performed.
0194:             * @param currentPeriodNumber determines for which period the calculations should be performed.
0195:             * @param nonpersonnelCategories passed to avoid refetching it from the DB when BudgetXml calls this for each task / period.
0196:             * @param budgetIndirectCostFormHelper passed to avoid refetching it from the DB when BudgetXml calls this for each task /
0197:             *        period.
0198:             * @param budget with refreshIndirectCost and generateModularBudget performed on.
0199:             * @return BudgetNonpersonnelFormHelper is returned with proper Fee Remission items from personnel (if applicable).
0200:             */
0201:            public BudgetNonpersonnelFormHelper recalculate(
0202:                    Integer currentTaskNumber, Integer currentPeriodNumber,
0203:                    List nonpersonnelCategories,
0204:                    BudgetIndirectCostFormHelper budgetIndirectCostFormHelper,
0205:                    Budget budget) {
0206:                overviewShowModular = isOverviewShowModular(currentTaskNumber,
0207:                        budget);
0208:                Integer currentTaskNumberIndex = SpringContext.getBean(
0209:                        BudgetTaskService.class).getTaskIndex(
0210:                        currentTaskNumber, budget.getTasks());
0211:                Integer currentPeriodNumberIndex = SpringContext.getBean(
0212:                        BudgetPeriodService.class).getPeriodIndex(
0213:                        currentPeriodNumber, budget.getPeriods());
0214:
0215:                // Used for the Personnel section, note this should be called before BudgetNonpersonnelFormHelper because it will add Fee
0216:                // Remission items to
0217:                // nonpersonnel for display only.
0218:                setupPersonnel(currentTaskNumber, currentPeriodNumber, budget
0219:                        .getPersonnel(), budget.getNonpersonnelItems());
0220:
0221:                // Used for the Nonpersonnel section - This needs to happen after setPersonnel so Fee Remissions from Grad Asst.
0222:                // Appointments are handled properly.
0223:                BudgetNonpersonnelFormHelper budgetNonpersonnelFormHelper = new BudgetNonpersonnelFormHelper(
0224:                        currentTaskNumber, currentPeriodNumber,
0225:                        nonpersonnelCategories, budget.getNonpersonnelItems(),
0226:                        true);
0227:
0228:                // Used for IDC section
0229:                setupIndirectCost(currentTaskNumber, currentPeriodNumber,
0230:                        currentTaskNumberIndex, currentPeriodNumberIndex,
0231:                        budgetIndirectCostFormHelper, budget);
0232:
0233:                // Used for Modular
0234:                if (overviewShowModular) {
0235:                    setupModular(currentPeriodNumber, currentPeriodNumberIndex,
0236:                            nonpersonnelCategories, budget.getModularBudget());
0237:                }
0238:
0239:                // Calculate total fields
0240:                setupTotals(overviewShowModular, budgetNonpersonnelFormHelper);
0241:
0242:                return budgetNonpersonnelFormHelper;
0243:            }
0244:
0245:            /**
0246:             * Loops over personnel and adds items that match the current task / period to budgetOverviewPersonnelHelpers. It will not add
0247:             * them if they don't have any percent-effort. It also update the total fields in this class. Finally it "rolls personnel up" if
0248:             * currentTaskNumber or currentPeriodNumber equal KraConstants.TASK_SUMMATION or KraConstants.PERIOD_SUMMATION.
0249:             * 
0250:             * @param currentTaskNumber
0251:             * @param currentPeriodNumber
0252:             * @param personnel
0253:             * @param nonpersonnel
0254:             */
0255:            private void setupPersonnel(Integer currentTaskNumber,
0256:                    Integer currentPeriodNumber, List<BudgetUser> personnel,
0257:                    List<BudgetNonpersonnel> nonpersonnel) {
0258:                // Ensure that project director appears first.
0259:                Collections.sort(personnel);
0260:
0261:                // loop over each person there is
0262:                for (Iterator personnelIter = personnel.iterator(); personnelIter
0263:                        .hasNext();) {
0264:                    BudgetUser budgetUser = (BudgetUser) personnelIter.next();
0265:
0266:                    // loop over each task / appointment
0267:                    for (Iterator userAppointmentTasksIter = budgetUser
0268:                            .getUserAppointmentTasks().iterator(); userAppointmentTasksIter
0269:                            .hasNext();) {
0270:                        UserAppointmentTask userAppointmentTask = (UserAppointmentTask) userAppointmentTasksIter
0271:                                .next();
0272:
0273:                        // check if this is part of the current task, ignore item if it isn't. If currentTaskNumber == 0 it's
0274:                        // a summary and we need to take them all.
0275:                        if (currentTaskNumber
0276:                                .equals(KraConstants.TASK_SUMMATION)
0277:                                || userAppointmentTask
0278:                                        .getBudgetTaskSequenceNumber().equals(
0279:                                                currentTaskNumber)) {
0280:
0281:                            // loop over each period
0282:                            for (Iterator userAppointmentTaskPeriodIter = userAppointmentTask
0283:                                    .getUserAppointmentTaskPeriods().iterator(); userAppointmentTaskPeriodIter
0284:                                    .hasNext();) {
0285:                                UserAppointmentTaskPeriod userAppointmentTaskPeriod = (UserAppointmentTaskPeriod) userAppointmentTaskPeriodIter
0286:                                        .next();
0287:
0288:                                // check if this is part of the
0289:                                // 1. Current Period (if 0 it's summary, take it all)
0290:                                // 2. Has positive %-effort
0291:                                // 2.1. Or has an hourly rate and # of hours (either agency or institution)
0292:                                // Ignore person if any condition not met.
0293:                                if ((currentPeriodNumber
0294:                                        .equals(KraConstants.PERIOD_SUMMATION) || userAppointmentTaskPeriod
0295:                                        .getBudgetPeriodSequenceNumber()
0296:                                        .equals(currentPeriodNumber))
0297:                                        && (userAppointmentTaskPeriod
0298:                                                .getAgencyPercentEffortAmount()
0299:                                                .isNonZero()
0300:                                                || userAppointmentTaskPeriod
0301:                                                        .getInstitutionCostSharePercentEffortAmount()
0302:                                                        .isNonZero()
0303:                                                || userAppointmentTaskPeriod
0304:                                                        .getAgencyFullTimeEquivalentPercent()
0305:                                                        .isNonZero()
0306:                                                || userAppointmentTaskPeriod
0307:                                                        .getInstitutionFullTimeEquivalentPercent()
0308:                                                        .isNonZero() || (userAppointmentTaskPeriod
0309:                                                .getUserHourlyRate()
0310:                                                .isNonZero() && (userAppointmentTaskPeriod
0311:                                                .getUserAgencyHours()
0312:                                                .isNonZero() || userAppointmentTaskPeriod
0313:                                                .getUserInstitutionHours()
0314:                                                .isNonZero())))) {
0315:                                    boolean itemAdded = false;
0316:                                    String budgetUserLabel = "";
0317:
0318:                                    // Item matched. Check if it this is some kind of summation.
0319:                                    if (currentTaskNumber
0320:                                            .equals(KraConstants.TASK_SUMMATION)
0321:                                            || currentPeriodNumber
0322:                                                    .equals(KraConstants.PERIOD_SUMMATION)) {
0323:                                        // check if already exists (uuid & role equals) and do aggregation if it does
0324:                                        for (Iterator lineItemsIter = budgetOverviewPersonnelHelpers
0325:                                                .iterator(); !itemAdded
0326:                                                && lineItemsIter.hasNext();) {
0327:                                            BudgetOverviewPersonnelHelper budgetOverviewBoHelper = (BudgetOverviewPersonnelHelper) lineItemsIter
0328:                                                    .next();
0329:                                            if (budgetOverviewBoHelper
0330:                                                    .getBudgetUserSequenceNumber()
0331:                                                    .equals(
0332:                                                            userAppointmentTaskPeriod
0333:                                                                    .getBudgetUserSequenceNumber())
0334:                                                    && budgetOverviewBoHelper
0335:                                                            .getInstitutionAppointmentTypeCode()
0336:                                                            .equals(
0337:                                                                    userAppointmentTaskPeriod
0338:                                                                            .getInstitutionAppointmentTypeCode())) {
0339:                                                budgetOverviewBoHelper
0340:                                                        .aggregation(userAppointmentTaskPeriod);
0341:                                                itemAdded = true;
0342:                                                budgetUserLabel = budgetOverviewBoHelper
0343:                                                        .getPersonName();
0344:                                            }
0345:                                        }
0346:                                    }
0347:
0348:                                    // if it was not found for aggregation, just add it
0349:                                    if (!itemAdded) {
0350:                                        // Handle display of to be nameds' properly
0351:                                        if (budgetUser
0352:                                                .getPersonUniversalIdentifier() == null) {
0353:                                            budgetUserLabel = this .TO_BE_NAMED;
0354:                                        } else {
0355:                                            budgetUserLabel = budgetUser
0356:                                                    .getUser().getPersonName();
0357:                                        }
0358:
0359:                                        BudgetOverviewPersonnelHelper budgetOverviewBoHelper = new BudgetOverviewPersonnelHelper(
0360:                                                budgetUserLabel,
0361:                                                budgetUser.getRole(),
0362:                                                budgetUser
0363:                                                        .isPersonProjectDirectorIndicator(),
0364:                                                userAppointmentTaskPeriod);
0365:                                        budgetOverviewPersonnelHelpers
0366:                                                .add(budgetOverviewBoHelper);
0367:                                    }
0368:
0369:                                    // update totals. Calculate differently for Grad / Non grad. This is a bit duplicate since this if check
0370:                                    // is already twice done in the inner class. Unfortunatly there it's different checks and by the time
0371:                                    // the code reaches this place it's either an aggregation or an individual amount. Aggregation can't be
0372:                                    // used at this point. Thus the check is re-done. :(
0373:                                    if (GRADUATE_RA_APPOINTMENTS
0374:                                            .contains(userAppointmentTaskPeriod
0375:                                                    .getInstitutionAppointmentTypeCode())) {
0376:                                        this .personnelSalaryAgencyRequest = this .personnelSalaryAgencyRequest
0377:                                                .add(userAppointmentTaskPeriod
0378:                                                        .getAgencySalaryAmount());
0379:                                        this .personnelSalaryInstitutionCostShare = this .personnelSalaryInstitutionCostShare
0380:                                                .add(userAppointmentTaskPeriod
0381:                                                        .getInstitutionSalaryAmount());
0382:                                        this .personnelFringeBenefitsAgencyRequest = this .personnelFringeBenefitsAgencyRequest
0383:                                                .add(userAppointmentTaskPeriod
0384:                                                        .getAgencyHealthInsuranceAmount());
0385:                                        this .personnelFringeBenefitsInstitutionCostShare = this .personnelFringeBenefitsInstitutionCostShare
0386:                                                .add(userAppointmentTaskPeriod
0387:                                                        .getInstitutionHealthInsuranceAmount());
0388:
0389:                                        // If it is a GA, we need to add Nonpersonnel Fee Remission (this is done always, even if the values
0390:                                        // are 0).
0391:                                        String budgetNonpersonnelDescription = String
0392:                                                .format(
0393:                                                        this .GRADUATE_ASSISTANT_NONPERSONNEL_DESCRIPTION,
0394:                                                        budgetUserLabel,
0395:                                                        userAppointmentTaskPeriod
0396:                                                                .getUserCreditHoursNumber()
0397:                                                                .doubleValue(),
0398:                                                        userAppointmentTaskPeriod
0399:                                                                .getUserCreditHourAmount()
0400:                                                                .doubleValue(),
0401:                                                        userAppointmentTaskPeriod
0402:                                                                .getUserMiscellaneousFeeAmount()
0403:                                                                .intValue());
0404:                                        BudgetNonpersonnel budgetNonpersonnel = new BudgetNonpersonnel(
0405:                                                userAppointmentTaskPeriod
0406:                                                        .getBudgetTaskSequenceNumber(),
0407:                                                userAppointmentTaskPeriod
0408:                                                        .getBudgetPeriodSequenceNumber(),
0409:                                                this .GRADUATE_ASSISTANT_NONPERSONNEL_CATEGORY_CODE,
0410:                                                this .GRADUATE_ASSISTANT_NONPERSONNEL_SUBCATEGORY_CODE,
0411:                                                budgetNonpersonnelDescription,
0412:                                                userAppointmentTaskPeriod
0413:                                                        .getAgencyRequestedFeesAmount(),
0414:                                                userAppointmentTaskPeriod
0415:                                                        .getInstitutionRequestedFeesAmount());
0416:                                        budgetNonpersonnel
0417:                                                .refreshReferenceObject("nonpersonnelObjectCode");
0418:                                        budgetNonpersonnel
0419:                                                .getNonpersonnelObjectCode()
0420:                                                .refreshReferenceObject(
0421:                                                        "nonpersonnelSubCategory");
0422:
0423:                                        nonpersonnel.add(budgetNonpersonnel);
0424:                                    } else {
0425:                                        this .personnelSalaryAgencyRequest = this .personnelSalaryAgencyRequest
0426:                                                .add(userAppointmentTaskPeriod
0427:                                                        .getAgencyRequestTotalAmount());
0428:                                        this .personnelSalaryInstitutionCostShare = this .personnelSalaryInstitutionCostShare
0429:                                                .add(userAppointmentTaskPeriod
0430:                                                        .getInstitutionCostShareRequestTotalAmount());
0431:                                        this .personnelFringeBenefitsAgencyRequest = this .personnelFringeBenefitsAgencyRequest
0432:                                                .add(userAppointmentTaskPeriod
0433:                                                        .getAgencyFringeBenefitTotalAmount());
0434:                                        this .personnelFringeBenefitsInstitutionCostShare = this .personnelFringeBenefitsInstitutionCostShare
0435:                                                .add(userAppointmentTaskPeriod
0436:                                                        .getInstitutionCostShareFringeBenefitTotalAmount());
0437:                                    }
0438:                                }
0439:                            }
0440:                        }
0441:                    }
0442:                }
0443:            }
0444:
0445:            /**
0446:             * Sets the indirectCostItems in class scope for the current task / period (per BudgetForm.currentTask/Period). It also
0447:             * initializes IDC data in budgetForm.
0448:             * 
0449:             * @param currentTaskNumber
0450:             * @param currentPeriodNumber
0451:             * @param currentTaskNumberIndex
0452:             * @param currentPeriodNumberIndex
0453:             * @param budgetIndirectCostFormHelper
0454:             * @param budget
0455:             */
0456:            private void setupIndirectCost(Integer currentTaskNumber,
0457:                    Integer currentPeriodNumber,
0458:                    Integer currentTaskNumberIndex,
0459:                    Integer currentPeriodNumberIndex,
0460:                    BudgetIndirectCostFormHelper budgetIndirectCostFormHelper,
0461:                    Budget budget) {
0462:                if (KraConstants.TASK_SUMMATION.equals(currentTaskNumber)
0463:                        && KraConstants.PERIOD_SUMMATION
0464:                                .equals(currentPeriodNumber)) {
0465:                    // Summary / Summary
0466:                    indirectCostItem = budgetIndirectCostFormHelper
0467:                            .getPeriodSubTotal();
0468:                } else if (KraConstants.TASK_SUMMATION
0469:                        .equals(currentTaskNumber)) {
0470:                    // Task Summation
0471:                    indirectCostItem = (BudgetTaskPeriodIndirectCost) budgetIndirectCostFormHelper
0472:                            .getPeriodTotals().get(currentPeriodNumberIndex);
0473:                } else if (KraConstants.PERIOD_SUMMATION
0474:                        .equals(currentPeriodNumber)) {
0475:                    // Period Summation
0476:                    indirectCostItem = (BudgetTaskPeriodIndirectCost) budgetIndirectCostFormHelper
0477:                            .getTaskTotals().get(currentTaskNumberIndex);
0478:                } else {
0479:                    // Individual Task / Period
0480:                    for (Iterator indirectCostItemsIter = budget
0481:                            .getIndirectCost()
0482:                            .getBudgetTaskPeriodIndirectCostItems().iterator(); indirectCostItemsIter
0483:                            .hasNext();) {
0484:                        indirectCostItem = (BudgetTaskPeriodIndirectCost) indirectCostItemsIter
0485:                                .next();
0486:
0487:                        if (indirectCostItem.getBudgetTaskSequenceNumber()
0488:                                .equals(currentTaskNumber)
0489:                                && indirectCostItem
0490:                                        .getBudgetPeriodSequenceNumber()
0491:                                        .equals(currentPeriodNumber)) {
0492:                            break;
0493:                        }
0494:                    }
0495:                }
0496:            }
0497:
0498:            /**
0499:             * Extracts modular amounts from business objects or if this is not modular budget it just sets the total costs. Note that
0500:             * BudgetModularService.generateModularBudget has to have been called before this.
0501:             * 
0502:             * @param currentPeriodNumber
0503:             * @param currentPeriodNumberIndex
0504:             * @param nonpersonnelCategories
0505:             * @param budget
0506:             */
0507:            private void setupModular(Integer currentPeriodNumber,
0508:                    Integer currentPeriodNumberIndex,
0509:                    List nonpersonnelCategories, BudgetModular budgetModular) {
0510:                this .modularBudgetTotalConsortiumAmount = budgetModular
0511:                        .getTotalConsortiumAmount();
0512:
0513:                if (currentPeriodNumber.equals(KraConstants.PERIOD_SUMMATION)) {
0514:                    modularAdjustmentAgencyRequest = budgetModular
0515:                            .getTotalModularVarianceAmount();
0516:                    adjustedDirectCostsAgencyRequest = budgetModular
0517:                            .getTotalAdjustedModularDirectCostAmount();
0518:                } else {
0519:                    BudgetModularPeriod budgetModularPeriod = (BudgetModularPeriod) budgetModular
0520:                            .getBudgetModularPeriods().get(
0521:                                    currentPeriodNumberIndex);
0522:                    modularAdjustmentAgencyRequest = budgetModularPeriod
0523:                            .getModularVarianceAmount();
0524:                    adjustedDirectCostsAgencyRequest = budgetModularPeriod
0525:                            .getBudgetAdjustedModularDirectCostAmount();
0526:                }
0527:
0528:                // if modular is in invalid mode then adjustedDirectCostsAgencyRequest == null, to avoid NPE we check it.
0529:                if (adjustedDirectCostsAgencyRequest == null) {
0530:                    adjustedDirectCostsAgencyRequest = new KualiInteger(0);
0531:                }
0532:            }
0533:
0534:            /**
0535:             * Most totals can be calculated on the fly with simple getters. The totals in this method though depend on objects that are not
0536:             * stored in BudgetOverviewFormHelper. So rather then storing those objects, the amounts are just extracted, calculated and set
0537:             * within this helper. The other advantage is that this seperates the values from where they come from which centralizes how
0538:             * they are calculated. That is what this method does.
0539:             * 
0540:             * @param showModular affects total calculation
0541:             * @param budgetNonpersonnelFormHelper
0542:             */
0543:            private void setupTotals(boolean overviewShowModular,
0544:                    BudgetNonpersonnelFormHelper budgetNonpersonnelFormHelper) {
0545:                totalDirectCostsAgencyRequest = this 
0546:                        .getTotalPersonnelAgencyRequest().add(
0547:                                budgetNonpersonnelFormHelper
0548:                                        .getNonpersonnelAgencyTotal());
0549:                totalDirectCostsInstitutionCostShare = getTotalPersonnelInstitutionCostShare()
0550:                        .add(
0551:                                budgetNonpersonnelFormHelper
0552:                                        .getNonpersonnelUnivCostShareTotal());
0553:                totalDirectThirdPartyCostShare = budgetNonpersonnelFormHelper
0554:                        .getNonpersonnelThirdPartyCostShareTotal();
0555:
0556:                if (overviewShowModular) {
0557:                    totalCostsAgencyRequest = adjustedDirectCostsAgencyRequest
0558:                            .add(indirectCostItem.getCalculatedIndirectCost())
0559:                            .add(this .modularBudgetTotalConsortiumAmount);
0560:                } else {
0561:                    totalCostsAgencyRequest = totalDirectCostsAgencyRequest
0562:                            .add(indirectCostItem.getCalculatedIndirectCost());
0563:                }
0564:
0565:                totalCostsInstitutionCostShare = personnelSalaryInstitutionCostShare
0566:                        .add(personnelFringeBenefitsInstitutionCostShare).add(
0567:                                budgetNonpersonnelFormHelper
0568:                                        .getNonpersonnelUnivCostShareTotal())
0569:                        .add(
0570:                                indirectCostItem
0571:                                        .getCostShareCalculatedIndirectCost());
0572:
0573:                totalCostsThirdPartyCostShare = budgetNonpersonnelFormHelper
0574:                        .getNonpersonnelThirdPartyCostShareTotal();
0575:            }
0576:
0577:            public BudgetTaskPeriodIndirectCost getIndirectCostItem() {
0578:                return indirectCostItem;
0579:            }
0580:
0581:            public void setIndirectCostItem(
0582:                    BudgetTaskPeriodIndirectCost indirectCostItem) {
0583:                this .indirectCostItem = indirectCostItem;
0584:            }
0585:
0586:            /**
0587:             * Decides whether overview should show modular sections or not.
0588:             * 
0589:             * @param currentTaskNumber
0590:             * @param budget
0591:             * @return whether overview page should show modular or not
0592:             */
0593:            private boolean isOverviewShowModular(Integer currentTaskNumber,
0594:                    Budget budget) {
0595:                return budget.isAgencyModularIndicator()
0596:                        && (currentTaskNumber
0597:                                .equals(KraConstants.TASK_SUMMATION) || budget
0598:                                .getTasks().size() == 1);
0599:            }
0600:
0601:            /**
0602:             * Convenience method for Overview total personnel line.
0603:             * 
0604:             * @return Returns totalPersonnelAgencyRequest.
0605:             */
0606:            public KualiInteger getTotalPersonnelAgencyRequest() {
0607:                return this .personnelSalaryAgencyRequest
0608:                        .add(personnelFringeBenefitsAgencyRequest);
0609:            }
0610:
0611:            /**
0612:             * Convenience method for Overview total personnel line.
0613:             * 
0614:             * @return Returns totalPersonnelInstitutionCostShare.
0615:             */
0616:            public KualiInteger getTotalPersonnelInstitutionCostShare() {
0617:                return this .personnelSalaryInstitutionCostShare
0618:                        .add(personnelFringeBenefitsInstitutionCostShare);
0619:            }
0620:
0621:            /**
0622:             * Convenience method for Overview total indirect costs line.
0623:             * 
0624:             * @return Returns totalIndirectCostsAgencyRequest.
0625:             */
0626:            public KualiInteger getTotalIndirectCostsAgencyRequest() {
0627:                return indirectCostItem.getCalculatedIndirectCost();
0628:            }
0629:
0630:            /**
0631:             * Convenience method for Overview total indirect costs line.
0632:             * 
0633:             * @return Returns totalIndirectCostsInstitutionCostShare.
0634:             */
0635:            public KualiInteger getTotalIndirectCostsInstitutionCostShare() {
0636:                return indirectCostItem.getCostShareCalculatedIndirectCost();
0637:            }
0638:
0639:            /**
0640:             * Convenience method for BudgetXml.
0641:             * 
0642:             * @return Returns totalIndirectCostsInstitutionCostShareUnrecovered.
0643:             */
0644:            public KualiInteger getTotalIndirectCostsInstitutionCostShareUnrecovered() {
0645:                return indirectCostItem.getCostShareUnrecoveredIndirectCost();
0646:            }
0647:
0648:            /**
0649:             * @return Returns the budgetOverviewPersonnelHelpers.
0650:             */
0651:            public List<BudgetOverviewPersonnelHelper> getBudgetOverviewPersonnelHelpers() {
0652:                return budgetOverviewPersonnelHelpers;
0653:            }
0654:
0655:            /**
0656:             * @param budgetOverviewPersonnelHelpers The budgetOverviewPersonnelHelpers to set.
0657:             */
0658:            public void setBudgetOverviewPersonnelHelpers(
0659:                    List<BudgetOverviewPersonnelHelper> lineItems) {
0660:                this .budgetOverviewPersonnelHelpers = lineItems;
0661:            }
0662:
0663:            /**
0664:             * @return Returns the personnelFringeBenefitsAgencyRequest.
0665:             */
0666:            public KualiInteger getPersonnelFringeBenefitsAgencyRequest() {
0667:                return personnelFringeBenefitsAgencyRequest;
0668:            }
0669:
0670:            /**
0671:             * @param personnelFringeBenefitsAgencyRequest The personnelFringeBenefitsAgencyRequest to set.
0672:             */
0673:            public void setPersonnelFringeBenefitsAgencyRequest(
0674:                    KualiInteger agencyFringeBenefitTotalAmount) {
0675:                this .personnelFringeBenefitsAgencyRequest = agencyFringeBenefitTotalAmount;
0676:            }
0677:
0678:            /**
0679:             * @return Returns the personnelSalaryAgencyRequest.
0680:             */
0681:            public KualiInteger getPersonnelSalaryAgencyRequest() {
0682:                return personnelSalaryAgencyRequest;
0683:            }
0684:
0685:            /**
0686:             * @param personnelSalaryAgencyRequest The personnelSalaryAgencyRequest to set.
0687:             */
0688:            public void setPersonnelSalaryAgencyRequest(
0689:                    KualiInteger agencyRequestTotalAmount) {
0690:                this .personnelSalaryAgencyRequest = agencyRequestTotalAmount;
0691:            }
0692:
0693:            /**
0694:             * @return Returns the personnelFringeBenefitsInstitutionCostShare.
0695:             */
0696:            public KualiInteger getPersonnelFringeBenefitsInstitutionCostShare() {
0697:                return personnelFringeBenefitsInstitutionCostShare;
0698:            }
0699:
0700:            /**
0701:             * @param personnelFringeBenefitsInstitutionCostShare The personnelFringeBenefitsInstitutionCostShare to set.
0702:             */
0703:            public void setPersonnelFringeBenefitsInstitutionCostShare(
0704:                    KualiInteger institutionCostShareFringeBenefitTotalAmount) {
0705:                this .personnelFringeBenefitsInstitutionCostShare = institutionCostShareFringeBenefitTotalAmount;
0706:            }
0707:
0708:            /**
0709:             * @return Returns the personnelSalaryInstitutionCostShare.
0710:             */
0711:            public KualiInteger getPersonnelSalaryInstitutionCostShare() {
0712:                return personnelSalaryInstitutionCostShare;
0713:            }
0714:
0715:            /**
0716:             * @param personnelSalaryInstitutionCostShare The personnelSalaryInstitutionCostShare to set.
0717:             */
0718:            public void setPersonnelSalaryInstitutionCostShare(
0719:                    KualiInteger institutionCostShareRequestTotalAmount) {
0720:                this .personnelSalaryInstitutionCostShare = institutionCostShareRequestTotalAmount;
0721:            }
0722:
0723:            /**
0724:             * @return Returns the totalDirectCostsInstitutionCostShare.
0725:             */
0726:            public KualiInteger getTotalDirectCostsInstitutionCostShare() {
0727:                return totalDirectCostsInstitutionCostShare;
0728:            }
0729:
0730:            /**
0731:             * @param totalDirectCostsInstitutionCostShare The totalDirectCostsInstitutionCostShare to set.
0732:             */
0733:            public void setTotalDirectCostsInstitutionCostShare(
0734:                    KualiInteger totalDirectCostsInstitutionCostShare) {
0735:                this .totalDirectCostsInstitutionCostShare = totalDirectCostsInstitutionCostShare;
0736:            }
0737:
0738:            /**
0739:             * @return Returns the adjustedDirectCostsAgencyRequest.
0740:             */
0741:            public KualiInteger getAdjustedDirectCostsAgencyRequest() {
0742:                return adjustedDirectCostsAgencyRequest;
0743:            }
0744:
0745:            /**
0746:             * @param adjustedDirectCostsAgencyRequest The adjustedDirectCostsAgencyRequest to set.
0747:             */
0748:            public void setAdjustedDirectCostsAgencyRequest(
0749:                    KualiInteger adjustedDirectCosts) {
0750:                this .adjustedDirectCostsAgencyRequest = adjustedDirectCosts;
0751:            }
0752:
0753:            /**
0754:             * @return Returns the modularAdjustmentAgencyRequest.
0755:             */
0756:            public KualiInteger getModularAdjustmentAgencyRequest() {
0757:                return modularAdjustmentAgencyRequest;
0758:            }
0759:
0760:            /**
0761:             * @param modularAdjustmentAgencyRequest The modularAdjustmentAgencyRequest to set.
0762:             */
0763:            public void setModularAdjustmentAgencyRequest(
0764:                    KualiInteger modularAdjustment) {
0765:                this .modularAdjustmentAgencyRequest = modularAdjustment;
0766:            }
0767:
0768:            /**
0769:             * @return Returns the totalCostsAgencyRequest.
0770:             */
0771:            public KualiInteger getTotalCostsAgencyRequest() {
0772:                return totalCostsAgencyRequest;
0773:            }
0774:
0775:            /**
0776:             * @param totalCostsAgencyRequest The totalCostsAgencyRequest to set.
0777:             */
0778:            public void setTotalCostsAgencyRequest(
0779:                    KualiInteger totalCostsAgencyRequest) {
0780:                this .totalCostsAgencyRequest = totalCostsAgencyRequest;
0781:            }
0782:
0783:            /**
0784:             * @return Returns the totalCostsInstitutionCostShare.
0785:             */
0786:            public KualiInteger getTotalCostsInstitutionCostShare() {
0787:                return totalCostsInstitutionCostShare;
0788:            }
0789:
0790:            /**
0791:             * @param totalCostsInstitutionCostShare The totalCostsInstitutionCostShare to set.
0792:             */
0793:            public void setTotalCostsInstitutionCostShare(
0794:                    KualiInteger totalCostsInstitutionCostShare) {
0795:                this .totalCostsInstitutionCostShare = totalCostsInstitutionCostShare;
0796:            }
0797:
0798:            /**
0799:             * @return Returns the totalCostsThirdPartyCostShare.
0800:             */
0801:            public KualiInteger getTotalCostsThirdPartyCostShare() {
0802:                return totalCostsThirdPartyCostShare;
0803:            }
0804:
0805:            /**
0806:             * @param totalCostsThirdPartyCostShare The totalCostsThirdPartyCostShare to set.
0807:             */
0808:            public void setTotalCostsThirdPartyCostShare(
0809:                    KualiInteger totalCostsThirdPartyCostShare) {
0810:                this .totalCostsThirdPartyCostShare = totalCostsThirdPartyCostShare;
0811:            }
0812:
0813:            /**
0814:             * @return Returns the totalDirectCostsAgencyRequest.
0815:             */
0816:            public KualiInteger getTotalDirectCostsAgencyRequest() {
0817:                return totalDirectCostsAgencyRequest;
0818:            }
0819:
0820:            /**
0821:             * @param totalDirectCostsAgencyRequest The totalDirectCostsAgencyRequest to set.
0822:             */
0823:            public void setTotalDirectCostsAgencyRequest(
0824:                    KualiInteger totalDirectCostsAgencyRequest) {
0825:                this .totalDirectCostsAgencyRequest = totalDirectCostsAgencyRequest;
0826:            }
0827:
0828:            /**
0829:             * @return Returns the totalDirectThirdPartyCostShare.
0830:             */
0831:            public KualiInteger getTotalDirectThirdPartyCostShare() {
0832:                return totalDirectThirdPartyCostShare;
0833:            }
0834:
0835:            /**
0836:             * @param totalDirectThirdPartyCostShare The totalDirectThirdPartyCostShare to set.
0837:             */
0838:            public void setTotalDirectThirdPartyCostShare(
0839:                    KualiInteger totalDirectThirdPartyCostShare) {
0840:                this .totalDirectThirdPartyCostShare = totalDirectThirdPartyCostShare;
0841:            }
0842:
0843:            /**
0844:             * @return Returns the overviewShowModular.
0845:             */
0846:            public boolean isOverviewShowModular() {
0847:                return overviewShowModular;
0848:            }
0849:
0850:            /**
0851:             * @param overviewShowModular The overviewShowModular to set.
0852:             */
0853:            public void setOverviewShowModular(boolean overviewShowModular) {
0854:                this .overviewShowModular = overviewShowModular;
0855:            }
0856:
0857:            /**
0858:             * Inner class that are elements of budgetOverviewPersonnelHelpers. This represents a personnel line item. It also has a method
0859:             * for doing aggregation.
0860:             */
0861:            public class BudgetOverviewPersonnelHelper {
0862:                // Following two are used for unique identifier (for aggregation), not used on display
0863:                private Integer budgetUserSequenceNumber;
0864:                private String institutionAppointmentTypeCode;
0865:
0866:                // A convenient helper to properly display hrs. for hourly employees.
0867:                private boolean hourlyAppointmentType = false;
0868:
0869:                // Following are listed in the order they appear on Overview. That might be helpful to "connect the dots." ;)
0870:                private String personName;
0871:                private String role;
0872:                private String appointmentTypeDescription;
0873:
0874:                private KualiInteger agencyPercentEffortAmount;
0875:                private KualiInteger userAgencyHours;
0876:                private KualiInteger agencyRequestTotalAmount;
0877:                private KualiInteger institutionCostSharePercentEffortAmount;
0878:                private KualiInteger userInstitutionHours;
0879:                private KualiInteger institutionCostShareRequestTotalAmount;
0880:                private KualiDecimal contractsAndGrantsFringeRateAmount; // from budgetFringeRate
0881:                private KualiInteger agencyFringeBenefitTotalAmount;
0882:                private KualiDecimal institutionCostShareFringeRateAmount; // from budgetFringeRate
0883:                private KualiInteger institutionCostShareFringeBenefitTotalAmount;
0884:
0885:                // Not used on overview interface but useful for BudgetXml.
0886:                private boolean personProjectDirectorIndicator;
0887:                private String userBudgetPeriodSalaryAmount; // String because this can be a KualiDecimal or KualiInteger, easier to
0888:                // treat it as String then
0889:                private Integer personWeeksAmount;
0890:
0891:                /**
0892:                 * Constructor that takes a person representation from our BO and puts it into a representation friendly to our interface.
0893:                 * 
0894:                 * @param personName
0895:                 * @param role
0896:                 * @param isPersonProjectDirectorIndicator
0897:                 * @param userAppointmentTaskPeriod
0898:                 */
0899:                public BudgetOverviewPersonnelHelper(String personName,
0900:                        String role, boolean isPersonProjectDirectorIndicator,
0901:                        UserAppointmentTaskPeriod userAppointmentTaskPeriod) {
0902:                    this .budgetUserSequenceNumber = userAppointmentTaskPeriod
0903:                            .getBudgetUserSequenceNumber();
0904:                    this .institutionAppointmentTypeCode = userAppointmentTaskPeriod
0905:                            .getInstitutionAppointmentTypeCode();
0906:
0907:                    this .personName = personName;
0908:                    this .role = role;
0909:                    this .appointmentTypeDescription = userAppointmentTaskPeriod
0910:                            .getBudgetFringeRate().getAppointmentType()
0911:                            .getAppointmentTypeAbbrieviation();
0912:
0913:                    this .personProjectDirectorIndicator = isPersonProjectDirectorIndicator;
0914:                    this .personWeeksAmount = userAppointmentTaskPeriod
0915:                            .getPersonWeeksAmount();
0916:
0917:                    // Following is for proper display of "hrs." on hourly appointments.
0918:                    if (HOURLY_APPOINTMENTS
0919:                            .contains(institutionAppointmentTypeCode)) {
0920:                        // Hourly Appointment
0921:                        this .hourlyAppointmentType = true;
0922:
0923:                        this .userBudgetPeriodSalaryAmount = ObjectUtils
0924:                                .toString(userAppointmentTaskPeriod
0925:                                        .getUserHourlyRate());
0926:
0927:                        this .userAgencyHours = userAppointmentTaskPeriod
0928:                                .getUserAgencyHours();
0929:                        this .userInstitutionHours = userAppointmentTaskPeriod
0930:                                .getUserInstitutionHours();
0931:                    } else if (GRADUATE_RA_APPOINTMENTS
0932:                            .contains(institutionAppointmentTypeCode)) {
0933:                        // Graduate Research Assistant
0934:                        this .userBudgetPeriodSalaryAmount = ObjectUtils
0935:                                .toString(userAppointmentTaskPeriod
0936:                                        .getUserBudgetPeriodSalaryAmount());
0937:
0938:                        this .agencyPercentEffortAmount = userAppointmentTaskPeriod
0939:                                .getAgencyFullTimeEquivalentPercent();
0940:                        this .institutionCostSharePercentEffortAmount = userAppointmentTaskPeriod
0941:                                .getInstitutionFullTimeEquivalentPercent();
0942:
0943:                        // Rates are not to exceed 100%. This check is specifically present for GAs because GAs can have a %-effort
0944:                        // above 100%.
0945:                        if (this .agencyPercentEffortAmount
0946:                                .isGreaterEqual(KraConstants.PERSONNEL_MAX_PERCENTAGE)) {
0947:                            this .agencyPercentEffortAmount = KraConstants.PERSONNEL_MAX_PERCENTAGE;
0948:                        }
0949:                        if (this .institutionCostSharePercentEffortAmount
0950:                                .isGreaterEqual(KraConstants.PERSONNEL_MAX_PERCENTAGE)) {
0951:                            this .institutionCostSharePercentEffortAmount = KraConstants.PERSONNEL_MAX_PERCENTAGE;
0952:                        }
0953:                    } else {
0954:                        // All other appointments
0955:                        this .userBudgetPeriodSalaryAmount = ObjectUtils
0956:                                .toString(userAppointmentTaskPeriod
0957:                                        .getUserBudgetPeriodSalaryAmount());
0958:
0959:                        this .agencyPercentEffortAmount = userAppointmentTaskPeriod
0960:                                .getAgencyPercentEffortAmount();
0961:                        this .institutionCostSharePercentEffortAmount = userAppointmentTaskPeriod
0962:                                .getInstitutionCostSharePercentEffortAmount();
0963:                    }
0964:
0965:                    // Following is for proper display of Graduate Research Assistants Appointments.
0966:                    if (GRADUATE_RA_APPOINTMENTS
0967:                            .contains(institutionAppointmentTypeCode)) {
0968:                        this .agencyRequestTotalAmount = userAppointmentTaskPeriod
0969:                                .getAgencySalaryAmount();
0970:                        this .institutionCostShareRequestTotalAmount = userAppointmentTaskPeriod
0971:                                .getInstitutionSalaryAmount();
0972:                        this .agencyFringeBenefitTotalAmount = userAppointmentTaskPeriod
0973:                                .getAgencyHealthInsuranceAmount();
0974:                        this .institutionCostShareFringeBenefitTotalAmount = userAppointmentTaskPeriod
0975:                                .getInstitutionHealthInsuranceAmount();
0976:
0977:                        // %-effort for Fringe Rate are always 0 for GAs
0978:                        this .contractsAndGrantsFringeRateAmount = new KualiDecimal(
0979:                                0);
0980:                        this .institutionCostShareFringeRateAmount = new KualiDecimal(
0981:                                0);
0982:                    } else {
0983:                        this .agencyRequestTotalAmount = userAppointmentTaskPeriod
0984:                                .getAgencyRequestTotalAmount();
0985:                        this .institutionCostShareRequestTotalAmount = userAppointmentTaskPeriod
0986:                                .getInstitutionCostShareRequestTotalAmount();
0987:                        this .agencyFringeBenefitTotalAmount = userAppointmentTaskPeriod
0988:                                .getAgencyFringeBenefitTotalAmount();
0989:                        this .institutionCostShareFringeBenefitTotalAmount = userAppointmentTaskPeriod
0990:                                .getInstitutionCostShareFringeBenefitTotalAmount();
0991:
0992:                        // %-effort for Fringe Rate
0993:                        this .contractsAndGrantsFringeRateAmount = userAppointmentTaskPeriod
0994:                                .getBudgetFringeRate()
0995:                                .getContractsAndGrantsFringeRateAmount();
0996:                        this .institutionCostShareFringeRateAmount = userAppointmentTaskPeriod
0997:                                .getBudgetFringeRate()
0998:                                .getInstitutionCostShareFringeRateAmount();
0999:                    }
1000:                }
1001:
1002:                /**
1003:                 * Used for aggregation of BudgetOverviewPersonnelHelper. Happens when user is viewing a summary of any kind. Sums up
1004:                 * percentages, hours, and amounts. It caps percentage at 100%. Fringe rate percentages are not touched.
1005:                 * 
1006:                 * @param userAppointmentTaskPeriod to be added into the current item. It is assumed that item passed in have equal
1007:                 *        budgetUserSequenceNumber and institutionAppointmentTypeCode.
1008:                 */
1009:                public void aggregation(
1010:                        UserAppointmentTaskPeriod userAppointmentTaskPeriod) {
1011:                    if (!this .getBudgetUserSequenceNumber().equals(
1012:                            userAppointmentTaskPeriod
1013:                                    .getBudgetUserSequenceNumber())
1014:                            && !this 
1015:                                    .getInstitutionAppointmentTypeCode()
1016:                                    .equals(
1017:                                            userAppointmentTaskPeriod
1018:                                                    .getInstitutionAppointmentTypeCode())) {
1019:                        throw new IllegalArgumentException(
1020:                                "BudgetUserSequenceNumber or InstitutionAppointmentTypeCode does not match for aggregation.");
1021:                    }
1022:
1023:                    // Following is for proper display of "hrs." on hourly appointments.
1024:                    if (this .hourlyAppointmentType) {
1025:                        this .userAgencyHours = this .userAgencyHours
1026:                                .add(userAppointmentTaskPeriod
1027:                                        .getUserAgencyHours());
1028:                        this .userInstitutionHours = this .userInstitutionHours
1029:                                .add(userAppointmentTaskPeriod
1030:                                        .getUserInstitutionHours());
1031:                    } else {
1032:                        // %-effort does not display on summaries per KULERA-514.
1033:                        this .agencyPercentEffortAmount = null;
1034:                        this .institutionCostSharePercentEffortAmount = null;
1035:                    }
1036:
1037:                    // Following is for proper display of Graduate Research Assistants Appointments.
1038:                    if (GRADUATE_RA_APPOINTMENTS
1039:                            .contains(institutionAppointmentTypeCode)) {
1040:                        this .agencyRequestTotalAmount = this .agencyRequestTotalAmount
1041:                                .add(userAppointmentTaskPeriod
1042:                                        .getAgencySalaryAmount());
1043:                        this .institutionCostShareRequestTotalAmount = this .institutionCostShareRequestTotalAmount
1044:                                .add(userAppointmentTaskPeriod
1045:                                        .getInstitutionSalaryAmount());
1046:                        this .agencyFringeBenefitTotalAmount = this .agencyFringeBenefitTotalAmount
1047:                                .add(userAppointmentTaskPeriod
1048:                                        .getAgencyHealthInsuranceAmount());
1049:                        this .institutionCostShareFringeBenefitTotalAmount = this .institutionCostShareFringeBenefitTotalAmount
1050:                                .add(userAppointmentTaskPeriod
1051:                                        .getInstitutionHealthInsuranceAmount());
1052:                    } else {
1053:                        this .agencyRequestTotalAmount = this .agencyRequestTotalAmount
1054:                                .add(userAppointmentTaskPeriod
1055:                                        .getAgencyRequestTotalAmount());
1056:                        this .institutionCostShareRequestTotalAmount = this .institutionCostShareRequestTotalAmount
1057:                                .add(userAppointmentTaskPeriod
1058:                                        .getInstitutionCostShareRequestTotalAmount());
1059:                        this .agencyFringeBenefitTotalAmount = this .agencyFringeBenefitTotalAmount
1060:                                .add(userAppointmentTaskPeriod
1061:                                        .getAgencyFringeBenefitTotalAmount());
1062:                        this .institutionCostShareFringeBenefitTotalAmount = this .institutionCostShareFringeBenefitTotalAmount
1063:                                .add(userAppointmentTaskPeriod
1064:                                        .getInstitutionCostShareFringeBenefitTotalAmount());
1065:                    }
1066:
1067:                    // % effort for fringe rates are not affected by aggregation.
1068:                }
1069:
1070:                /**
1071:                 * @return Returns the agencyFringeBenefitTotalAmount.
1072:                 */
1073:                public KualiInteger getAgencyFringeBenefitTotalAmount() {
1074:                    return agencyFringeBenefitTotalAmount;
1075:                }
1076:
1077:                /**
1078:                 * @param agencyFringeBenefitTotalAmount The agencyFringeBenefitTotalAmount to set.
1079:                 */
1080:                public void setAgencyFringeBenefitTotalAmount(
1081:                        KualiInteger agencyFringeBenefitTotalAmount) {
1082:                    this .agencyFringeBenefitTotalAmount = agencyFringeBenefitTotalAmount;
1083:                }
1084:
1085:                /**
1086:                 * @return Returns the agencyPercentEffortAmount.
1087:                 */
1088:                public KualiInteger getAgencyPercentEffortAmount() {
1089:                    return agencyPercentEffortAmount;
1090:                }
1091:
1092:                /**
1093:                 * @param agencyPercentEffortAmount The agencyPercentEffortAmount to set.
1094:                 */
1095:                public void setAgencyPercentEffortAmount(
1096:                        KualiInteger agencyPercentEffortAmount) {
1097:                    this .agencyPercentEffortAmount = agencyPercentEffortAmount;
1098:                }
1099:
1100:                /**
1101:                 * @return Returns the agencyRequestTotalAmount.
1102:                 */
1103:                public KualiInteger getAgencyRequestTotalAmount() {
1104:                    return agencyRequestTotalAmount;
1105:                }
1106:
1107:                /**
1108:                 * @param agencyRequestTotalAmount The agencyRequestTotalAmount to set.
1109:                 */
1110:                public void setAgencyRequestTotalAmount(
1111:                        KualiInteger agencyRequestTotalAmount) {
1112:                    this .agencyRequestTotalAmount = agencyRequestTotalAmount;
1113:                }
1114:
1115:                /**
1116:                 * @return Returns the appointmentTypeDescription.
1117:                 */
1118:                public String getAppointmentTypeDescription() {
1119:                    return appointmentTypeDescription;
1120:                }
1121:
1122:                /**
1123:                 * @param appointmentTypeDescription The appointmentTypeDescription to set.
1124:                 */
1125:                public void setAppointmentTypeDescription(
1126:                        String appointmentTypeDescription) {
1127:                    this .appointmentTypeDescription = appointmentTypeDescription;
1128:                }
1129:
1130:                /**
1131:                 * @return Returns the budgetUserSequenceNumber.
1132:                 */
1133:                public Integer getBudgetUserSequenceNumber() {
1134:                    return budgetUserSequenceNumber;
1135:                }
1136:
1137:                /**
1138:                 * @param budgetUserSequenceNumber The budgetUserSequenceNumber to set.
1139:                 */
1140:                public void setBudgetUserSequenceNumber(
1141:                        Integer budgetUserSequenceNumber) {
1142:                    this .budgetUserSequenceNumber = budgetUserSequenceNumber;
1143:                }
1144:
1145:                /**
1146:                 * @return Returns the contractsAndGrantsFringeRateAmount.
1147:                 */
1148:                public KualiDecimal getContractsAndGrantsFringeRateAmount() {
1149:                    return contractsAndGrantsFringeRateAmount;
1150:                }
1151:
1152:                /**
1153:                 * @param contractsAndGrantsFringeRateAmount The contractsAndGrantsFringeRateAmount to set.
1154:                 */
1155:                public void setContractsAndGrantsFringeRateAmount(
1156:                        KualiDecimal contractsAndGrantsFringeRateAmount) {
1157:                    this .contractsAndGrantsFringeRateAmount = contractsAndGrantsFringeRateAmount;
1158:                }
1159:
1160:                /**
1161:                 * @return Returns the personName.
1162:                 */
1163:                public String getPersonName() {
1164:                    return personName;
1165:                }
1166:
1167:                /**
1168:                 * @param personName The personName to set.
1169:                 */
1170:                public void setPersonName(String personName) {
1171:                    this .personName = personName;
1172:                }
1173:
1174:                /**
1175:                 * @return Returns the role.
1176:                 */
1177:                public String getRole() {
1178:                    return role;
1179:                }
1180:
1181:                /**
1182:                 * @param role The role to set.
1183:                 */
1184:                public void setRole(String role) {
1185:                    this .role = role;
1186:                }
1187:
1188:                /**
1189:                 * @return Returns the institutionAppointmentTypeCode.
1190:                 */
1191:                public String getInstitutionAppointmentTypeCode() {
1192:                    return institutionAppointmentTypeCode;
1193:                }
1194:
1195:                /**
1196:                 * @param institutionAppointmentTypeCode The institutionAppointmentTypeCode to set.
1197:                 */
1198:                public void setInstitutionAppointmentTypeCode(
1199:                        String institutionAppointmentTypeCode) {
1200:                    this .institutionAppointmentTypeCode = institutionAppointmentTypeCode;
1201:                }
1202:
1203:                /**
1204:                 * @return Returns the institutionCostShareFringeBenefitTotalAmount.
1205:                 */
1206:                public KualiInteger getInstitutionCostShareFringeBenefitTotalAmount() {
1207:                    return institutionCostShareFringeBenefitTotalAmount;
1208:                }
1209:
1210:                /**
1211:                 * @param institutionCostShareFringeBenefitTotalAmount The institutionCostShareFringeBenefitTotalAmount to set.
1212:                 */
1213:                public void setInstitutionCostShareFringeBenefitTotalAmount(
1214:                        KualiInteger institutionCostShareFringeBenefitTotalAmount) {
1215:                    this .institutionCostShareFringeBenefitTotalAmount = institutionCostShareFringeBenefitTotalAmount;
1216:                }
1217:
1218:                /**
1219:                 * @return Returns the institutionCostShareFringeRateAmount.
1220:                 */
1221:                public KualiDecimal getInstitutionCostShareFringeRateAmount() {
1222:                    return institutionCostShareFringeRateAmount;
1223:                }
1224:
1225:                /**
1226:                 * @param institutionCostShareFringeRateAmount The institutionCostShareFringeRateAmount to set.
1227:                 */
1228:                public void setInstitutionCostShareFringeRateAmount(
1229:                        KualiDecimal institutionCostShareFringeRateAmount) {
1230:                    this .institutionCostShareFringeRateAmount = institutionCostShareFringeRateAmount;
1231:                }
1232:
1233:                /**
1234:                 * @return Returns the institutionCostSharePercentEffortAmount.
1235:                 */
1236:                public KualiInteger getInstitutionCostSharePercentEffortAmount() {
1237:                    return institutionCostSharePercentEffortAmount;
1238:                }
1239:
1240:                /**
1241:                 * @param institutionCostSharePercentEffortAmount The institutionCostSharePercentEffortAmount to set.
1242:                 */
1243:                public void setInstitutionCostSharePercentEffortAmount(
1244:                        KualiInteger institutionCostSharePercentEffortAmount) {
1245:                    this .institutionCostSharePercentEffortAmount = institutionCostSharePercentEffortAmount;
1246:                }
1247:
1248:                /**
1249:                 * @return Returns the institutionCostShareRequestTotalAmount.
1250:                 */
1251:                public KualiInteger getInstitutionCostShareRequestTotalAmount() {
1252:                    return institutionCostShareRequestTotalAmount;
1253:                }
1254:
1255:                /**
1256:                 * @param institutionCostShareRequestTotalAmount The institutionCostShareRequestTotalAmount to set.
1257:                 */
1258:                public void setInstitutionCostShareRequestTotalAmount(
1259:                        KualiInteger institutionCostShareRequestTotalAmount) {
1260:                    this .institutionCostShareRequestTotalAmount = institutionCostShareRequestTotalAmount;
1261:                }
1262:
1263:                /**
1264:                 * @return Returns the userAgencyHours.
1265:                 */
1266:                public KualiInteger getUserAgencyHours() {
1267:                    return userAgencyHours;
1268:                }
1269:
1270:                /**
1271:                 * @param userAgencyHours The userAgencyHours to set.
1272:                 */
1273:                public void setUserAgencyHours(KualiInteger userAgencyHours) {
1274:                    this .userAgencyHours = userAgencyHours;
1275:                }
1276:
1277:                /**
1278:                 * @return Returns the userInstitutionHours.
1279:                 */
1280:                public KualiInteger getUserInstitutionHours() {
1281:                    return userInstitutionHours;
1282:                }
1283:
1284:                /**
1285:                 * @param userInstitutionHours The userInstitutionHours to set.
1286:                 */
1287:                public void setUserInstitutionHours(
1288:                        KualiInteger userInstitutionHours) {
1289:                    this .userInstitutionHours = userInstitutionHours;
1290:                }
1291:
1292:                /**
1293:                 * @return Returns the hourlyAppointmentType.
1294:                 */
1295:                public boolean isHourlyAppointmentType() {
1296:                    return hourlyAppointmentType;
1297:                }
1298:
1299:                /**
1300:                 * @param hourlyAppointmentType The hourlyAppointmentType to set.
1301:                 */
1302:                public void setHourlyAppointmentType(
1303:                        boolean hourlyAppointmentType) {
1304:                    this .hourlyAppointmentType = hourlyAppointmentType;
1305:                }
1306:
1307:                /**
1308:                 * Gets the personProjectDirectorIndicator attribute.
1309:                 * 
1310:                 * @return Returns the personProjectDirectorIndicator.
1311:                 */
1312:                public boolean isPersonProjectDirectorIndicator() {
1313:                    return personProjectDirectorIndicator;
1314:                }
1315:
1316:                /**
1317:                 * Sets the personProjectDirectorIndicator attribute value.
1318:                 * 
1319:                 * @param personProjectDirectorIndicator The personProjectDirectorIndicator to set.
1320:                 */
1321:                public void setPersonProjectDirectorIndicator(
1322:                        boolean personProjectDirectorIndicator) {
1323:                    this .personProjectDirectorIndicator = personProjectDirectorIndicator;
1324:                }
1325:
1326:                /**
1327:                 * Gets the userBudgetPeriodSalaryAmount attribute.
1328:                 * 
1329:                 * @return Returns the userBudgetPeriodSalaryAmount.
1330:                 */
1331:                public String getUserBudgetPeriodSalaryAmount() {
1332:                    return userBudgetPeriodSalaryAmount;
1333:                }
1334:
1335:                /**
1336:                 * Sets the userBudgetPeriodSalaryAmount attribute value.
1337:                 * 
1338:                 * @param userBudgetPeriodSalaryAmount The userBudgetPeriodSalaryAmount to set.
1339:                 */
1340:                public void setUserBudgetPeriodSalaryAmount(
1341:                        String userBudgetPeriodSalaryAmount) {
1342:                    this .userBudgetPeriodSalaryAmount = userBudgetPeriodSalaryAmount;
1343:                }
1344:
1345:                /**
1346:                 * Gets the personWeeksAmount attribute.
1347:                 * 
1348:                 * @return Returns the personWeeksAmount.
1349:                 */
1350:                public Integer getPersonWeeksAmount() {
1351:                    return personWeeksAmount;
1352:                }
1353:
1354:                /**
1355:                 * Sets the personWeeksAmount attribute value.
1356:                 * 
1357:                 * @param personWeeksAmount The personWeeksAmount to set.
1358:                 */
1359:                public void setPersonWeeksAmount(Integer personWeeksAmount) {
1360:                    this .personWeeksAmount = personWeeksAmount;
1361:                }
1362:            }
1363:
1364:            public BudgetPeriod getBudgetPeriod() {
1365:                return budgetPeriod;
1366:            }
1367:
1368:            public void setBudgetPeriod(BudgetPeriod budgetPeriod) {
1369:                this .budgetPeriod = budgetPeriod;
1370:            }
1371:
1372:            public BudgetTask getBudgetTask() {
1373:                return budgetTask;
1374:            }
1375:
1376:            public void setBudgetTask(BudgetTask budgetTask) {
1377:                this .budgetTask = budgetTask;
1378:            }
1379:
1380:            public boolean isSelected() {
1381:                return selected;
1382:            }
1383:
1384:            public void setSelected(boolean selected) {
1385:                this.selected = selected;
1386:            }
1387:        }
w___ww_.___ja__v___a2__s___.___c_o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.