Source Code Cross Referenced for BudgetIndirectCostAction.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.KualiRuleService;
028:        import org.kuali.kfs.KFSConstants;
029:        import org.kuali.kfs.context.SpringContext;
030:        import org.kuali.module.kra.budget.bo.BudgetIndirectCost;
031:        import org.kuali.module.kra.budget.bo.BudgetIndirectCostLookup;
032:        import org.kuali.module.kra.budget.rules.event.RecalculateIndirectCostEvent;
033:        import org.kuali.module.kra.budget.rules.event.UpdateIndirectCostEvent;
034:        import org.kuali.module.kra.budget.service.BudgetIndirectCostService;
035:        import org.kuali.module.kra.budget.web.struts.form.BudgetForm;
036:        import org.kuali.module.kra.budget.web.struts.form.BudgetIndirectCostFormHelper;
037:
038:        /**
039:         * This class handles Actions for Research Administration.
040:         */
041:
042:        public class BudgetIndirectCostAction extends BudgetAction {
043:
044:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
045:                    .getLogger(BudgetIndirectCostAction.class);
046:
047:            /**
048:             * Save indirect Cost.
049:             * 
050:             * @param mapping
051:             * @param form
052:             * @param request
053:             * @param response
054:             * @return ActionForward
055:             * @throws Exception
056:             */
057:            public ActionForward save(ActionMapping mapping, ActionForm form,
058:                    HttpServletRequest request, HttpServletResponse response)
059:                    throws Exception {
060:
061:                BudgetForm budgetForm = (BudgetForm) form;
062:
063:                SpringContext.getBean(BudgetIndirectCostService.class)
064:                        .refreshIndirectCost(budgetForm.getBudgetDocument());
065:                budgetForm
066:                        .setBudgetIndirectCostFormHelper(new BudgetIndirectCostFormHelper(
067:                                budgetForm));
068:
069:                // Check to make sure our rules are passed.
070:                boolean rulePassed = SpringContext.getBean(
071:                        KualiRuleService.class).applyRules(
072:                        new UpdateIndirectCostEvent(budgetForm.getDocument(),
073:                                budgetForm.getBudgetDocument().getBudget()
074:                                        .getIndirectCost()));
075:
076:                // If our rule failed, reload the current page.
077:                if (!rulePassed) {
078:                    return mapping.findForward(KFSConstants.MAPPING_BASIC);
079:                }
080:
081:                BudgetIndirectCost indirectCost = new BudgetIndirectCost(
082:                        budgetForm.getBudgetDocument().getBudget()
083:                                .getIndirectCost());
084:                indirectCost.setDocumentNumber(budgetForm.getBudgetDocument()
085:                        .getDocumentNumber());
086:
087:                List<BudgetIndirectCostLookup> budgetIndirectCostLookups = new ArrayList(
088:                        budgetForm.getBudgetDocument().getBudget()
089:                                .getBudgetIndirectCostLookups());
090:
091:                // we are only saving indirect cost items, so load the doc and
092:                // set the indirect cost items to the proper ones.
093:                this .load(mapping, form, request, response);
094:                budgetForm.getBudgetDocument().getBudget().setIndirectCost(
095:                        indirectCost);
096:                budgetForm
097:                        .getBudgetDocument()
098:                        .getBudget()
099:                        .setBudgetIndirectCostLookups(budgetIndirectCostLookups);
100:
101:                super .save(mapping, form, request, response);
102:
103:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
104:            }
105:
106:            /**
107:             * Recalculate values based on updated IDC parameters. If there are errors in the new parameters, do not do the recalculations.
108:             * 
109:             * @param mapping
110:             * @param form
111:             * @param request
112:             * @param response
113:             * @return ActionForward
114:             * @throws Exception
115:             */
116:            public ActionForward recalculate(ActionMapping mapping,
117:                    ActionForm form, HttpServletRequest request,
118:                    HttpServletResponse response) throws Exception {
119:
120:                BudgetForm budgetForm = (BudgetForm) form;
121:
122:                // Check to make sure our rules are passed.
123:                boolean rulePassed = SpringContext.getBean(
124:                        KualiRuleService.class).applyRules(
125:                        new RecalculateIndirectCostEvent(budgetForm
126:                                .getDocument()));
127:
128:                // If our rule passed, update all our values. Otherwise, reload the page.
129:                if (rulePassed) {
130:
131:                    // Make sure our IDC object is properly formed. This will also perform initial calculations for
132:                    // BudgetTaskPeriodIndirectCost objects.
133:                    SpringContext
134:                            .getBean(BudgetIndirectCostService.class)
135:                            .refreshIndirectCost(budgetForm.getBudgetDocument());
136:
137:                    // This will populate task and period totals in HashMaps so they can be pulled in the view.
138:                    budgetForm
139:                            .setBudgetIndirectCostFormHelper(new BudgetIndirectCostFormHelper(
140:                                    budgetForm));
141:                }
142:
143:                return this .update(mapping, form, request, response);
144:            }
145:
146:            public ActionForward reload(ActionMapping mapping, ActionForm form,
147:                    HttpServletRequest request, HttpServletResponse response)
148:                    throws Exception {
149:                ActionForward forward = super .reload(mapping, form, request,
150:                        response);
151:
152:                BudgetForm budgetForm = (BudgetForm) form;
153:                SpringContext.getBean(BudgetIndirectCostService.class)
154:                        .refreshIndirectCost(budgetForm.getBudgetDocument());
155:                budgetForm
156:                        .setBudgetIndirectCostFormHelper(new BudgetIndirectCostFormHelper(
157:                                budgetForm));
158:
159:                return forward;
160:            }
161:        }
ww___w_._j___av___a__2_s__._co___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.