Source Code Cross Referenced for BudgetCostShareAction.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.kfs.KFSConstants;
028:        import org.kuali.module.kra.budget.bo.Budget;
029:        import org.kuali.module.kra.budget.bo.BudgetInstitutionCostShare;
030:        import org.kuali.module.kra.budget.bo.BudgetPeriod;
031:        import org.kuali.module.kra.budget.bo.BudgetThirdPartyCostShare;
032:        import org.kuali.module.kra.budget.web.struts.form.BudgetCostShareFormHelper;
033:        import org.kuali.module.kra.budget.web.struts.form.BudgetForm;
034:
035:        /**
036:         * Action for BudgetCostShare page.
037:         */
038:        public class BudgetCostShareAction extends BudgetAction {
039:
040:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
041:                    .getLogger(BudgetParametersAction.class);
042:
043:            /**
044:             * Data preparation for Cost Share page.
045:             * 
046:             * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm,
047:             *      javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
048:             */
049:            public ActionForward execute(ActionMapping mapping,
050:                    ActionForm form, HttpServletRequest request,
051:                    HttpServletResponse response) throws Exception {
052:                BudgetForm budgetForm = (BudgetForm) form;
053:                Budget budget = budgetForm.getBudgetDocument().getBudget();
054:
055:                // Partial re-load to avoid lots of hidden variables.
056:                budget.refreshReferenceObject("personnel");
057:                budget.refreshReferenceObject("nonpersonnelItems");
058:                budget.refreshReferenceObject("indirectCost");
059:
060:                // super.execute has to be called before re-creating BudgetCostShareFormHelper because the super call may
061:                // completly reload data such as for example for the reload button
062:                ActionForward forward = super .execute(mapping, form, request,
063:                        response);
064:
065:                budgetForm
066:                        .setBudgetCostShareFormHelper(new BudgetCostShareFormHelper(
067:                                budgetForm));
068:
069:                setupBudgetCostSharePermissionDisplay(budgetForm);
070:
071:                return forward;
072:            }
073:
074:            /**
075:             * Recalculate button.
076:             * 
077:             * @param mapping
078:             * @param form
079:             * @param request
080:             * @param response
081:             * @return
082:             * @throws Exception
083:             */
084:            public ActionForward recalculate(ActionMapping mapping,
085:                    ActionForm form, HttpServletRequest request,
086:                    HttpServletResponse response) throws Exception {
087:
088:                // execute method already does this work.
089:
090:                return super .update(mapping, form, request, response);
091:            }
092:
093:            /**
094:             * Insert Institution Cost Share button.
095:             * 
096:             * @param mapping
097:             * @param form
098:             * @param request
099:             * @param response
100:             * @return
101:             * @throws Exception
102:             */
103:            public ActionForward insertInstitutionCostShareDirect(
104:                    ActionMapping mapping, ActionForm form,
105:                    HttpServletRequest request, HttpServletResponse response)
106:                    throws Exception {
107:                BudgetForm budgetForm = (BudgetForm) form;
108:
109:                // Add the new institution cost share item and create a new one
110:                budgetForm.getBudgetDocument()
111:                        .addInstitutionCostShare(
112:                                budgetForm.getBudgetDocument().getBudget()
113:                                        .getPeriods(),
114:                                budgetForm.getNewInstitutionCostShare());
115:                budgetForm
116:                        .setNewInstitutionCostShare(new BudgetInstitutionCostShare());
117:
118:                // Make sure new values are taken into account for calculations.
119:                budgetForm
120:                        .setBudgetCostShareFormHelper(new BudgetCostShareFormHelper(
121:                                budgetForm));
122:                budgetForm.getNewInstitutionCostShare().setPermissionIndicator(
123:                        true);
124:
125:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
126:            }
127:
128:            /**
129:             * Delete Institution Cost Share button.
130:             * 
131:             * @param mapping
132:             * @param form
133:             * @param request
134:             * @param response
135:             * @return
136:             * @throws Exception
137:             */
138:            public ActionForward deleteInstitutionCostShareDirect(
139:                    ActionMapping mapping, ActionForm form,
140:                    HttpServletRequest request, HttpServletResponse response)
141:                    throws Exception {
142:                BudgetForm budgetForm = (BudgetForm) form;
143:
144:                budgetForm.getBudgetDocument().getBudget()
145:                        .getInstitutionCostShareItems().remove(
146:                                getLineToDelete(request));
147:
148:                // Make sure new values are taken into account for calculations.
149:                budgetForm
150:                        .setBudgetCostShareFormHelper(new BudgetCostShareFormHelper(
151:                                budgetForm));
152:
153:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
154:            }
155:
156:            /**
157:             * Insert Third Party Cost Share button.
158:             * 
159:             * @param mapping
160:             * @param form
161:             * @param request
162:             * @param response
163:             * @return
164:             * @throws Exception
165:             */
166:            public ActionForward insertThirdPartyCostShareDirect(
167:                    ActionMapping mapping, ActionForm form,
168:                    HttpServletRequest request, HttpServletResponse response)
169:                    throws Exception {
170:                BudgetForm budgetForm = (BudgetForm) form;
171:
172:                // Add the new third party cost share item and create a new one
173:                budgetForm.getBudgetDocument()
174:                        .addThirdPartyCostShare(
175:                                budgetForm.getBudgetDocument().getBudget()
176:                                        .getPeriods(),
177:                                budgetForm.getNewThirdPartyCostShare());
178:                budgetForm
179:                        .setNewThirdPartyCostShare(new BudgetThirdPartyCostShare());
180:
181:                // Make sure new values are taken into account for calculations.
182:                budgetForm
183:                        .setBudgetCostShareFormHelper(new BudgetCostShareFormHelper(
184:                                budgetForm));
185:
186:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
187:            }
188:
189:            /**
190:             * Delete Third Party Cost Share button.
191:             * 
192:             * @param mapping
193:             * @param form
194:             * @param request
195:             * @param response
196:             * @return
197:             * @throws Exception
198:             */
199:            public ActionForward deleteThirdPartyCostShare(
200:                    ActionMapping mapping, ActionForm form,
201:                    HttpServletRequest request, HttpServletResponse response)
202:                    throws Exception {
203:                BudgetForm budgetForm = (BudgetForm) form;
204:
205:                budgetForm.getBudgetDocument().getBudget()
206:                        .getThirdPartyCostShareItems().remove(
207:                                getLineToDelete(request));
208:
209:                // Make sure new values are taken into account for calculations.
210:                budgetForm
211:                        .setBudgetCostShareFormHelper(new BudgetCostShareFormHelper(
212:                                budgetForm));
213:
214:                return mapping.findForward(KFSConstants.MAPPING_BASIC);
215:            }
216:
217:            /**
218:             * Save button.
219:             * 
220:             * @param mapping
221:             * @param form
222:             * @param request
223:             * @param response
224:             * @return
225:             * @throws Exception
226:             */
227:            public ActionForward saveBudgetCostShare(ActionMapping mapping,
228:                    ActionForm form, HttpServletRequest request,
229:                    HttpServletResponse response) throws Exception {
230:                BudgetForm budgetForm = (BudgetForm) form;
231:                Budget budget = budgetForm.getBudgetDocument().getBudget();
232:                List<BudgetPeriod> periods = budgetForm.getBudgetDocument()
233:                        .getBudget().getPeriods();
234:
235:                Integer institutionCostShareNextSequenceNumber = budgetForm
236:                        .getBudgetDocument()
237:                        .getInstitutionCostShareNextSequenceNumber();
238:                Integer thirdPartyCostShareNextSequenceNumber = budgetForm
239:                        .getBudgetDocument()
240:                        .getThirdPartyCostShareNextSequenceNumber();
241:                List institutionCostShare = new ArrayList(budget
242:                        .getInstitutionCostShareItems());
243:                List institutionCostSharePersonnel = new ArrayList(budget
244:                        .getInstitutionCostSharePersonnelItems());
245:                List thirdPartyCostShare = new ArrayList(budget
246:                        .getThirdPartyCostShareItems());
247:
248:                this .load(mapping, form, request, response);
249:
250:                // Only set the objects that potentially changed. The interface doesn't keep hiddens for fields that arn't used. Careful
251:                // not to use "budget" variable above, that doesn't effect budgetForm.
252:                if (budget.isInstitutionCostShareIndicator()) {
253:                    budgetForm.getBudgetDocument()
254:                            .setInstitutionCostShareNextSequenceNumber(
255:                                    institutionCostShareNextSequenceNumber);
256:                    budgetForm.getBudgetDocument().getBudget()
257:                            .setInstitutionCostShareItems(institutionCostShare);
258:                    budgetForm.getBudgetDocument().getBudget()
259:                            .setInstitutionCostSharePersonnelItems(
260:                                    institutionCostSharePersonnel);
261:                }
262:                if (budget.isBudgetThirdPartyCostShareIndicator()) {
263:                    budgetForm.getBudgetDocument()
264:                            .setThirdPartyCostShareNextSequenceNumber(
265:                                    thirdPartyCostShareNextSequenceNumber);
266:                    budgetForm.getBudgetDocument().getBudget()
267:                            .setThirdPartyCostShareItems(thirdPartyCostShare);
268:                }
269:
270:                return super .save(mapping, form, request, response);
271:            }
272:
273:            @Override
274:            public ActionForward reload(ActionMapping mapping, ActionForm form,
275:                    HttpServletRequest request, HttpServletResponse response)
276:                    throws Exception {
277:                ActionForward forward = super .reload(mapping, form, request,
278:                        response);
279:                ((BudgetForm) form).getNewInstitutionCostShare()
280:                        .setPermissionIndicator(true);
281:                return forward;
282:            }
283:        }
ww__w__._j__a_v_a___2__s_.___c___om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.