/*
 * 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.payroll.dao;

import java.lang.reflect.Field;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import jp.mosp.common.common.BaseDao;
import jp.mosp.common.common.MospException;

import jp.mosp.payroll.dto.MKintaiKinmuDto;

public class MKintaiKinmuDao extends BaseDao {

	// テーブル名及びキー列名
	public static final String TABLE  = "M_KINTAIKINMU";
	public static final String KEY_1 	= "KCODE";		//社員コード
	public static final String KEY_2 	= "SIKYUYM";	//支給年月
	public static final String KEY_3 	= "KINMU";		//勤務形態

	// 列名
	public static final String COL_KCODE  	= "KCODE";		//社員コード
	public static final String COL_SIKYUYM  	= "SIKYUYM";	//支給年月
	public static final String COL_KINMU  	= "KINMU";		//勤務形態
	public static final String COL_SNISSU  	= "SNISSU";		//出勤日数
	public static final String COL_ZAJIKAN  	= "ZAJIKAN";	//普通残業時間
	public static final String COL_SZJIKAN  	= "SZJIKAN";	//深夜残業時間
	public static final String COL_HSJIKAN  	= "HSJIKAN";	//法定休日出勤時間
	public static final String COL_TSJIKAN  	= "TSJIKAN";	//特別出勤時間
	public static final String COL_SYOKUJI  	= "SYOKUJI";	//食事手当支給
	public static final String COL_CYOKU1  	= "CYOKU1";		//1直手当支給
	public static final String COL_CYOKU2  	= "CYOKU2";		//2直手当支給
	public static final String COL_CYOKU3  	= "CYOKU3";		//3直手当支給
	public static final String COL_HOKA1  	= "HOKA1";		//その他支給1
	public static final String COL_HOKA2  	= "HOKA2";		//その他支給2
	public static final String COL_HOKA3 		= "HOKA3";		//その他支給3
	public static final String COL_HOKA4  	= "HOKA4";		//その他支給4
	public static final String COL_HOKA5  	= "HOKA5";		//その他支給5

	/**
	 * コンストラクタ
	 */
	public MKintaiKinmuDao() {
		super();
	}

	/**
	 * 検索結果取得(DTOのList)
	 * @return List 検索リスト
	 * @throws SQLException
	 */
	private List<MKintaiKinmuDto> mappingAll() throws SQLException {
		List<MKintaiKinmuDto> all = new ArrayList<MKintaiKinmuDto>();
		while (rs.next()) {
			all.add(mapping());
		}
		return all;
	}

	/**
	 * 検索結果取得(DTO)
	 * @return m_kintaikinmuDto m_kintaikinmuレコード
	 * @throws SQLException
	 */
	private MKintaiKinmuDto mapping() throws SQLException {
		MKintaiKinmuDto dto = new MKintaiKinmuDto();
		dto.setKCode 	(rs.getString (COL_KCODE  	));	//社員コード
		dto.setSikyuYM 	(rs.getString (COL_SIKYUYM  ));	//支給年月
		dto.setKinmu 	(rs.getString (COL_KINMU  	));	//勤務形態
		dto.setSNissu 	(rs.getDouble (COL_SNISSU  	));	//出勤日数
		dto.setZaJikan 	(rs.getInt    (COL_ZAJIKAN  ));	//普通残業時間
		dto.setSZJikan 	(rs.getInt    (COL_SZJIKAN  ));	//深夜残業時間
		dto.setHSJikan 	(rs.getInt    (COL_HSJIKAN  ));	//法定休日出勤時間
		dto.setTSJikan 	(rs.getInt    (COL_TSJIKAN  ));	//特別出勤時間
		dto.setSyokuji 	(rs.getInt    (COL_SYOKUJI  ));	//食事手当支給
		dto.setCyoku1 	(rs.getInt    (COL_CYOKU1  	));	//1直手当支給
		dto.setCyoku2 	(rs.getInt    (COL_CYOKU2  	));	//2直手当支給
		dto.setCyoku3 	(rs.getInt    (COL_CYOKU3  	));	//3直手当支給
		dto.setHoka1 	(rs.getInt    (COL_HOKA1  	));	//その他支給1
		dto.setHoka2 	(rs.getInt    (COL_HOKA2  	));	//その他支給2
		dto.setHoka3 	(rs.getInt    (COL_HOKA3  	));	//その他支給3
		dto.setHoka4 	(rs.getInt    (COL_HOKA4  	));	//その他支給4
		dto.setHoka5 	(rs.getInt    (COL_HOKA5  	));	//その他支給5

		return dto;
	}

	/**
	 * 全データ取得
	 * @return List 検索結果(DTOのList)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public List findAll() throws SQLException, IllegalAccessException, NoSuchFieldException {
		try {
			prepareStatement(getSelectQuery(getClass()) + getOrderForKey(getClass()));
			executeQuery();
			List all = mappingAll();
			return all;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * キーによるデータ取得
	 * @param kcode 社員コード(検索キー)
	 * @param sikyuym 支給年月(検索キー)
	 * @param kinmu 勤務形態(検索キー)
	 * @return m_kintaikinmuDto 検索結果(DTO)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public MKintaiKinmuDto findForKey(
			String kcode,
			String sikyuym,
			String kinmu
	) throws SQLException, IllegalAccessException, NoSuchFieldException {
		try {
			index = 1;
			prepareStatement(getSelectQuery(getClass()) + getConditionForKey(getClass()));
			setParam(index++, kcode);
			setParam(index++, sikyuym);
			setParam(index++, kinmu);
			executeQuery();
			MKintaiKinmuDto dto = null;
			if (rs.next()) {
				dto = mapping();
				mappingCommonInfo(dto);
			}
			return dto;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * キーによる行ロック取得
	 * @param kcode 社員コード(検索キー)
	 * @param sikyuym 支給年月(検索キー)
	 * @param kinmu 勤務形態(検索キー)
	 * @return m_kintaikinmuDto 検索結果(DTO)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public MKintaiKinmuDto findForUpdate(
			String kcode,
			String sikyuym,
			String kinmu
	) throws SQLException, IllegalAccessException, NoSuchFieldException {
		try {
			index = 1;
			prepareStatement(getSelectQuery(getClass()) + getConditionForKey(getClass()) + getForUpdate());
			setParam(index++, kcode);
			setParam(index++, sikyuym);
			setParam(index++, kinmu);
			executeQuery();
			MKintaiKinmuDto dto = null;
			if (rs.next()) {
				dto = mapping();
				mappingCommonInfo(dto);
			}
			return dto;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * キーによる行ロック取得
	 * @param kcode 社員コード(検索キー)
	 * @param sikyuym 支給年月(検索キー)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public void findForUpdate(
			String kcode,
			String sikyuym
	) throws SQLException, IllegalAccessException, NoSuchFieldException {
		try {
			index = 1;
			StringBuffer sb = new StringBuffer();
			sb.append("WHERE ");
			sb.append(COL_KCODE  );
			sb.append(" = ? AND ");
			sb.append(COL_SIKYUYM  );
			sb.append(" = ? ");
			prepareStatement(getSelectQuery(getClass()) + sb.toString() + getForUpdate());
			setParam(index++, kcode);
			setParam(index++, sikyuym);
			executeQuery();
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * キーによる行ロック取得
	 * @param sikyuym 支給年月(検索キー)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public void findForUpdate(
			String sikyuym
	) throws SQLException, IllegalAccessException, NoSuchFieldException {
		try {
			index = 1;
			StringBuffer sb = new StringBuffer();
			sb.append("WHERE ");
			sb.append(COL_SIKYUYM);
			sb.append(" = ? ");
			prepareStatement(getSelectQuery(getClass()) + sb.toString() + getForUpdate());
			setParam(index++, sikyuym);
			executeQuery();
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * 条件文によるデータ取得
	 * @param kcode 検索社員コード
	 * @param sikyuym 検索支給年月
	 * @param kinmu 検索勤務形態
	 * @return List 検索結果(DTOのList)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public List findForCondition(
			String kcode,
			String sikyuym,
			String kinmu
	) throws SQLException, IllegalAccessException, NoSuchFieldException {
		index = 1;
		StringBuffer sb = new StringBuffer();
		sb.append("WHERE ");
		sb.append(COL_KCODE  );
		sb.append(" = ? AND ");
		sb.append(COL_SIKYUYM  );
		sb.append(" = ? AND ");
		sb.append(COL_KINMU  );
		sb.append(" = ? ");
		try {
			prepareStatement(getSelectQuery(getClass()) + sb.toString() + getOrderForKey(getClass()));
			setParam(index++,   kcode  );
			setParam(index++,   sikyuym   + "%");
			setParam(index++, "%" +   kinmu   + "%");
			executeQuery();
			List list = mappingAll();
			return list;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}	

	/**
	 * 条件文によるデータ取得
	 * @param kcode 検索社員コード
	 * @param sikyuym 検索支給年月
	 * @return list 検索結果(DTOのList)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public List findForCondition(
			String kcode,
			String sikyuym
	) throws SQLException, IllegalAccessException, NoSuchFieldException {
		index = 1;
		StringBuffer sb = new StringBuffer();
		sb.append("WHERE ");
		sb.append(COL_KCODE  );
		sb.append(" = ? AND ");
		sb.append(COL_SIKYUYM  );
		sb.append(" = ? ");
		try {
			prepareStatement(getSelectQuery(getClass()) + sb.toString() + getOrderForKey(getClass()));
			setParam(index++,   kcode  );
			setParam(index++,   sikyuym);
			executeQuery();
			List list = mappingAll();
			return list;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * 条件文によるデータ取得
	 * @param sikyuym 検索支給年月
	 * @return List 検索結果(DTOのList)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public List findForCondition(
			String sikyuym
	) throws SQLException, IllegalAccessException, NoSuchFieldException {
		index = 1;
		StringBuffer sb = new StringBuffer();
		sb.append("WHERE ");
		sb.append(COL_SIKYUYM);
		sb.append(" = ? ");
		try {
			prepareStatement(getSelectQuery(getClass()) + sb.toString() + getOrderForKey(getClass()));
			setParam(index++,   sikyuym);
			executeQuery();
			List list = mappingAll();
			return list;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * データ挿入
	 * @param dto 挿入対象DTO
	 * @return int 挿入結果(件数)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 * @throws MospException
	 */
	public int insert(MKintaiKinmuDto dto) throws SQLException, IllegalAccessException, NoSuchFieldException, MospException {
		try {
			index = 1;
			prepareStatement(getInsertQuery(getClass()));
			setParams(dto,true);
			executeUpdate();
			chkInsert(1);
			return cnt;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * データ挿入
	 * @param aryDto	挿入対象DTO
	 * @return int 挿入結果(件数)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 * @throws MospException
	 */
	public int insert(MKintaiKinmuDto[] aryDto) throws SQLException, IllegalAccessException, NoSuchFieldException, MospException {
		try {
			index = 1;
			StringBuffer sb = new StringBuffer();
			sb.append("INSERT INTO ");
			sb.append(TABLE);
			sb.append("(");
			Field[] fields = getClass().getFields();
			for (int i = 0; i < fields.length; i++) {
				Field field = fields[i];
				String name = field.getName();
				if (name.indexOf("COL_") == 0) {
					sb.append(field.get(null));
					sb.append(", ");
				}
			}
			if (!INSERT_DATE.equals("")) {
				sb.append(INSERT_DATE + ", ");
			}
			if (!INSERT_USER.equals("")) {
				sb.append(INSERT_USER + ", ");
			}
			if (!UPDATE_DATE.equals("")) {
				sb.append(UPDATE_DATE + ", ");
			}
			if (!UPDATE_USER.equals("")) {
				sb.append(UPDATE_USER + ", ");
			}
			sb.delete(sb.length() - 2, sb.length() - 1);
			sb.append(") VALUES");
			for (int a = 0; a < aryDto.length; a++) {
				sb.append("(");
				for (int i = 0; i < fields.length; i++) {
					Field field = fields[i];
					String name = field.getName();
					if (name.indexOf("COL_") == 0) {
						sb.append("?, ");
					}
				}
				if (!INSERT_DATE.equals("")) {
					sb.append("?, ");
				}
				if (!INSERT_USER.equals("")) {
					sb.append("?, ");
				}
				if (!UPDATE_DATE.equals("")) {
					sb.append("?, ");
				}
				if (!UPDATE_USER.equals("")) {
					sb.append("?, ");
				}
				sb.delete(sb.length() - 2, sb.length());
				sb.append("),");
			}
			sb.delete(sb.length() - 1, sb.length());
			prepareStatement(sb.toString());
			for (int d = 0; d < aryDto.length; d++) {
				setParams(aryDto[d],true);
			}
			executeUpdate();
			chkInsert(aryDto.length);
			return cnt;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * データ更新
	 * @param dto 更新対象DTO
	 * @return int 更新結果(件数)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 * @throws MospException
	 */
	public int update(MKintaiKinmuDto dto) throws SQLException, IllegalAccessException, NoSuchFieldException, MospException {
		try {
			index = 1;
			prepareStatement(getUpdateQuery(getClass()));
			setParams(dto,false);
			setParam(index++, dto.getKCode());
			setParam(index++, dto.getSikyuYM());
			setParam(index++, dto.getKinmu());
			executeUpdate();
			chkUpdate(1);
			return cnt;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * データ削除
	 * @param dto 更新対象DTO
	 * @return int 削除結果(件数)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 * @throws MospException
	 */
	public int delete(MKintaiKinmuDto dto) throws SQLException, IllegalAccessException, NoSuchFieldException, MospException {
		try {
			index = 1;
			prepareStatement(getDeleteQuery(getClass()));
			setParam(index++, dto.getKCode());
			setParam(index++, dto.getSikyuYM());
			setParam(index++, dto.getKinmu());
			executeUpdate();
			chkDelete(1);
			return cnt;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * データ削除
	 * @param aryKcode 更新対象Kcode
	 * @return int 削除結果(件数)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 * @throws MospException
	 */
	public int delete(String[] aryKcode, String sikyuYM) throws SQLException, IllegalAccessException, NoSuchFieldException, MospException {
		try {
			index = 1;
			StringBuffer sb = new StringBuffer();
			sb.append("DELETE FROM ");
			sb.append(TABLE);
			sb.append(" WHERE (");
			for (int i = 0; i < aryKcode.length; i++) {
				sb.append(COL_KCODE);
				sb.append(" = ? OR ");
			}
			sb.delete(sb.length() - 4, sb.length());
			sb.append(") AND ");
			sb.append(COL_SIKYUYM);
			sb.append(" = ?");
			prepareStatement(sb.toString());
			for (int d = 0; d < aryKcode.length; d++) {
				setParam(index++, aryKcode[d]);
			}
			setParam(index++, sikyuYM);
			executeUpdate();
//			chkDelete(1);
			return cnt;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * データ削除
	 * @param sikyuYM	更新対象年月
	 * @return int 削除結果(件数)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 * @throws MospException
	 */
	public int delete(String sikyuYM) throws SQLException, IllegalAccessException, NoSuchFieldException, MospException {
		try {
			index = 1;
			StringBuffer sb = new StringBuffer();
			sb.append("DELETE FROM ");
			sb.append(TABLE);
			sb.append(" ");
			sb.append("WHERE ");
			sb.append(COL_SIKYUYM  );
			sb.append(" = ? ");
			prepareStatement(sb.toString());
			setParam(index++, sikyuYM);
			executeUpdate();
			//chkDelete(1);
			return cnt;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * データ削除
	 * @param kCode 更新社員コード
	 * @param sikyuYM	更新対象年月
	 * @return int 削除結果(件数)
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 * @throws MospException
	 */
	public int delete(String kCode, String sikyuYM) throws SQLException, IllegalAccessException, NoSuchFieldException, MospException {
		try {
			index = 1;
			StringBuffer sb = new StringBuffer();
			sb.append("DELETE FROM ");
			sb.append(TABLE);
			sb.append(" ");
			sb.append("WHERE ");
			sb.append(COL_KCODE  );
			sb.append(" = ? AND ");
			sb.append(COL_SIKYUYM  );
			sb.append(" = ? ");
			prepareStatement(sb.toString());
			setParam(index++, kCode);
			setParam(index++, sikyuYM);
			executeUpdate();
			//chkDelete(1);
			return cnt;
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * パラメータ設定
	 * @param dto 更新対象DTO
	 * @throws SQLException
	 */
	private void setParams(MKintaiKinmuDto dto,boolean isInsert) throws SQLException {
		setParam(index++, dto.getKCode());		//社員コード
		setParam(index++, dto.getSikyuYM());	//支給年月
		setParam(index++, dto.getKinmu());		//勤務形態
		setParam(index++, dto.getSNissu());		//出勤日数
		setParam(index++, dto.getZaJikan());	//普通残業時間
		setParam(index++, dto.getSZJikan());	//深夜残業時間
		setParam(index++, dto.getHSJikan());	//法定休日出勤時間
		setParam(index++, dto.getTSJikan());	//特別出勤時間
		setParam(index++, dto.getSyokuji());	//食事手当支給
		setParam(index++, dto.getCyoku1());		//1直手当支給
		setParam(index++, dto.getCyoku2());		//2直手当支給
		setParam(index++, dto.getCyoku3());		//3直手当支給
		setParam(index++, dto.getHoka1());		//その他支給1
		setParam(index++, dto.getHoka2());		//その他支給2
		setParam(index++, dto.getHoka3());		//その他支給3
		setParam(index++, dto.getHoka4());		//その他支給4
		setParam(index++, dto.getHoka5());		//その他支給5
		setCommonParams(isInsert);
	}

	/**
	 * テーブルロック
	 * @param 	sikyuYM	更新対象年月
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public void tableLock(String sikyuYM) throws SQLException, IllegalAccessException, NoSuchFieldException {
		try {
			if (conn.getMetaData().getDatabaseProductName().equals("MySQL")) {
				// DBがMySQLの場合は行ロック
				findForUpdate(sikyuYM);
			} else {
				// DBがPostgreSQLの場合はテーブルロック
				StringBuffer sb = new StringBuffer();
				sb.append("LOCK TABLE ");
				sb.append(TABLE);
				prepareStatement(sb.toString());
				executeUpdate();
			}
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * テーブルロック
	 * @param	kCode	社員コード
	 * @param 	sikyuYM	更新対象年月
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public void tableLock(String kCode, String sikyuYM) throws SQLException, IllegalAccessException, NoSuchFieldException {
		try {
			if (conn.getMetaData().getDatabaseProductName().equals("MySQL")) {
				// DBがMySQLの場合は行ロック
				findForUpdate(kCode, sikyuYM);
			} else {
				// DBがPostgreSQLの場合はテーブルロック
				StringBuffer sb = new StringBuffer();
				sb.append("LOCK TABLE ");
				sb.append(TABLE);
				prepareStatement(sb.toString());
				executeUpdate();
			}
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}

	/**
	 * テーブルロック
	 * @param	aryKCode	社員コード
	 * @param 	sikyuYM		更新対象年月
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws NoSuchFieldException
	 */
	public void tableLock(String[] aryKCode, String sikyuYM) throws SQLException, IllegalAccessException, NoSuchFieldException {
		try {
			if (conn.getMetaData().getDatabaseProductName().equals("MySQL")) {
				// DBがMySQLの場合は行ロック
				for (int i = 0; i < aryKCode.length; i++) {
					findForUpdate(aryKCode[i], sikyuYM);
				}
			} else {
				// DBがPostgreSQLの場合はテーブルロック
				StringBuffer sb = new StringBuffer();
				sb.append("LOCK TABLE ");
				sb.append(TABLE);
				prepareStatement(sb.toString());
				executeUpdate();
			}
		} catch (SQLException e) {
			throw e;
		} finally {
			releaseResultSet();
			releasePreparedStatement();
		}
	}
}
