01: /*
02: * Copyright 2005-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
05: * in compliance with the License. You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software distributed under the License
10: * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11: * or implied. See the License for the specific language governing permissions and limitations under
12: * the License.
13: */
14:
15: package org.strecks.action.basic.impl;
16:
17: import org.strecks.action.BasicFormAction;
18: import org.strecks.action.basic.BasicFormController;
19: import org.strecks.controller.annotation.Controller;
20: import org.strecks.injection.annotation.InjectActionForm;
21: import org.strecks.injection.annotation.InjectRequestParameter;
22: import org.strecks.injection.annotation.InjectSpringBean;
23:
24: /**
25: * @author Phil Zoio
26: */
27: @Controller(name=BasicFormController.class)
28: public class SimpleFormAction implements BasicFormAction {
29:
30: private boolean inputError;
31:
32: private Long holidayBookingId;
33:
34: private HolidayBookingService holidayBookingService;
35:
36: private HolidayBookingForm form;
37:
38: public String execute() {
39: if (!isInputError()) {
40: HolidayBooking holidayBooking = holidayBookingService
41: .getHolidayBooking(holidayBookingId);
42: form.setBooking(holidayBooking);
43: form.setEditMode(true);
44: }
45: return "success";
46: }
47:
48: public boolean isInputError() {
49: return inputError;
50: }
51:
52: @InjectRequestParameter
53: public void setInputError(boolean inputError) {
54: this .inputError = inputError;
55: }
56:
57: @InjectRequestParameter
58: public void setHolidayBookingId(Long holidayBookingId) {
59: this .holidayBookingId = holidayBookingId;
60: }
61:
62: @InjectSpringBean(name="holidayBookingService")
63: public void setHolidayBookingService(
64: HolidayBookingService holidayBookingService) {
65: this .holidayBookingService = holidayBookingService;
66: }
67:
68: @InjectActionForm
69: public void setForm(HolidayBookingForm form) {
70: this.form = form;
71: }
72:
73: }
|