/*
 * MosP - Mind Open Source Project         http://www.mosp.jp/
 * Copyright (C) 1987-2008 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.system.vo;

import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import jp.mosp.common.CommonConst;
import jp.mosp.common.common.MospException;
import jp.mosp.common.vo.MosPVo;

import jp.mosp.system.dto.MCodeDto;

public class KintaiSystemDefinitionCardVo extends MosPVo {

	private static final long serialVersionUID = 3394177285993796216L;

	// URL、JSファイル、CSSファイル
	private static final String RETURN_URL = "/jsp/system/kintaiSystemDefinitionCard.jsp";
	private static final String EXTRA_JS   = "/pub/system/js/kintaiSystemDefinitionCard.js";
	private static final String EXTRA_CSS  = "/pub/system/css/kintaiSystemDefinitionCard.css";

	// 画面サブタイトル
	public final String SUB_TITLE = CommonConst.TTL_WORK_SYSTEM_DEFINE;

	// 定数
	public static final int MODE_UPDATE = 1;

	// パラメータ名
	public static final String PRM_TXT_STATUTORY_HOUR			= "txtStatutoryHours";
	public static final String PRM_TXT_STATUTORY_WEEK			= "txtStatutoryWeek";
	public static final String PRM_TXT_STATUTORY_MONTH_HOURS 	= "txtStatutoryMonthHours";
	public static final String PRM_TXT_STATUTORY_MONTH_DAYS 	= "txtStatutoryMonthDays";
	public static final String PRM_PLT_CALCULATION_MONTH 		= "pltCalcMonth";
	public static final String PRM_TXT_CALCULATION_DAYS 		= "txtCalcDays";
	public static final String PRM_PLT_PROVIDED_MONTH 		= "pltProvidedMonth";
	public static final String PRM_TXT_PROVIDED_DAYS 			= "txtProvidedDays";
	public static final String PRM_TXT_INPUT_UNIT_TIMES 		= "txtInputUnit";
	public static final String PRM_PLT_AUTOMATIC_CALCULATION 	= "pltAutoCalc";
	public static final String PRM_TXT_ALL_HOLIDAY_HOUR 		= "txtAllHolidayHour";
	public static final String PRM_TXT_ALL_HOLIDAY_MIN 		= "txtAllHolidayMin";
	public static final String PRM_TXT_HALF_HOLIDAY_HOUR 		= "txtHalfHolidayHour";
	public static final String PRM_TXT_HALF_HOLIDAY_MIN 		= "txtHalfHolidayMin";	
	public static final String PRM_TXT_LATE_NIGHT_START_HOUR	= "txtLateNightStartHour";
	public static final String PRM_TXT_LATE_NIGHT_START_MIN 	= "txtLateNightStartMin";
	public static final String PRM_TXT_LATE_NIGHT_TIME_HOUR 	= "txtLateNightTimeHour";
	public static final String PRM_TXT_LATE_NIGHT_TIME_MIN 	= "txtLateNightTimeMin";

	public static final String PRM_TXT_PASSWORD_TERM 			= "txtPasswordTerm";

	// フィールド
	private String	txtStatutoryHours;
	private String	txtStatutoryWeek;
	private String	txtStatutoryMonthHours;
	private String	txtStatutoryMonthDays;
	private String	pltCalcMonth;
	private String	txtCalcDays;
	private String	pltProvidedMonth;
	private String	txtProvidedDays;
	private String	txtInputUnit;
	private String	pltAutoCalc;
	private String	txtAllHolidayHour;
	private String	txtAllHolidayMin;
	private String	txtHalfHolidayHour;
	private String	txtHalfHolidayMin;
	private String	txtLateNightStartHour;
	private String	txtLateNightStartMin;
	private String	txtLateNightTimeHour;
	private String	txtLateNightTimeMin;

	private String	txtPasswordTerm;

	// プルダウンリスト
	public String[][] aryPltAutoCalc;
	public String[][] aryPltCalcMonth;
	public String[][] aryPltProvidedMonth;

	// モード(1：更新)
	private int mode;

	// フィールド名及び制限
	public static final String NAM_STATUTORY_HOUR				= CommonConst.NAM_UNIT_DAY + CommonConst.NAM_STATUTORY_HOUR;
	public static final String NAM_STATUTORY_WEEK				= CommonConst.NAM_UNIT_WEEK + CommonConst.NAM_STATUTORY_HOUR;
	public static final String NAM_STATUTORY_MONTH_HOURS		= CommonConst.NAM_UNIT_MONTHRY + CommonConst.NAM_STATUTORY_HOUR;
	public static final String NAM_STATUTORY_MONTH_DAYS		= CommonConst.NAM_UNIT_MONTHRY + CommonConst.NAM_STATUTORY_DAYS;
	public static final String NAM_CALCULATION 				= CommonConst.NAM_CONFIRM_ATTENDANCE + CommonConst.NAM_PERIOD_DATE;
	public static final String NAM_PROVIDED 					= CommonConst.NAM_CONFIRM_PAYMENT + CommonConst.NAM_PROVIDED_DATE ;
	public static final String NAM_INPUT_UNIT_TIMES 			= CommonConst.NAM_COMMON_INPUT + CommonConst.NAM_UNIT;
	public static final String NAM_AUTOMATIC_CALCULATION 		= CommonConst.NAM_AUTOMATIC_CALCULATION;
	public static final String NAM_VACATION_LEAVE 			= CommonConst.NAM_VACATION_LEAVE + CommonConst.NAM_COMMON_TIME;
	public static final String NAM_HOLIDAY_HOURS_ALL			= CommonConst.NAM_VACATION_LEAVE_ALL;
	public static final String NAM_HOLIDAY_HOURS_ALL_HOUR		= CommonConst.NAM_VACATION_LEAVE_ALL + CommonConst.MSG_HOUR;
	public static final String NAM_HOLIDAY_HOURS_ALL_MIN		= CommonConst.NAM_VACATION_LEAVE_ALL + CommonConst.MSG_MINUTES;
	public static final String NAM_HOLIDAY_HOURS_HALF			= CommonConst.NAM_VACATION_LEAVE_HALF;
	public static final String NAM_HOLIDAY_HOURS_HALF_HOUR	= CommonConst.NAM_VACATION_LEAVE_HALF + CommonConst.MSG_HOUR;
	public static final String NAM_HOLIDAY_HOURS_HALF_MIN		= CommonConst.NAM_VACATION_LEAVE_HALF + CommonConst.MSG_MINUTES;
	public static final String NAM_LATE_NIGHT_START 			= CommonConst.NAM_LATE_NIGHT + CommonConst.NAM_START + CommonConst.NAM_TIME;
	public static final String NAM_LATE_NIGHT_START_HOUR 		= CommonConst.NAM_LATE_NIGHT + CommonConst.NAM_START + CommonConst.NAM_TIME + CommonConst.MSG_HOUR;
	public static final String NAM_LATE_NIGHT_START_MIN 		= CommonConst.NAM_LATE_NIGHT + CommonConst.NAM_START + CommonConst.NAM_TIME + CommonConst.MSG_MINUTES;
	public static final String NAM_LATE_NIGHT_HOURS 			= CommonConst.NAM_LATE_NIGHT + CommonConst.NAM_COMMON_TIME;
	public static final String NAM_LATE_NIGHT_HOURS_HOUR 		= CommonConst.NAM_LATE_NIGHT + CommonConst.NAM_COMMON_TIME + CommonConst.MSG_HOUR;
	public static final String NAM_LATE_NIGHT_HOURS_MIN 		= CommonConst.NAM_LATE_NIGHT + CommonConst.NAM_COMMON_TIME + CommonConst.MSG_MINUTES;

	public static final String NAM_PASSWORD_TERM 				= CommonConst.NAM_PASSWORD + CommonConst.NAM_PASSWORD_TERM;

	public static final int	LEN_STATUTORY	= 5;
	public static final int	LEN_MONTH		= 1;
	public static final int	LEN_DAYS		= 2;
	public static final int	LEN_TIME		= 2;
	public static final int	LEN_INTEGER2 	= 2;
	public static final int	LEN_INTEGER3 	= 3;
	public static final int	LEN_DECIMAL 	= 1;

	public static final String REG_AUTOMATIC_CALCULATION = CommonConst.REG_DELETE;

	/**
	 * コンストラクタ
	 */
	public KintaiSystemDefinitionCardVo() {
		super();
		mode = 0;
		setExtraCss(EXTRA_CSS);
		addExtraJs(EXTRA_JS);
		setRetUrl(RETURN_URL);
	}

	/**
	 * 初期値設定
	 */	
	public void setDefaultValues(){
		setTxtStatutoryHours(CommonConst.NAM_COMMON_DOUBLE_INITIAL_VALUE);
		setTxtStatutoryWeek(CommonConst.NAM_COMMON_DOUBLE_INITIAL_VALUE);
		setTxtStatutoryMonthHours(CommonConst.NAM_COMMON_DOUBLE_INITIAL_VALUE);
		setTxtStatutoryMonthDays(CommonConst.NAM_COMMON_DOUBLE_INITIAL_VALUE);
		setPltCalcMonth(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtCalcDays(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setPltProvidedMonth(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtProvidedDays(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtInputUnit(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setPltAutoCalc(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtAllHolidayHour(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtAllHolidayMin(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtHalfHolidayHour(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtHalfHolidayMin(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtLateNightStartHour(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtLateNightStartMin(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtLateNightTimeHour(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
		setTxtLateNightTimeMin(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);

		setTxtPasswordTerm(CommonConst.NAM_COMMON_INTEGER_INITIAL_VALUE);
	}

	/**
	 * パラメータ設定
	 */
	public void setParams(HttpServletRequest request) {
		txtStatutoryHours 		= request.getParameter(PRM_TXT_STATUTORY_HOUR);
		txtStatutoryWeek 		= request.getParameter(PRM_TXT_STATUTORY_WEEK);
		txtStatutoryMonthHours 	= request.getParameter(PRM_TXT_STATUTORY_MONTH_HOURS);
		txtStatutoryMonthDays 	= request.getParameter(PRM_TXT_STATUTORY_MONTH_DAYS);
		pltCalcMonth 			= request.getParameter(PRM_PLT_CALCULATION_MONTH);
		txtCalcDays 			= request.getParameter(PRM_TXT_CALCULATION_DAYS);
		pltProvidedMonth 		= request.getParameter(PRM_PLT_PROVIDED_MONTH);
		txtProvidedDays 		= request.getParameter(PRM_TXT_PROVIDED_DAYS);
		txtInputUnit 			= request.getParameter(PRM_TXT_INPUT_UNIT_TIMES);
		pltAutoCalc 			= request.getParameter(PRM_PLT_AUTOMATIC_CALCULATION);
		txtAllHolidayHour 		= request.getParameter(PRM_TXT_ALL_HOLIDAY_HOUR);
		txtAllHolidayMin 		= request.getParameter(PRM_TXT_ALL_HOLIDAY_MIN);
		txtHalfHolidayHour 		= request.getParameter(PRM_TXT_HALF_HOLIDAY_HOUR);
		txtHalfHolidayMin 		= request.getParameter(PRM_TXT_HALF_HOLIDAY_MIN);
		txtLateNightStartHour 	= request.getParameter(PRM_TXT_LATE_NIGHT_START_HOUR);
		txtLateNightStartMin 	= request.getParameter(PRM_TXT_LATE_NIGHT_START_MIN);
		txtLateNightTimeHour 	= request.getParameter(PRM_TXT_LATE_NIGHT_TIME_HOUR);
		txtLateNightTimeMin 	= request.getParameter(PRM_TXT_LATE_NIGHT_TIME_MIN);

		txtPasswordTerm			= request.getParameter(PRM_TXT_PASSWORD_TERM);
	}

	/**
	 * フィールド設定
	 * @param listStatutory		法廷労働時間リスト 
	 */
	public void setFieldStatutoryHours(List listStatutory) {
		// データの設定
		Iterator it = listStatutory.iterator();
		while (it.hasNext()) {
			MCodeDto dto = (MCodeDto)it.next();
			// 一日法定労働時間
			if (dto.getTCode().equals(CommonConst.TCD_STATUTORY_HOUR)) {
				txtStatutoryHours = dto.getTChange();
			}
			// 週間法定労働時間
			if (dto.getTCode().equals(CommonConst.TCD_STATUTORY_DAYS)) {
				txtStatutoryWeek = dto.getTChange();
			}
		}
	}

	/**
	 * フィールド設定
	 * @param listStatutory		法定労働時間リスト 
	 */
	public void setFieldStatutoryMonth(List listStatutory) {
		// データの設定
		Iterator it = listStatutory.iterator();
		while (it.hasNext()) {
			MCodeDto dto = (MCodeDto)it.next();
			// 月間法定労働時間
			if (dto.getTCode().equals(CommonConst.TCD_STATUTORY_HOUR)) {
				txtStatutoryMonthHours = dto.getTChange();
			}
			// 月間法定労働日数
			if (dto.getTCode().equals(CommonConst.TCD_STATUTORY_DAYS)) {
				txtStatutoryMonthDays = dto.getTChange();
			}
		}
	}

	/**
	 * フィールド設定
	 * @param listCalc		締め日コードリスト 
	 */
	public void setFieldCalc(List listCalc) {
		// データの設定
		Iterator it = listCalc.iterator();
		while (it.hasNext()) {
			MCodeDto dto = (MCodeDto)it.next();
			// 勤怠締月
			if (dto.getTCode().equals(CommonConst.TCD_MONTH)) {
				pltCalcMonth = dto.getTChange();
			}
			// 勤怠締日
			if (dto.getTCode().equals(CommonConst.TCD_DAYS)) {
				txtCalcDays = dto.getTChange();
			}
		}
	}

	/**
	 * フィールド設定
	 * @param listProvided		支給月日リスト 
	 */
	public void setFieldProvided(List listProvided) {
		// データの設定
		Iterator it = listProvided.iterator();
		while (it.hasNext()) {
			MCodeDto dto = (MCodeDto)it.next();
			// 給与支給月
			if (dto.getTCode().equals(CommonConst.TCD_MONTH)) {
				pltProvidedMonth = dto.getTChange();
			}
			// 給与支給日
			if (dto.getTCode().equals(CommonConst.TCD_DAYS)) {
				txtProvidedDays = dto.getTChange();
			}
		}
	}

	/**
	 * フィールド設定
	 * @param dto 
	 */
	public void setFieldInputUnit(MCodeDto dto) {
		txtInputUnit = dto.getTChange();
	}

	/**
	 * フィールド設定
	 * @param listSys		システムコードリスト 
	 */
	public void setFieldWorkSystem(List listSys) {
		// データの設定
		Iterator it = listSys.iterator();
		while (it.hasNext()) {
			MCodeDto dto = (MCodeDto)it.next();
			// 自動計算
			if (dto.getTCode().equals(CommonConst.TCD_AUTOMATIC_CALCULATION)) {
				pltAutoCalc = dto.getTChange();
			}
			// 全休、半休
			if (dto.getTCode().equals(CommonConst.TCD_HOLIDAY_HOURS)) {
				txtAllHolidayHour = dto.getTChange().substring(0, 2);
				txtAllHolidayMin = dto.getTChange().substring(3, 5);
				txtHalfHolidayHour = dto.getTChange().substring(6, 8);
				txtHalfHolidayMin = dto.getTChange().substring(9, 11);
			}
			if (dto.getTCode().equals(CommonConst.TCD_LATE_NIGHT)) {
				txtLateNightStartHour = dto.getTChange().substring(0, 2);
				txtLateNightStartMin = dto.getTChange().substring(3, 5);
				txtLateNightTimeHour = dto.getTChange().substring(6, 8);
				txtLateNightTimeMin = dto.getTChange().substring(9, 11);
			}
		}
	}

	/**
	 * フィールド設定
	 * @param days	パスワード有効日数 
	 */
	public void setFieldPasswordTerm(String days) {
		txtPasswordTerm = days;
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldStatutoryHours(MCodeDto dto) {
		dto.setTId(CommonConst.TID_STATUTORY);
		dto.setTCode(CommonConst.TCD_STATUTORY_HOUR);
		dto.setTName("");
		dto.setTChange(txtStatutoryHours);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldStatutoryWeek(MCodeDto dto) {
		dto.setTId(CommonConst.TID_STATUTORY);
		dto.setTCode(CommonConst.TCD_STATUTORY_DAYS);
		dto.setTName("");
		dto.setTChange(txtStatutoryWeek);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldStatutoryMonthHours(MCodeDto dto) {
		dto.setTId(CommonConst.TID_STATUTORY_MONTH);
		dto.setTCode(CommonConst.TCD_STATUTORY_HOUR);
		dto.setTName("");
		dto.setTChange(txtStatutoryMonthHours);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldStatutoryMonthDays(MCodeDto dto) {
		dto.setTId(CommonConst.TID_STATUTORY_MONTH);
		dto.setTCode(CommonConst.TCD_STATUTORY_DAYS);
		dto.setTName("");
		dto.setTChange(txtStatutoryMonthDays);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldCalcMonth(MCodeDto dto) {
		dto.setTId(CommonConst.TID_CALCULATION);
		dto.setTCode(CommonConst.TCD_MONTH);
		dto.setTName(CommonConst.TNM_MONTH_MINUS);
		dto.setTChange(pltCalcMonth);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldCalcDays(MCodeDto dto) {
		dto.setTId(CommonConst.TID_CALCULATION);
		dto.setTCode(CommonConst.TCD_DAYS);
		dto.setTName(CommonConst.TNM_PERIOD_DATE);
		dto.setTChange(txtCalcDays);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldProvidedMonth(MCodeDto dto) {
		dto.setTId(CommonConst.TID_PROVIDED_DATE);
		dto.setTCode(CommonConst.TCD_MONTH);
		dto.setTName(CommonConst.TNM_MONTH_PLUS);
		dto.setTChange(pltProvidedMonth);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldProvidedDays(MCodeDto dto) {
		dto.setTId(CommonConst.TID_PROVIDED_DATE);
		dto.setTCode(CommonConst.TCD_DAYS);
		dto.setTName(CommonConst.TNM_PROVIDED_DATE);
		dto.setTChange(txtProvidedDays);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldInputUnit(MCodeDto dto) {
		dto.setTId(CommonConst.TID_INPUT_UNIT_TIMES);
		dto.setTCode(CommonConst.TCD_MINUTES);
		dto.setTName(CommonConst.TNM_AMOUNT_UNIT);
		dto.setTChange(txtInputUnit);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldAutoCalc(MCodeDto dto) {
		dto.setTId(CommonConst.TID_WORK_SYSTEM);
		dto.setTCode(CommonConst.TCD_AUTOMATIC_CALCULATION);
		dto.setTName(CommonConst.TNM_AMOUNT_UNIT);
		dto.setTChange(pltAutoCalc);
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldHoliday(MCodeDto dto) {
		dto.setTId(CommonConst.TID_WORK_SYSTEM);
		dto.setTCode(CommonConst.TCD_HOLIDAY_HOURS);
		dto.setTName(CommonConst.TNM_AMOUNT_UNIT);
		dto.setTChange(util.convStringToTimeCode(
				txtAllHolidayHour, txtAllHolidayMin,
				txtHalfHolidayHour, txtHalfHolidayMin));
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldLateNight(MCodeDto dto) {
		dto.setTId(CommonConst.TID_WORK_SYSTEM);
		dto.setTCode(CommonConst.TCD_LATE_NIGHT);
		dto.setTName(CommonConst.TNM_AMOUNT_UNIT);
		dto.setTChange(util.convStringToTimeCode(
				txtLateNightStartHour, txtLateNightStartMin,
				txtLateNightTimeHour, txtLateNightTimeMin));
	}

	/**
	 * フィールド設定(DTOに対するVO情報のセット)
	 * @param dto 設定対象DTO
	 */
	public void setDtoFieldPasswordTerm(MCodeDto dto) {
		dto.setTId(CommonConst.TID_PASSWORD_TERM);
		dto.setTCode("");
		dto.setTName("");
		dto.setTChange(txtPasswordTerm);
	}

	/**
	 * フィールドの妥当性確認
	 * @throws MospException
	 */
	public void validate() throws MospException {
		// 妥当性確認開始時処理
		startValidation();
		// 必須確認
		checkRequired(txtStatutoryHours		, NAM_STATUTORY_HOUR			, PRM_TXT_STATUTORY_HOUR);
		checkRequired(txtStatutoryWeek		, NAM_STATUTORY_WEEK			, PRM_TXT_STATUTORY_WEEK);
		checkRequired(txtStatutoryMonthHours, NAM_STATUTORY_MONTH_HOURS		, PRM_TXT_STATUTORY_MONTH_HOURS);
		checkRequired(txtStatutoryMonthDays	, NAM_STATUTORY_MONTH_DAYS		, PRM_TXT_STATUTORY_MONTH_DAYS);
		checkRequired(txtCalcDays			, NAM_CALCULATION				, PRM_TXT_CALCULATION_DAYS);
		checkRequired(txtProvidedDays		, NAM_PROVIDED					, PRM_TXT_PROVIDED_DAYS);
		checkRequired(txtInputUnit			, NAM_INPUT_UNIT_TIMES			, PRM_TXT_INPUT_UNIT_TIMES);
		checkRequired(txtAllHolidayHour		, NAM_HOLIDAY_HOURS_ALL_HOUR	, PRM_TXT_ALL_HOLIDAY_HOUR);
		checkRequired(txtAllHolidayMin		, NAM_HOLIDAY_HOURS_ALL_MIN		, PRM_TXT_ALL_HOLIDAY_MIN);
		checkRequired(txtHalfHolidayHour	, NAM_HOLIDAY_HOURS_HALF_HOUR	, PRM_TXT_HALF_HOLIDAY_HOUR);
		checkRequired(txtHalfHolidayMin		, NAM_HOLIDAY_HOURS_HALF_MIN	, PRM_TXT_HALF_HOLIDAY_MIN);
		checkRequired(txtLateNightStartHour	, NAM_LATE_NIGHT_START_HOUR		, PRM_TXT_LATE_NIGHT_START_HOUR);
		checkRequired(txtLateNightStartMin	, NAM_LATE_NIGHT_START_MIN		, PRM_TXT_LATE_NIGHT_START_MIN);
		checkRequired(txtLateNightTimeHour	, NAM_LATE_NIGHT_HOURS_HOUR		, PRM_TXT_LATE_NIGHT_TIME_HOUR);
		checkRequired(txtLateNightTimeMin	, NAM_LATE_NIGHT_HOURS_MIN		, PRM_TXT_LATE_NIGHT_TIME_MIN);

		checkRequired(txtPasswordTerm		, NAM_PASSWORD_TERM				, PRM_TXT_PASSWORD_TERM);
		// 文字タイプ確認
		checkNumeric(txtStatutoryHours		, NAM_STATUTORY_HOUR			, PRM_TXT_STATUTORY_HOUR);
		checkNumeric(txtStatutoryWeek		, NAM_STATUTORY_WEEK			, PRM_TXT_STATUTORY_WEEK);
		checkNumeric(txtStatutoryMonthHours	, NAM_STATUTORY_MONTH_HOURS		, PRM_TXT_STATUTORY_MONTH_HOURS);
		checkNumeric(txtStatutoryMonthDays	, NAM_STATUTORY_MONTH_DAYS		, PRM_TXT_STATUTORY_MONTH_DAYS);
		checkNumber(txtCalcDays				, NAM_CALCULATION				, PRM_TXT_CALCULATION_DAYS);
		checkNumber(txtProvidedDays			, NAM_PROVIDED					, PRM_TXT_PROVIDED_DAYS);
		checkNumber(txtInputUnit			, NAM_INPUT_UNIT_TIMES			, PRM_TXT_INPUT_UNIT_TIMES);
		checkNumber(txtAllHolidayHour		, NAM_HOLIDAY_HOURS_ALL_HOUR	, PRM_TXT_ALL_HOLIDAY_HOUR);
		checkNumber(txtAllHolidayMin		, NAM_HOLIDAY_HOURS_ALL_MIN 	, PRM_TXT_ALL_HOLIDAY_MIN);
		checkNumber(txtHalfHolidayHour		, NAM_HOLIDAY_HOURS_HALF_HOUR  	, PRM_TXT_HALF_HOLIDAY_HOUR);
		checkNumber(txtHalfHolidayMin		, NAM_HOLIDAY_HOURS_HALF_MIN  	, PRM_TXT_HALF_HOLIDAY_MIN);
		checkNumber(txtLateNightStartHour	, NAM_LATE_NIGHT_START_HOUR  	, PRM_TXT_LATE_NIGHT_START_HOUR);
		checkNumber(txtLateNightStartMin	, NAM_LATE_NIGHT_START_MIN  	, PRM_TXT_LATE_NIGHT_START_MIN);
		checkNumber(txtLateNightTimeHour	, NAM_LATE_NIGHT_HOURS_HOUR  	, PRM_TXT_LATE_NIGHT_TIME_HOUR);
		checkNumber(txtLateNightTimeMin		, NAM_LATE_NIGHT_HOURS_MIN  	, PRM_TXT_LATE_NIGHT_TIME_MIN);
		checkRegex(pltAutoCalc   			, REG_AUTOMATIC_CALCULATION 	, NAM_AUTOMATIC_CALCULATION, PRM_PLT_AUTOMATIC_CALCULATION);

		checkNumber(txtPasswordTerm			, NAM_PASSWORD_TERM				, PRM_TXT_PASSWORD_TERM);
		// 文字列長確認
		checkLength(txtStatutoryHours		, LEN_STATUTORY	, NAM_STATUTORY_HOUR			, PRM_TXT_STATUTORY_HOUR);
		checkLength(txtStatutoryWeek		, LEN_STATUTORY	, NAM_STATUTORY_WEEK			, PRM_TXT_STATUTORY_WEEK);
		checkLength(txtStatutoryMonthHours	, LEN_STATUTORY	, NAM_STATUTORY_MONTH_HOURS		, PRM_TXT_STATUTORY_MONTH_HOURS);
		checkLength(txtStatutoryMonthDays	, LEN_STATUTORY	, NAM_STATUTORY_MONTH_DAYS		, PRM_TXT_STATUTORY_MONTH_DAYS);
		checkLength(txtCalcDays				, LEN_DAYS		, NAM_CALCULATION				, PRM_TXT_CALCULATION_DAYS);
		checkLength(txtProvidedDays			, LEN_DAYS		, NAM_PROVIDED					, PRM_TXT_PROVIDED_DAYS);
		checkLength(txtInputUnit			, LEN_TIME		, NAM_INPUT_UNIT_TIMES			, PRM_TXT_INPUT_UNIT_TIMES);
		checkLength(txtAllHolidayHour		, LEN_TIME		, NAM_HOLIDAY_HOURS_ALL_HOUR	, PRM_TXT_ALL_HOLIDAY_HOUR);
		checkLength(txtAllHolidayMin		, LEN_TIME		, NAM_HOLIDAY_HOURS_ALL_MIN		, PRM_TXT_ALL_HOLIDAY_MIN);
		checkLength(txtHalfHolidayHour		, LEN_TIME		, NAM_HOLIDAY_HOURS_HALF_HOUR	, PRM_TXT_HALF_HOLIDAY_HOUR);
		checkLength(txtHalfHolidayMin		, LEN_TIME		, NAM_HOLIDAY_HOURS_HALF_MIN	, PRM_TXT_HALF_HOLIDAY_MIN);
		checkLength(txtLateNightStartHour	, LEN_TIME		, NAM_LATE_NIGHT_START_HOUR		, PRM_TXT_LATE_NIGHT_START_HOUR);
		checkLength(txtLateNightStartMin	, LEN_TIME		, NAM_LATE_NIGHT_START_MIN		, PRM_TXT_LATE_NIGHT_START_MIN);
		checkLength(txtLateNightTimeHour	, LEN_TIME		, NAM_LATE_NIGHT_HOURS_HOUR		, PRM_TXT_LATE_NIGHT_TIME_HOUR);
		checkLength(txtLateNightTimeMin		, LEN_TIME		, NAM_LATE_NIGHT_HOURS_MIN		, PRM_TXT_LATE_NIGHT_TIME_MIN);

		checkLength(txtPasswordTerm			, LEN_DAYS		, NAM_PASSWORD_TERM				, PRM_TXT_PASSWORD_TERM);
		// 妥当性確認終了時処理
		endValidation();
	}

	/**
	 * JavaScript設定
	 * @param cls 情報取得クラス
	 * @throws IllegalAccessException
	 */
	@Override
	public String getDirectJs(Class cls) throws IllegalAccessException {
		StringBuffer sb = new StringBuffer();
		sb.append(super.getDirectJs(cls));
		sb.append("var MODE = ");
		sb.append(mode);
		sb.append(";");
		return sb.toString();
	}

	// アクセサメソッド
	public String getTxtStatutoryHours() 		{ return txtStatutoryHours		; }
	public String getTxtStatutoryWeek() 		{ return txtStatutoryWeek		; }
	public String getTxtStatutoryMonthHours() 	{ return txtStatutoryMonthHours	; }
	public String getTxtStatutoryMonthDays() 	{ return txtStatutoryMonthDays	; }
	public String getPltCalcMonth() 			{ return pltCalcMonth			; }
	public String getTxtCalcDays() 				{ return txtCalcDays			; }
	public String getPltProvidedMonth() 		{ return pltProvidedMonth		; }
	public String getTxtProvidedDays() 			{ return txtProvidedDays		; }
	public String getTxtInputUnit()				{ return txtInputUnit			; }
	public String getPltAutoCalc() 				{ return pltAutoCalc			; }
	public String getTxtAllHolidayHour() 		{ return txtAllHolidayHour		; }
	public String getTxtAllHolidayMin() 		{ return txtAllHolidayMin		; }
	public String getTxtHalfHolidayHour() 		{ return txtHalfHolidayHour		; }
	public String getTxtHalfHolidayMin() 		{ return txtHalfHolidayMin		; }
	public String getTxtLateNightStartHour() 	{ return txtLateNightStartHour	; }
	public String getTxtLateNightStartMin() 	{ return txtLateNightStartMin	; }
	public String getTxtLateNightTimeHour() 	{ return txtLateNightTimeHour	; }
	public String getTxtLateNightTimeMin() 		{ return txtLateNightTimeMin	; }

	public String getTxtPasswordTerm() 			{ return txtPasswordTerm		; }

	public String getEscTxtStatutoryHours() 		{ return escapeHTML(txtStatutoryHours)		; }
	public String getEscTxtStatutoryWeek() 			{ return escapeHTML(txtStatutoryWeek)		; }
	public String getEscTxtStatutoryMonthHours()	{ return escapeHTML(txtStatutoryMonthHours)	; }
	public String getEscTxtStatutoryMonthDays()		{ return escapeHTML(txtStatutoryMonthDays)	; }
	public String getEscPltCalcMonth()				{ return escapeHTML(pltCalcMonth)			; }
	public String getEscTxtCalcDays() 				{ return escapeHTML(txtCalcDays)			; }
	public String getEscPltProvidedMonth() 			{ return escapeHTML(pltProvidedMonth)		; }
	public String getEscTxtProvidedDays() 			{ return escapeHTML(txtProvidedDays)		; }
	public String getEscTxtInputUnit() 				{ return escapeHTML(txtInputUnit)			; }
	public String getEscPltAutoCalc() 				{ return escapeHTML(pltAutoCalc)			; }
	public String getEscTxtAllHolidayHour() 		{ return escapeHTML(txtAllHolidayHour)		; }
	public String getEscTxtAllHolidayMin() 			{ return escapeHTML(txtAllHolidayMin)		; }
	public String getEscTxtHalfHolidayHour() 		{ return escapeHTML(txtHalfHolidayHour)		; }
	public String getEscTxtHalfHolidayMin() 		{ return escapeHTML(txtHalfHolidayMin)		; }
	public String getEscTxtLateNightStartHour() 	{ return escapeHTML(txtLateNightStartHour)	; }
	public String getEscTxtLateNightStartMin() 		{ return escapeHTML(txtLateNightStartMin)	; }
	public String getEscTxtLateNightTimeHour() 		{ return escapeHTML(txtLateNightTimeHour)	; }
	public String getEscTxtLateNightTimeMin() 		{ return escapeHTML(txtLateNightTimeMin)	; }

	public String getEscTxtPasswordTerm() 			{ return escapeHTML(txtPasswordTerm)		; }

	public void setTxtStatutoryHours		(String txtStatutoryHours		)	{ this.txtStatutoryHours 		= txtStatutoryHours		; }
	public void setTxtStatutoryWeek		(String txtStatutoryWeek		)	{ this.txtStatutoryWeek 		= txtStatutoryWeek		; }
	public void setTxtStatutoryMonthHours	(String txtStatutoryMonthHours	)	{ this.txtStatutoryMonthHours 	= txtStatutoryMonthHours; }
	public void setTxtStatutoryMonthDays	(String txtStatutoryMonthDays	)	{ this.txtStatutoryMonthDays 	= txtStatutoryMonthDays	; }
	public void setPltCalcMonth			(String pltCalcMonth			)	{ this.pltCalcMonth 			= pltCalcMonth			; }
	public void setTxtCalcDays				(String txtCalcDays				)	{ this.txtCalcDays 				= txtCalcDays			; }
	public void setPltProvidedMonth		(String pltProvidedMonth		) 	{ this.pltProvidedMonth 		= pltProvidedMonth		; }
	public void setTxtProvidedDays			(String txtProvidedDays			) 	{ this.txtProvidedDays 			= txtProvidedDays		; }
	public void setTxtInputUnit			(String txtInputUnit			)	{ this.txtInputUnit 			= txtInputUnit			; }
	public void setPltAutoCalc				(String pltAutoCalc				)	{ this.pltAutoCalc 				= pltAutoCalc			; }
	public void setTxtAllHolidayHour		(String txtAllHolidayHour		)	{ this.txtAllHolidayHour 		= txtAllHolidayHour		; }
	public void setTxtAllHolidayMin		(String txtAllHolidayMin		)	{ this.txtAllHolidayMin 		= txtAllHolidayMin		; }
	public void setTxtHalfHolidayHour		(String txtHalfHolidayHour		)	{ this.txtHalfHolidayHour 		= txtHalfHolidayHour	; }
	public void setTxtHalfHolidayMin		(String txtHalfHolidayMin		)	{ this.txtHalfHolidayMin 		= txtHalfHolidayMin		; }
	public void setTxtLateNightStartHour	(String txtLateNightStartHour	)	{ this.txtLateNightStartHour 	= txtLateNightStartHour	; }
	public void setTxtLateNightStartMin	(String txtLateNightStartMin	)	{ this.txtLateNightStartMin 	= txtLateNightStartMin	; }
	public void setTxtLateNightTimeHour	(String txtLateNightTimeHour	)	{ this.txtLateNightTimeHour 	= txtLateNightTimeHour	; }
	public void setTxtLateNightTimeMin		(String txtLateNightTimeMin		)	{ this.txtLateNightTimeMin 		= txtLateNightTimeMin	; }

	public void setTxtPasswordTerm			(String txtPasswordTerm			) 	{ this.txtPasswordTerm 			= txtPasswordTerm		; }

	public void setMode(int mode) { this.mode = mode; }
	public int getMode() { return mode; }

}
