/*
 * MosP - Mind Open Source Project    http://www.mosp.jp/
 * Copyright (C) MIND Co., Ltd.       http://www.e-mind.co.jp/
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package jp.mosp.kintai.schedule.vo;

import javax.servlet.http.HttpServletRequest;

import jp.mosp.common.CommonConst;
import jp.mosp.common.MosPMenuConst;
import jp.mosp.common.common.MospException;

/**
 * @author yoshida
 *
 */
public class ScheduleInputCardVo extends MosPScheduleVo {
	
	private static final long	serialVersionUID			= 7506588503963452011L;
	
	/*						
	 *  	2008/11/14	m.yoshida	予定登録機能追加対応
	 */
	// パラメータ名
	/**
	 * pltScheduleDay
	 */
	public static final String	PRM_PLT_SCHEDULE_DAY		= "pltScheduleDay";
	/**
	 * pltRotationCode
	 */
	public static final String	PRM_PLT_ROTATION_CODE		= "pltRotationCode";
	/**
	 * pltRotationDays
	 */
	public static final String	PRM_PLT_ROTATION_DAYS		= "pltRotationDays";
	/**
	 * pltWorkTypeCode
	 */
	public static final String	PRM_PLT_WORK_TYPE_CODE		= "pltWorkTypeCode";
	/**
	 * ckbSelectWorkType
	 */
	public static final String	PRM_CKB_SELECT_WORK_TYPE	= "ckbSelectWorkType";
	/**
	 * ckbSelectPeriod
	 */
	public static final String	PRM_CKB_SELECT_PERIOD		= "ckbSelectPeriod";
	
	/*						
	 *  	2008/11/14	m.yoshida	予定登録機能追加対応
	 */
	// フィールド名及び制限
	/**
	 * 
	 */
	public String				NAM_SCHEDULE_START;
	/**
	 * 
	 */
	public String				NAM_ROTATION_TYPE;
	/**
	 * 
	 */
	public String				NAM_ROTATION_DAYS;
	
	// フィールド
	private String				pltScheduleDay;
	private String				pltRotationCode;
	private String				pltRotationDays;
	
	private String				pltWorkTypeCode;
	private String				ckbSelectWorkType;
	private String				ckbSelectPeriod;
	
	// プルダウンリスト
	/**
	 * 
	 */
	public String[][]			aryPltScheduleYear;
	/**
	 * 
	 */
	public String[][]			aryPltScheduleMonth;
	/**
	 * 
	 */
	public String[][]			aryPltScheduleDay;
	/**
	 * 
	 */
	public String[][]			aryPltRotation;
	/**
	 * 
	 */
	public String[][]			aryPltDays;
	
	/**
	 * 
	 */
	public String[][]			aryPltWorkType;
	

	/**
	 * コンストラクタ
	 */
	public ScheduleInputCardVo() {
		super();
		setViewPath(getClassName());
		initFields();
	}
	
	@Override
	protected void setSubTitle() {
		subTitle = CommonConst.TTL_SCHEDULE_INPUT;
		aryMenu = new String[][]{ { CMD_MENU_INPUT, CommonConst.NAM_TO_MENU }, MosPMenuConst.getMenuSchedule() };
	}
	
	@Override
	protected void setFieldsName() {
		NAM_SCHEDULE_START = CommonConst.NAM_TARGET_MONTH;
		NAM_ROTATION_TYPE = CommonConst.NAM_WORKING_TYPE;
		NAM_ROTATION_DAYS = CommonConst.NAM_NUMBER_OF_DAYS;
	}
	
	@Override
	public void setParams(HttpServletRequest request) {
		super.setParams(request);
		pltScheduleDay = request.getParameter(PRM_PLT_SCHEDULE_DAY);
		pltRotationCode = request.getParameter(PRM_PLT_ROTATION_CODE);
		pltRotationDays = request.getParameter(PRM_PLT_ROTATION_DAYS);
		pltWorkTypeCode = request.getParameter(PRM_PLT_WORK_TYPE_CODE);
		ckbSelectWorkType = getCheckBoxParam(request.getParameter(PRM_CKB_SELECT_WORK_TYPE));
		ckbSelectPeriod = getCheckBoxParam(request.getParameter(PRM_CKB_SELECT_PERIOD));
	}
	
	/**
	 * フィールド初期化
	 */
	public void initFields() {
		pltScheduleDay = "";
		pltRotationCode = "";
		pltRotationDays = "";
	}
	
	/**
	 * フィールドの妥当性確認
	 * @throws MospException MosP例外処理が発生した場合
	 */
	public void validate() throws MospException {
		// 妥当性確認開始時処理
		startValidation();
		if (ckbSelectPeriod.equals(CommonConst.NAM_DEFAULT_FLAG_ON)) {
			checkDate(getIntParam(getPltYear()), getIntParam(getPltMonth()), getIntParam(pltScheduleDay),
					NAM_SCHEDULE_START, PRM_PLT_SCHEDULE_DAY);
		}
		// 妥当性確認終了時処理
		endValidation();
	}
	
	/**
	 * @return pltScheduleDay
	 */
	public String getPltScheduleDay() {
		return pltScheduleDay;
	}
	
	/**
	 * @return pltRotationCode
	 */
	public String getPltRotationCode() {
		return pltRotationCode;
	}
	
	/**
	 * @return pltRotationDays
	 */
	public String getPltRotationDays() {
		return pltRotationDays;
	}
	
	/**
	 * @return pltWorkTypeCode
	 */
	public String getPltWorkTypeCode() {
		return pltWorkTypeCode;
	}
	
	/**
	 * @return ckbSelectWorkType
	 */
	public String getCkbSelectWorkType() {
		return ckbSelectWorkType;
	}
	
	/**
	 * @return ckbSelectPeriod
	 */
	public String getCkbSelectPeriod() {
		return ckbSelectPeriod;
	}
	
	/**
	 * @param pltScheduleDay セットする pltScheduleDay
	 */
	public void setPltScheduleDay(String pltScheduleDay) {
		this.pltScheduleDay = pltScheduleDay;
	}
	
	/**
	 * @param pltRotationCode セットする pltRotationCode
	 */
	public void setPltRotationCode(String pltRotationCode) {
		this.pltRotationCode = pltRotationCode;
	}
	
	/**
	 * @param pltRotationDays セットする pltRotationDays
	 */
	public void setPltRotationDays(String pltRotationDays) {
		this.pltRotationDays = pltRotationDays;
	}
	
	/**
	 * @param pltWorkTypeCode セットする pltWorkTypeCode
	 */
	public void setPltWorkTypeCode(String pltWorkTypeCode) {
		this.pltWorkTypeCode = pltWorkTypeCode;
	}
	
	/**
	 * @param ckbSelectWorkType セットする ckbSelectWorkType
	 */
	public void setCkbSelectWorkType(String ckbSelectWorkType) {
		this.ckbSelectWorkType = ckbSelectWorkType;
	}
	
	/**
	 * @param ckbSelectPeriod セットする ckbSelectPeriod
	 */
	public void setCkbSelectPeriod(String ckbSelectPeriod) {
		this.ckbSelectPeriod = ckbSelectPeriod;
	}
	
}
