01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.module.kra.budget.web.struts.action;
17:
18: import java.util.List;
19:
20: import javax.servlet.http.HttpServletRequest;
21: import javax.servlet.http.HttpServletResponse;
22:
23: import org.apache.struts.action.ActionForm;
24: import org.apache.struts.action.ActionForward;
25: import org.apache.struts.action.ActionMapping;
26: import org.kuali.core.bo.AdHocRouteWorkgroup;
27: import org.kuali.module.kra.bo.AdhocOrg;
28: import org.kuali.module.kra.bo.AdhocPerson;
29: import org.kuali.module.kra.budget.web.struts.form.BudgetForm;
30:
31: /**
32: * This class handles Actions for Research Administration permissions page.
33: */
34: public class BudgetPermissionsAction extends BudgetAction {
35:
36: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
37: .getLogger(BudgetPermissionsAction.class);
38:
39: @Override
40: public ActionForward save(ActionMapping mapping, ActionForm form,
41: HttpServletRequest request, HttpServletResponse response)
42: throws Exception {
43:
44: BudgetForm budgetForm = (BudgetForm) form;
45:
46: List adhocPermissions = budgetForm.getBudgetDocument()
47: .getAdhocPersons();
48: List adhocOrgs = budgetForm.getBudgetDocument().getAdhocOrgs();
49: List adhocWorkgroups = budgetForm.getBudgetDocument()
50: .getAdhocWorkgroups();
51:
52: this .load(mapping, budgetForm, request, response);
53:
54: budgetForm.getBudgetDocument()
55: .setAdhocPersons(adhocPermissions);
56: budgetForm.getBudgetDocument().setAdhocOrgs(adhocOrgs);
57: budgetForm.getBudgetDocument().setAdhocWorkgroups(
58: adhocWorkgroups);
59:
60: ActionForward forward = super .save(mapping, budgetForm,
61: request, response);
62:
63: budgetForm.getBudgetDocument().populateDocumentForRouting();
64: budgetForm.getBudgetDocument().getDocumentHeader()
65: .getWorkflowDocument().saveRoutingData();
66:
67: return forward;
68: }
69:
70: @Override
71: public ActionForward reload(ActionMapping mapping, ActionForm form,
72: HttpServletRequest request, HttpServletResponse response)
73: throws Exception {
74:
75: BudgetForm budgetForm = (BudgetForm) form;
76:
77: budgetForm.setNewAdHocPerson(new AdhocPerson());
78: budgetForm.setNewAdHocOrg(new AdhocOrg());
79: budgetForm.setNewAdHocRouteWorkgroup(new AdHocRouteWorkgroup());
80: budgetForm.setNewAdHocWorkgroupPermissionCode("");
81:
82: ActionForward forward = super.reload(mapping, budgetForm,
83: request, response);
84:
85: return forward;
86: }
87: }
|