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.purap.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.kfs.context.SpringContext;
26: import org.kuali.module.purap.document.RequisitionDocument;
27: import org.kuali.module.purap.service.PurapService;
28: import org.kuali.module.purap.web.struts.form.RequisitionForm;
29:
30: import edu.iu.uis.eden.exception.WorkflowException;
31:
32: /**
33: * Struts Action for Requisition document.
34: */
35: public class RequisitionAction extends PurchasingActionBase {
36: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
37: .getLogger(RequisitionAction.class);
38:
39: /**
40: * Does initialization for a new requisition.
41: *
42: * @see org.kuali.core.web.struts.action.KualiDocumentActionBase#createDocument(org.kuali.core.web.struts.form.KualiDocumentFormBase)
43: */
44: @Override
45: protected void createDocument(
46: KualiDocumentFormBase kualiDocumentFormBase)
47: throws WorkflowException {
48: super .createDocument(kualiDocumentFormBase);
49: ((RequisitionDocument) kualiDocumentFormBase.getDocument())
50: .initiateDocument();
51: }
52:
53: /**
54: * @see org.kuali.core.web.struts.action.KualiAction#refresh(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 refresh(ActionMapping mapping,
59: ActionForm form, HttpServletRequest request,
60: HttpServletResponse response) throws Exception {
61: ActionForward forward = super .refresh(mapping, form, request,
62: response);
63: RequisitionForm rqForm = (RequisitionForm) form;
64: RequisitionDocument document = (RequisitionDocument) rqForm
65: .getDocument();
66:
67: // super.refresh() must occur before this line to get the correct APO limit
68: document
69: .setOrganizationAutomaticPurchaseOrderLimit(SpringContext
70: .getBean(PurapService.class)
71: .getApoLimit(
72: document
73: .getVendorContractGeneratedIdentifier(),
74: document.getChartOfAccountsCode(),
75: document.getOrganizationCode()));
76:
77: return forward;
78: }
79:
80: }
|