/*******************************************************************************
*	 All Rights reserved,Copyright (c) K-Opticom 
********************************************************************************
*＜プログラム内容＞
*	システム名		：eo顧客基幹システム
*	モジュール名	：JSYejbKK2541ETDA
*	ソースファイル名：JSYejbKK2541ETDA.java
*	作成者			：EK912022
*	日付			：2012年09月12日
*＜機能概要＞
*	割賦契約 ETMsgDBアクセス部品
*＜修正履歴＞
*	バージョン	修正日		修正者		修正内容
*	ｖ1.00.00
*
********************************************************************************/

package eo.ejb.cbm.entity;

import com.fujitsu.futurity.model.base.CAANMsg;
import com.fujitsu.futurity.model.base.CAANException;
import com.fujitsu.futurity.model.base.CAANCreateException;
import com.fujitsu.futurity.model.base.CAANRuntimeException;
import com.fujitsu.futurity.model.ejb.common.StatusCodes;
import com.fujitsu.futurity.model.ejb.common.JSYejbLog;
import com.fujitsu.futurity.model.ejb.common.fw.AgentDispatchContext;
import com.fujitsu.futurity.model.ejb.common.fw.ETMsgDBAccessHandler;
import eo.ejb.common.EventIDList;

/**
 * 割賦契約ETMsgDBアクセス部品です。
 * ＜メソッド一覧＞
 * invoke
 * execIKK2541D001
 * execIKK2541D002
 * execIKK2541D003
 * execIKK2541D004
 * execIKK2541D005
 * execIKK2541D006
 * execIKK2541D007
 * execIKK2541D008
 * execIKK2541D009
 * 
 */
public class JSYejbKK2541ETDA implements ETMsgDBAccessHandler {

	/**
	 * コンストラクタ
	 */
	public JSYejbKK2541ETDA() {
	}

	/**
	 * 割賦契約ETMsgDBアクセス部品のメイン処理です。
	 * ETMsgの振舞IDに従い、項目値設定後、LogicalEntityを呼出します。
	 * @param  inETMsg 処理を行うETMsg
	 * @exception CAANRuntimeException 例外発生時にthrowします。
	 */
	public void invoke(CAANMsg inETMsg, AgentDispatchContext inContext) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.invoke");

		// ETMsgチェック
		// 処理対象のETMsgでなければ処理をぬけます。
		if (inETMsg.equalsSchemaClass(KK2541ETMsg.class) == false) {
			return;
		}

		// 振舞ID
		String eventID;

		// 振舞ID取り出し
		eventID = inETMsg.getString(KK2541ETMsg.EVENTID);

		// イベントの振り分け
		if(eventID.equals(EventIDList.IKK2541D001)){
			// 割賦契約引継登録振舞内部
			execIKK2541D001(inETMsg);
		}
		else if(eventID.equals(EventIDList.IKK2541D002)){
			// 割賦契約登録振舞内部
			execIKK2541D002(inETMsg);
		}
		else if(eventID.equals(EventIDList.IKK2541D003)){
			// 割賦契約情報変更振舞内部
			execIKK2541D003(inETMsg);
		}
		else if(eventID.equals(EventIDList.IKK2541D004)){
			// 割賦契約照査振舞内部
			execIKK2541D004(inETMsg);
		}
		else if(eventID.equals(EventIDList.IKK2541D005)){
			// 割賦契約照査取消振舞概念
			execIKK2541D005(inETMsg);
		}
		else if(eventID.equals(EventIDList.IKK2541D006)){
			// 割賦契約キャンセル振舞内部
			execIKK2541D006(inETMsg);
		}
		else if(eventID.equals(EventIDList.IKK2541D007)){
			// 割賦契約解約振舞内部
			execIKK2541D007(inETMsg);
		}
		else if(eventID.equals(EventIDList.IKK2541D008)){
			// 割賦契約締結振舞内部
			execIKK2541D008(inETMsg);
		}
		else if(eventID.equals(EventIDList.IKK2541D009)){
			// 割賦契約料金プラン変更振舞内部
			execIKK2541D009(inETMsg);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.invoke");

	}

	/**
	 * 割賦契約引継登録振舞内部<IKK2541D001>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D001(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D001");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D001");

	}
	/**
	 * 割賦契約登録振舞内部<IKK2541D002>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D002(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D002");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D002");

	}
	/**
	 * 割賦契約情報変更振舞内部<IKK2541D003>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D003(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D003");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D003");

	}
	/**
	 * 割賦契約照査振舞内部<IKK2541D004>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D004(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D004");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D004");

	}
	/**
	 * 割賦契約照査取消振舞概念<IKK2541D005>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D005(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D005");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D005");

	}
	/**
	 * 割賦契約キャンセル振舞内部<IKK2541D006>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D006(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D006");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D006");

	}
	/**
	 * 割賦契約解約振舞内部<IKK2541D007>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D007(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D007");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D007");

	}
	/**
	 * 割賦契約締結振舞内部<IKK2541D008>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D008(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D008");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D008");

	}
	/**
	 * 割賦契約料金プラン変更振舞内部<IKK2541D009>です。
	 * @param inETMsg 処理を行うETMsg
	 */
	private void execIKK2541D009(CAANMsg inETMsg) {

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "call:JSYejbKK2541ETDA.IKK2541D009");

		// 項目値設定
		// 現在日時
		String nowTimestamp = inETMsg.getString(KK2541ETMsg.OPERATEDATETIME);

		// 登録日時
		inETMsg.set(KK2541ETMsg.ADD_DTM, nowTimestamp);

		// 更新日時
		inETMsg.set(KK2541ETMsg.UPD_DTM, nowTimestamp);

		// LogicalEntity呼び出し
		KK2541LE le = new KK2541LE();

		try{
			le.create(inETMsg);

		}catch(CAANCreateException cce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.CREATE_DB_ERR);
			throw new CAANRuntimeException(cce);
		}catch(CAANException ce){
			inETMsg.set(KK2541ETMsg.STATUS, StatusCodes.FATAL_ERR);
			throw new CAANRuntimeException(ce);
		}

		// ログ出力
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "end:JSYejbKK2541ETDA.IKK2541D009");

	}

}
