//===========================================================================
// package
//===========================================================================
package jp.gr.java_conf.bugslife.form;

//===========================================================================
// import
//===========================================================================
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import org.apache.struts.validator.ValidatorForm;
import java.io.UnsupportedEncodingException;

import jp.gr.java_conf.bugslife.util.Varidater;

/**
 *<PRE>
 * ForgetPasswordFormクラス
 *
 *</PRE>
 * @author Masahiro Wanikawa
 * @version 1.0.0
 */
public class ForgotPasswordForm extends ValidatorForm {
//===========================================================================
// attributes
//===========================================================================
	/**
	 * アクション
	 */
	private String m_action;
	/**
	 * E-mail
	 */
	private String m_email;
	/**
	 * result
	 */
	private String m_result;
	/**
	 * Log
	 */
	private Log log = LogFactory.getLog(this.getClass().getName());
//===========================================================================
// methods
//===========================================================================
	/**
	 * アクションの取得
	 * 
	 * @return アクション
	 */
	public String getAction()
	{
		return m_action;
	}
	/**
	 * アクションのセット
	 * 
	 * @param action アクション
	 */
	public void setAction(String action)
	{
		m_action = action;
	}
	/**
	 * E-mailのセット
	 * 
	 * @param email E-mail
	 */
	public void setEmail(String email) {
		m_email = email;
	}
	/**
	 * E-mailの取得
	 * 
	 * @return E-mail
	 */
	public String getEmail() {
		return m_email;
	}
	/**
	 * 結果lのセット
	 * 
	 * @param email E-mail
	 */
	public void setResult(String result) {
		m_result = result;
	}
	/**
	 * 結果の取得
	 * 
	 * @return result
	 */
	public String getResult() {
		return m_result;
	}
//===========================================================================
// Public Methods
//===========================================================================
	/**
	* リセット
	*
	* @param mapping The mapping used to select this instance
	* @param request The servlet request we are processing
	*/
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		//debug
		log.debug("reset");
		//encodeing セット
		try {
			request.setCharacterEncoding("SJIS");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		
		m_action = null;
		m_email = null;
		m_result = null;
	}
	/**
	* Validate 
	*
	* @param mapping The mapping used to select this instance
	* @param request The servlet request we are processing
	*/
	public ActionErrors validate(ActionMapping mapping,
								 HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		
		if (Varidater.checkRequired(m_email, "email", errors)) {
/*-----------------------------------------
			Varidater.checkEmail(m_email, "email", errors);
-----------------------------------------*/
		}
		return errors;
	}
}