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.labor.web.struts.action;
17:
18: import javax.servlet.http.HttpServletRequest;
19: import javax.servlet.http.HttpServletResponse;
20:
21: import org.apache.struts.action.ActionForm;
22: import org.apache.struts.action.ActionForward;
23: import org.apache.struts.action.ActionMapping;
24: import org.kuali.core.web.struts.form.KualiDocumentFormBase;
25: import org.kuali.module.labor.bo.LedgerBalance;
26: import org.kuali.module.labor.document.SalaryExpenseTransferDocument;
27: import org.kuali.module.labor.util.ObjectUtil;
28: import org.kuali.module.labor.web.struts.form.ExpenseTransferDocumentFormBase;
29: import org.kuali.module.labor.web.struts.form.SalaryExpenseTransferForm;
30:
31: /**
32: * Struts action class for Salary Expense Transfer Document. This class extends the parent KualiTransactionalDocumentActionBase
33: * class, which contains all common action methods. Since the SEP follows the basic transactional document pattern, there are no
34: * specific actions that it has to implement; however, this empty class is necessary for integrating into the framework.
35: */
36: public class SalaryExpenseTransferAction extends
37: ExpenseTransferDocumentActionBase {
38: /**
39: * Resets lookup fields for salary expense transfer action
40: *
41: * @see org.kuali.module.labor.web.struts.action.ExpenseTransferDocumentActionBase#resetLookupFields(org.kuali.module.labor.web.struts.form.ExpenseTransferDocumentFormBase, org.kuali.module.labor.bo.LedgerBalance)
42: */
43: @Override
44: protected void resetLookupFields(
45: ExpenseTransferDocumentFormBase expenseTransferDocumentForm,
46: LedgerBalance balance) {
47: SalaryExpenseTransferForm benefitExpenseTransferForm = (SalaryExpenseTransferForm) expenseTransferDocumentForm;
48: ObjectUtil.buildObject(benefitExpenseTransferForm, balance);
49: }
50:
51: /**
52: * If user is approving document, capture the object code balances for comparison in business rules on route
53: *
54: * @see org.kuali.core.web.struts.action.KualiDocumentActionBase#docHandler(org.apache.struts.action.ActionMapping,
55: * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
56: */
57: @Override
58: public ActionForward docHandler(ActionMapping mapping,
59: ActionForm form, HttpServletRequest request,
60: HttpServletResponse response) throws Exception {
61: ActionForward forward = super .docHandler(mapping, form,
62: request, response);
63:
64: SalaryExpenseTransferDocument salaryExpenseDocument = (SalaryExpenseTransferDocument) ((KualiDocumentFormBase) form)
65: .getDocument();
66: if (salaryExpenseDocument.getDocumentHeader()
67: .getWorkflowDocument().isApprovalRequested()) {
68: salaryExpenseDocument
69: .setApprovalObjectCodeBalances(salaryExpenseDocument
70: .getUnbalancedObjectCodes());
71: }
72:
73: return forward;
74: }
75:
76: }
|