SimpleFormAction.java :  » Web-Framework » Strecks » org » strecks » action » basic » impl » Java Open Source

Java Open Source » Web Framework » Strecks 
Strecks » org » strecks » action » basic » impl » SimpleFormAction.java
/*
 * Copyright 2005-2006 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package org.strecks.action.basic.impl;

import org.strecks.action.BasicFormAction;
import org.strecks.action.basic.BasicFormController;
import org.strecks.controller.annotation.Controller;
import org.strecks.injection.annotation.InjectActionForm;
import org.strecks.injection.annotation.InjectRequestParameter;
import org.strecks.injection.annotation.InjectSpringBean;

/**
 * @author Phil Zoio
 */
@Controller(name = BasicFormController.class)
public class SimpleFormAction implements BasicFormAction
{

  private boolean inputError;

  private Long holidayBookingId;

  private HolidayBookingService holidayBookingService;

  private HolidayBookingForm form;

  public String execute()
  {
    if (!isInputError())
    {
      HolidayBooking holidayBooking = holidayBookingService.getHolidayBooking(holidayBookingId);
      form.setBooking(holidayBooking);
      form.setEditMode(true);
    }
    return "success";
  }

  public boolean isInputError()
  {
    return inputError;
  }

  @InjectRequestParameter
  public void setInputError(boolean inputError)
  {
    this.inputError = inputError;
  }

  @InjectRequestParameter
  public void setHolidayBookingId(Long holidayBookingId)
  {
    this.holidayBookingId = holidayBookingId;
  }

  @InjectSpringBean(name = "holidayBookingService")
  public void setHolidayBookingService(HolidayBookingService holidayBookingService)
  {
    this.holidayBookingService = holidayBookingService;
  }

  @InjectActionForm
  public void setForm(HolidayBookingForm form)
  {
    this.form = form;
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.