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


001:        /*
002:         * Copyright 2006-2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.module.kra.budget.web.struts.action;
017:
018:        import java.util.ArrayList;
019:        import java.util.List;
020:
021:        import javax.servlet.http.HttpServletRequest;
022:        import javax.servlet.http.HttpServletResponse;
023:
024:        import org.apache.struts.action.ActionForm;
025:        import org.apache.struts.action.ActionForward;
026:        import org.apache.struts.action.ActionMapping;
027:        import org.kuali.core.service.KualiConfigurationService;
028:        import org.kuali.core.service.KualiRuleService;
029:        import org.kuali.core.service.PersistenceService;
030:        import org.kuali.core.util.GlobalVariables;
031:        import org.kuali.core.util.ObjectUtils;
032:        import org.kuali.kfs.KFSConstants;
033:        import org.kuali.kfs.context.SpringContext;
034:        import org.kuali.kfs.service.ParameterService;
035:        import org.kuali.module.kra.KraConstants;
036:        import org.kuali.module.kra.budget.bo.AgencyExtension;
037:        import org.kuali.module.kra.budget.bo.Budget;
038:        import org.kuali.module.kra.budget.bo.BudgetFringeRate;
039:        import org.kuali.module.kra.budget.bo.BudgetGraduateAssistantRate;
040:        import org.kuali.module.kra.budget.bo.BudgetModular;
041:        import org.kuali.module.kra.budget.bo.BudgetPeriod;
042:        import org.kuali.module.kra.budget.bo.BudgetTask;
043:        import org.kuali.module.kra.budget.bo.GraduateAssistantRate;
044:        import org.kuali.module.kra.budget.document.BudgetDocument;
045:        import org.kuali.module.kra.budget.rules.event.InsertPeriodLineEventBase;
046:        import org.kuali.module.kra.budget.service.BudgetFringeRateService;
047:        import org.kuali.module.kra.budget.service.BudgetModularService;
048:        import org.kuali.module.kra.budget.web.struts.form.BudgetForm;
049:
050:        /**
051:         * This class handles Actions for Research Administration.
052:         */
053:
054:        public class BudgetParametersAction extends BudgetAction {
055:
056:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
057:                    .getLogger(BudgetParametersAction.class);
058:
059:            /**
060:             * This method overrides the BudgetAction execute method. It does so for the purpose of recalculating Personnel expenses any
061:             * time the Personnel page is accessed
062:             */
063:            public ActionForward execute(ActionMapping mapping,
064:                    ActionForm form, HttpServletRequest request,
065:                    HttpServletResponse response) throws Exception {
066:                ActionForward super Forward = super .execute(mapping, form,
067:                        request, response);
068:
069:                BudgetForm budgetForm = (BudgetForm) form;
070:
071:                // On first load, set the default task name for the initial task.
072:                if (budgetForm.getBudgetDocument().getTaskListSize() == 0) {
073:                    String DEFAULT_BUDGET_TASK_NAME = SpringContext.getBean(
074:                            ParameterService.class).getParameterValue(
075:                            BudgetDocument.class,
076:                            KraConstants.DEFAULT_BUDGET_TASK_NAME);
077:                    budgetForm.getNewTask().setBudgetTaskName(
078:                            DEFAULT_BUDGET_TASK_NAME + " 1");
079:                    budgetForm.getNewTask().setBudgetTaskOnCampus(true);
080:                }
081:
082:                // Set default budget types
083:                setupBudgetTypes(budgetForm);
084:
085:                // pre-fetch academic year subdivision names for later use
086:                setupAcademicYearSubdivisionConstants(budgetForm);
087:
088:                // Disable/enable appropriate navigation tabs
089:                budgetForm.checkHeaderNavigation();
090:
091:                return super Forward;
092:            }
093:
094:            public ActionForward saveParameters(ActionMapping mapping,
095:                    ActionForm form, HttpServletRequest request,
096:                    HttpServletResponse response) throws Exception {
097:                BudgetForm budgetForm = (BudgetForm) form;
098:
099:                // Need to retain modular task number, since it's set on this page
100:                Integer budgetModularTaskNumber = null;
101:                if (!ObjectUtils.isNull(budgetForm.getBudgetDocument()
102:                        .getBudget().getModularBudget())) {
103:                    budgetModularTaskNumber = budgetForm.getBudgetDocument()
104:                            .getBudget().getModularBudget()
105:                            .getBudgetModularTaskNumber();
106:                }
107:
108:                List referenceObjects = new ArrayList();
109:
110:                referenceObjects.add("budgetAgency");
111:                referenceObjects.add("federalPassThroughAgency");
112:                referenceObjects.add("projectDirector");
113:                referenceObjects.add("nonpersonnelItems");
114:                referenceObjects.add("personnel");
115:                referenceObjects.add("modularBudget");
116:                referenceObjects.add("indirectCost");
117:                referenceObjects.add("thirdPartyCostShareItems");
118:                referenceObjects.add("institutionCostShareItems");
119:                referenceObjects.add("institutionCostSharePersonnelItems");
120:
121:                SpringContext.getBean(PersistenceService.class)
122:                        .retrieveReferenceObjects(
123:                                budgetForm.getBudgetDocument().getBudget(),
124:                                referenceObjects);
125:
126:                List docReferenceObjects = new ArrayList();
127:                docReferenceObjects.add("adhocPersons");
128:                docReferenceObjects.add("adhocOrgs");
129:                docReferenceObjects.add("adhocWorkgroups");
130:
131:                SpringContext.getBean(PersistenceService.class)
132:                        .retrieveReferenceObjects(
133:                                budgetForm.getBudgetDocument(),
134:                                docReferenceObjects);
135:
136:                if (budgetForm.getBudgetDocument().getBudget()
137:                        .isAgencyModularIndicator()) {
138:                    if (ObjectUtils.isNull(budgetForm.getBudgetDocument()
139:                            .getBudget().getModularBudget())) {
140:                        // Modular budget with no modular data generated. So generate it.
141:                        SpringContext.getBean(BudgetModularService.class)
142:                                .generateModularBudget(
143:                                        budgetForm.getBudgetDocument()
144:                                                .getBudget());
145:                    }
146:                    budgetForm.getBudgetDocument().getBudget()
147:                            .getModularBudget().setBudgetModularTaskNumber(
148:                                    budgetModularTaskNumber);
149:                }
150:
151:                Object question = request
152:                        .getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME);
153:                KualiConfigurationService kualiConfiguration = SpringContext
154:                        .getBean(KualiConfigurationService.class);
155:
156:                // Logic for Cost Share question.
157:                ActionForward preRulesForward = preRulesCheck(mapping, form,
158:                        request, response, "saveParameters");
159:                if (preRulesForward != null) {
160:                    return preRulesForward;
161:                }
162:
163:                super .save(mapping, form, request, response);
164:
165:                if (GlobalVariables.getErrorMap().size() == 0) {
166:                    if (budgetForm.isAuditActivated()) {
167:                        return mapping.findForward("auditmode");
168:                    }
169:
170:                    // This is so that tab states are not shared between parameters and overview.
171:                    budgetForm.newTabState(true, true);
172:
173:                    return super .overview(mapping, budgetForm, request,
174:                            response);
175:                }
176:
177:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
178:            }
179:
180:            public ActionForward copyFringeRateLines(ActionMapping mapping,
181:                    ActionForm form, HttpServletRequest request,
182:                    HttpServletResponse response) throws Exception {
183:                // get the form
184:                BudgetForm budgetForm = (BudgetForm) form;
185:
186:                BudgetFringeRateService bfrService = SpringContext
187:                        .getBean(BudgetFringeRateService.class);
188:                for (BudgetFringeRate budgetFringeRate : budgetForm
189:                        .getBudgetDocument().getBudget().getFringeRates()) {
190:                    budgetFringeRate
191:                            .setContractsAndGrantsFringeRateAmount(budgetFringeRate
192:                                    .getAppointmentTypeFringeRateAmount());
193:                }
194:
195:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
196:            }
197:
198:            public ActionForward copyInstitutionCostShareLines(
199:                    ActionMapping mapping, ActionForm form,
200:                    HttpServletRequest request, HttpServletResponse response)
201:                    throws Exception {
202:                // get the form
203:                BudgetForm budgetForm = (BudgetForm) form;
204:
205:                BudgetFringeRateService bfrService = SpringContext
206:                        .getBean(BudgetFringeRateService.class);
207:                for (BudgetFringeRate budgetFringeRate : budgetForm
208:                        .getBudgetDocument().getBudget().getFringeRates()) {
209:                    budgetFringeRate
210:                            .setInstitutionCostShareFringeRateAmount(budgetFringeRate
211:                                    .getAppointmentTypeCostShareFringeRateAmount());
212:                }
213:
214:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
215:            }
216:
217:            /*
218:             * A struts action to copy the the Graduate Asst. rates from the system rate to the current budget
219:             */
220:            public ActionForward copySystemGraduateAssistantLines(
221:                    ActionMapping mapping, ActionForm form,
222:                    HttpServletRequest request, HttpServletResponse response)
223:                    throws Exception {
224:                // get the form
225:                BudgetForm budgetForm = (BudgetForm) form;
226:
227:                for (BudgetGraduateAssistantRate budgetGraduateAssistantRate : budgetForm
228:                        .getBudgetDocument().getBudget()
229:                        .getGraduateAssistantRates()) {
230:                    budgetGraduateAssistantRate
231:                            .refreshNonUpdateableReferences();
232:                    GraduateAssistantRate systemRate = budgetGraduateAssistantRate
233:                            .getGraduateAssistantRate();
234:                    budgetGraduateAssistantRate
235:                            .setCampusMaximumPeriod1Rate(systemRate
236:                                    .getCampusMaximumPeriod1Rate());
237:                    budgetGraduateAssistantRate
238:                            .setCampusMaximumPeriod2Rate(systemRate
239:                                    .getCampusMaximumPeriod2Rate());
240:                    budgetGraduateAssistantRate
241:                            .setCampusMaximumPeriod3Rate(systemRate
242:                                    .getCampusMaximumPeriod3Rate());
243:                    budgetGraduateAssistantRate
244:                            .setCampusMaximumPeriod4Rate(systemRate
245:                                    .getCampusMaximumPeriod4Rate());
246:                    budgetGraduateAssistantRate
247:                            .setCampusMaximumPeriod5Rate(systemRate
248:                                    .getCampusMaximumPeriod5Rate());
249:                    budgetGraduateAssistantRate
250:                            .setCampusMaximumPeriod6Rate(systemRate
251:                                    .getCampusMaximumPeriod6Rate());
252:                }
253:
254:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
255:            }
256:
257:            public ActionForward insertPeriodLine(ActionMapping mapping,
258:                    ActionForm form, HttpServletRequest request,
259:                    HttpServletResponse response) throws Exception {
260:                BudgetForm budgetForm = (BudgetForm) form;
261:
262:                // check any business rules
263:                boolean rulePassed = SpringContext.getBean(
264:                        KualiRuleService.class).applyRules(
265:                        new InsertPeriodLineEventBase(budgetForm.getDocument(),
266:                                budgetForm.getNewPeriod()));
267:
268:                if (rulePassed) {
269:                    budgetForm.getBudgetDocument().addPeriod(
270:                            budgetForm.getNewPeriod());
271:                    budgetForm.setNewPeriod(new BudgetPeriod());
272:                }
273:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
274:            }
275:
276:            public ActionForward deletePeriodLine(ActionMapping mapping,
277:                    ActionForm form, HttpServletRequest request,
278:                    HttpServletResponse response) throws Exception {
279:
280:                ((BudgetForm) form).getBudgetDocument().setPeriodToDelete(
281:                        Integer.toString(getLineToDelete(request)));
282:                ActionForward preRulesForward = preRulesCheck(mapping, form,
283:                        request, response);
284:                if (preRulesForward != null) {
285:                    return preRulesForward;
286:                }
287:
288:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
289:            }
290:
291:            public ActionForward insertTaskLine(ActionMapping mapping,
292:                    ActionForm form, HttpServletRequest request,
293:                    HttpServletResponse response) throws Exception {
294:                BudgetForm budgetForm = (BudgetForm) form;
295:                budgetForm.getBudgetDocument().addTask(budgetForm.getNewTask());
296:                budgetForm.setNewTask(new BudgetTask());
297:                budgetForm.getNewTask().setBudgetTaskOnCampus(true);
298:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
299:            }
300:
301:            public ActionForward deleteTaskLine(ActionMapping mapping,
302:                    ActionForm form, HttpServletRequest request,
303:                    HttpServletResponse response) throws Exception {
304:
305:                ((BudgetForm) form).getBudgetDocument().setTaskToDelete(
306:                        Integer.toString(getLineToDelete(request)));
307:                ActionForward preRulesForward = preRulesCheck(mapping, form,
308:                        request, response);
309:                if (preRulesForward != null) {
310:                    return preRulesForward;
311:                }
312:
313:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
314:            }
315:
316:            public ActionForward refresh(ActionMapping mapping,
317:                    ActionForm form, HttpServletRequest request,
318:                    HttpServletResponse response) throws Exception {
319:                super .refresh(mapping, form, request, response);
320:                BudgetForm budgetForm = (BudgetForm) form;
321:                Budget budget = budgetForm.getBudgetDocument().getBudget();
322:                if (request.getParameter(KFSConstants.REFRESH_CALLER) != null) {
323:                    String refreshCaller = request
324:                            .getParameter(KFSConstants.REFRESH_CALLER);
325:                    // check to see if we are coming back from a lookup
326:                    if (refreshCaller
327:                            .equals(KFSConstants.KUALI_LOOKUPABLE_IMPL)) {
328:                        if ("true"
329:                                .equals(request
330:                                        .getParameter("document.budget.agencyToBeNamedIndicator"))) {
331:                            // coming back from Agency lookup - To Be Named selected
332:                            budget.setBudgetAgency(null);
333:                            budget.setBudgetAgencyNumber(null);
334:                            BudgetModular modularBudget = budget
335:                                    .getModularBudget() != null ? budget
336:                                    .getModularBudget() : new BudgetModular(
337:                                    budget.getDocumentNumber());
338:                            resetModularBudget(budget, modularBudget);
339:                            budget.setModularBudget(modularBudget);
340:                        } else if (request
341:                                .getParameter("document.budget.budgetAgencyNumber") != null) {
342:                            // coming back from an Agnecy lookup - Agency selected
343:                            budget.setAgencyToBeNamedIndicator(false);
344:                            BudgetModular modularBudget = budget
345:                                    .getModularBudget() != null ? budget
346:                                    .getModularBudget() : new BudgetModular(
347:                                    budget.getDocumentNumber());
348:                            budget.refreshReferenceObject("budgetAgency");
349:                            budget.getBudgetAgency().refresh();
350:                            if (budget.getBudgetAgency().getAgencyExtension() != null) {
351:                                AgencyExtension agencyExtension = budget
352:                                        .getBudgetAgency().getAgencyExtension();
353:                                modularBudget
354:                                        .setBudgetModularIncrementAmount(agencyExtension
355:                                                .getBudgetModularIncrementAmount());
356:                                modularBudget
357:                                        .setBudgetPeriodMaximumAmount(agencyExtension
358:                                                .getBudgetPeriodMaximumAmount());
359:                            } else {
360:                                resetModularBudget(budget, modularBudget);
361:                            }
362:                            budget.setModularBudget(modularBudget);
363:                        } else if (request
364:                                .getParameter("document.budget.budgetProjectDirectorUniversalIdentifier") != null) {
365:                            // Coming back from project director lookup - project director selected
366:                            budgetForm
367:                                    .getBudgetDocument()
368:                                    .getBudget()
369:                                    .setProjectDirectorToBeNamedIndicator(false);
370:                            budgetForm.getBudgetDocument().getBudget()
371:                                    .refreshReferenceObject("projectDirector");
372:                        } else if ("true"
373:                                .equals(request
374:                                        .getParameter("document.budget.projectDirectorToBeNamedIndicator"))) {
375:                            // Coming back from project director lookup - Name Later selected
376:                            budgetForm.getBudgetDocument().getBudget()
377:                                    .setProjectDirector(null);
378:                            budgetForm
379:                                    .getBudgetDocument()
380:                                    .getBudget()
381:                                    .setBudgetProjectDirectorUniversalIdentifier(
382:                                            null);
383:                        }
384:                    }
385:                }
386:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
387:            }
388:
389:            private static void resetModularBudget(Budget budget,
390:                    BudgetModular modularBudget) {
391:                modularBudget.setBudgetModularTaskNumber(null);
392:                budget.setAgencyModularIndicator(false);
393:            }
394:
395:            public ActionForward clearFedPassthrough(ActionMapping mapping,
396:                    ActionForm form, HttpServletRequest request,
397:                    HttpServletResponse response) throws Exception {
398:                BudgetForm budgetForm = (BudgetForm) form;
399:                Budget budget = budgetForm.getBudgetDocument().getBudget();
400:
401:                budget.setFederalPassThroughAgencyNumber(null);
402:                budget.setFederalPassThroughAgency(null);
403:
404:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
405:            }
406:
407:            public ActionForward basic(ActionMapping mapping, ActionForm form,
408:                    HttpServletRequest request, HttpServletResponse response)
409:                    throws Exception {
410:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
411:            }
412:        }
w__w___w__.j__a_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.