01: /*
02: * Copyright 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 edu.sampleu.travel.web.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.RiceConstants;
25: import org.kuali.core.web.struts.action.KualiDocumentActionBase;
26: import org.kuali.rice.KNSServiceLocator;
27:
28: import edu.sampleu.travel.bo.TravelAccount;
29: import edu.sampleu.travel.document.TravelDocument2;
30: import edu.sampleu.travel.web.form.TravelDocumentForm2;
31:
32: public class TravelDocumentAction2 extends KualiDocumentActionBase {
33:
34: public ActionForward insertAccount(ActionMapping mapping,
35: ActionForm form, HttpServletRequest request,
36: HttpServletResponse response) throws Exception {
37: TravelDocumentForm2 travelForm = (TravelDocumentForm2) form;
38: TravelAccount travAcct = (TravelAccount) KNSServiceLocator
39: .getBusinessObjectService().retrieve(
40: travelForm.getTravelAccount());
41: ((TravelDocument2) travelForm.getDocument())
42: .getTravelAccounts().add(travAcct);
43: travelForm.setTravelAccount(new TravelAccount());
44: return mapping.findForward(RiceConstants.MAPPING_BASIC);
45: }
46:
47: }
|