/*********************************************************************
* All Rights reserved,Copyright (c) K-Opticom
**********************************************************************
*＜プログラム内容＞
*   システム名      ：eo顧客基幹システム
*   モジュール名    ：JKKWribRslAddCreateMapper
*   ソースファイル名：JKKWribRslAddCreateMapper.java
*   作成者          ：FJ
*   日付            ：2013年10月01日
*＜機能概要＞
*   割引解約新規作成部品
*＜修正履歴＞
*   バージョン  修正日      修正者      修正内容
*	v4.00.00	2013/10/01	FJ			新規作成
*
**********************************************************************/
package com.fujitsu.futurity.bp.custom.common;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import com.fujitsu.futurity.bp.x21.bpm.ServiceComponentRequestInvoker;
import com.fujitsu.futurity.bp.x21.bpm.db.SessionHandle;
import com.fujitsu.futurity.bp.x21.bpm.parameter.IRequestParameterReadWrite;
import com.fujitsu.futurity.bp.x21.cc.exception.SCCallException;
import com.fujitsu.futurity.common.JCMConstants;
import com.fujitsu.futurity.common.x01.sc.SCControlMapKeys;
import com.fujitsu.futurity.mapping.bp.common.TemplateErrorUtil;
import com.fujitsu.futurity.model.base.CAANMsg;
import com.fujitsu.futurity.model.common.JCMAPLConstMgr;
import com.fujitsu.futurity.model.ejb.common.JSYejbLog;

import eo.common.util.JPCDateUtil;
import eo.ejb.cbs.cbsmsg.EKK0321B002CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0321D010CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0451A010CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0451A010CBSMsg1List;
import eo.ejb.cbs.cbsmsg.EKK0451B005CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0451C020CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0451C030CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0451D010CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0451D010CBSMsg1List;
import eo.ejb.cbs.cbsmsg.EKK0481A010CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0481A010CBSMsg1List;
import eo.ejb.cbs.cbsmsg.EKK0481B001CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0481B002CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0491A010CBSMsg;

/**
 * 住所変更申込キャンセル部 CC-SCマッピングクラス
 * 
 * @author 富士通
 */
public class JKKWribRslAddCreateMapperCC
{
	/** SC呼び出し部品 */
	private ServiceComponentRequestInvoker scCall = null;
	/** セッションハンドル */
	private SessionHandle handle = null;
	/** 業務データ取得用I/F */
	private IRequestParameterReadWrite param = null;
	/** オンライン運用日付 */
	private String opeDate = null;
	
	/** 割引サービス契約一意照会 */
	private final String EKK0451A010 = "EKK0451A010";
	
	/** 割引サービス対象契約一意照会 */
	private final String EKK0481A010 = "EKK0481A010";
	
	/** 割引サービス対象契約一覧照会 */
	private final String EKK0481B001 = "EKK0481B001";
	private final String EKK0481B002 = "EKK0481B002";
	
	/** 課金先一覧照会（請求契約番号／サービス契約番号） */
	private final String EKK0321B002 = "EKK0321B002";
	/** 請求契約一意照会 */
	private final String EKK0491A010 = "EKK0491A010";
	
	/** 割引サービス契約登録 */
	private final String EKK0451D010 = "EKK0451D010";
	/** 割引サービス契約解約 */
	private final String EKK0451C020 = "EKK0451C020";
	/** 割引サービス契約解約確定 */
	private final String EKK0451C030 = "EKK0451C030";
	/** 課金先登録 */
	private final String EKK0321D010 = "EKK0321D010";
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>コンストラクタ<br>
	 * <dt>処理補足：
	 * <dd>フィールド変数の値を設定する<br>
	 * </dl>
	 * 
	 * @param iCmnHandle セッションハンドル
	 * @param iCmnParam 業務データ取得用I/F
	 * @param iOpeDate オンライン運用日付
	 */
	public JKKWribRslAddCreateMapperCC(SessionHandle iCmnHandle,
										IRequestParameterReadWrite iCmnParam,
										String iOpeDate) {
		this.handle = iCmnHandle;
		this.param = iCmnParam;
		this.opeDate = iOpeDate;
		this.scCall = new ServiceComponentRequestInvoker();
	}

	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>デバッグログを出力する<br>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param dumpObj 出力するオブジェクト
	 */
	@SuppressWarnings("static-access")
	private void printlnEjbLog(Object dumpObj) {
		JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), dumpObj, null, null, null);
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>持ちうるフィールドにNullマッピングで埋める<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param msg 対象クラス
	 * @param contents 対応クラスのフィールド列挙
	 */
	private void fillCAANMSGNullMapping(CAANMsg msg, Object[][] contents) {
		
		// 要素ごとのループ
		for (int i = 0; i < contents.length; i++) {

			Object element = null;

			// キーに該当する箇所の取得
			element = contents[i][0];
			// Nullでマッピング
			msg.setNull((String) element);
		}
	}

	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>S/IF呼出時の共通情報を設定する<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param template 条件の設定先
	 * @throws Throwable
	 */
	private void templateCommonInfo(CAANMsg template) throws Throwable {
		
		// オペレータID
		Object operatorId = this.param.getControlMapData(SCControlMapKeys.OPERATOR_ID);
		template.set(JCMConstants.OPERATOR_ID_KEY, operatorId);

		// 運用日付
		Object operateDate = this.param.getControlMapData(SCControlMapKeys.OPE_DATE);
		template.set(JCMConstants.OPERATE_DATE_KEY, operateDate);

		// 運用日時
		Object operateDateTime = this.param.getControlMapData(SCControlMapKeys.OPE_TIME);
		template.set(JCMConstants.OPERATE_DATETIME_KEY, operateDateTime);
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>SCインプット共通データ設定処理です。<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param inMap
	 * @return パラメータマップ
	 * @throws Throwable
	 */
	private HashMap<String, Object> setSCInputCommonData(HashMap<String, Object> inMap) throws Throwable {
		
		/* SCインプット共通データ */
		// **********************************************
		// 【取得元：電文ヘッダ(ヘッダ)】
		// **********************************************
		// 電文ID
		inMap.put(JCMConstants.TRANZACTION_ID_KEY, this.param.getTelegramID());
		// ユースケースID
		inMap.put(JCMConstants.USECASE_ID_KEY, this.param.getUsecaseID());
		// オペレーションID
		inMap.put(JCMConstants.OPERATION_ID_KEY, this.param.getOperationID());
		// サービス呼び出し区分
		inMap.put(JCMConstants.CALL_TYPE_KEY, this.param.getCallType());

		// **********************************************
		// 【取得元：ユーザエリア(コントロールマップ)】
		// **********************************************
		// 依頼先ホスト名
		inMap.put(JCMConstants.CLIENT_HOST_NAME_KEY, this.param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME));
		// 依頼元IPアドレス
		inMap.put(JCMConstants.CLIENT_IP_ADDRESS_KEY, this.param.getControlMapData(SCControlMapKeys.REQ_HOSTIP));
		// 依頼元画面ID
		inMap.put(JCMConstants.INVOKE_GAMEN_ID_KEY, this.param.getControlMapData(SCControlMapKeys.REQ_VIEWID));
		// オペレータID
		inMap.put(JCMConstants.OPERATOR_ID_KEY, this.param.getControlMapData(SCControlMapKeys.OPERATOR_ID));

		return inMap;
	}

	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>呼び出したサービスIFの処理結果を判定する.<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param result
	 * @throws Throwable
	 */
	@SuppressWarnings("boxing")
	private void checkExecutionResult(Map<?, ?> result) throws Throwable {
		
		// 取得したリターンコード、ステータスの内容を見て異常かどうかの判断をする。
		String rtnCode = result.get(JCMConstants.RET_CD_INT_KEY).toString();
		CAANMsg[] templates = (CAANMsg[])result.get(JCMConstants.TEMPLATE_LIST_KEY);
		Integer status = templates[0].getInt(JCMConstants.STATUS_INT_KEY);
		
		// 異常の場合、SCCallExceptionを生成してスローする
		if (!("0".equals(rtnCode) && 0 == status.intValue()))
		{
			SCCallException scCallEx = new SCCallException("戻り値不正", rtnCode, status);
			throw scCallEx;
		}
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>サービスIFの結果を取得する<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param rsltMap サービスIFリスト
	 * @return templateList 結果が格納されたリスト
	 * @throws Throwable 
	 */
	private ArrayList<CAANMsg> getRsltList(Map<?, ?> rsltMap) {
		
		// SCからの戻り値からCAANMsgを取得する。
		CAANMsg[] templates = (CAANMsg[])rsltMap.get(JCMConstants.TEMPLATE_LIST_KEY);
		ArrayList<CAANMsg> resultList = new ArrayList<CAANMsg>(Arrays.asList(templates));
		return resultList;
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>サービスコンポーネント実行後に、IRequestParameterReadWriteに必要なデータをマッピングする<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param param 
	 * @param mapName 
	 * @return templateList 結果が格納されたリスト
	 * @throws Throwable 
	 */
	@SuppressWarnings({ "unchecked", "cast", "boxing" })
	public IRequestParameterReadWrite editResultRP(Map<?, ?> msgList,
													@SuppressWarnings("hiding") IRequestParameterReadWrite param,
													String mapName) throws Throwable {
		
		// SCからの戻り値からCAANMsgを取得する。
		CAANMsg[] templates = (CAANMsg[]) msgList.get(JCMConstants.TEMPLATE_LIST_KEY);

		// リターンコード取得
		Object return_code = msgList.get(JCMConstants.RET_CD_INT_KEY);
		
		// 作業領域の取得
		Map workMap = (Map)param.getMappingWorkArea();
		if (workMap == null) {
			workMap = new HashMap();
			param.setMappingWorkArea(workMap);
		}
		
		// 結果を詰めるマップを取得。
		HashMap dataMap = null;

		/* 業務データ設定 */
		dataMap = (HashMap)param.getData(mapName);
		if (dataMap == null) {
			dataMap = new HashMap();
			param.setData(mapName, dataMap);
		}

		// エラー情報の設定
		param = editErrorInfo(param, templates, (Integer)return_code, mapName);

		//エラー情報のマップを取得
		ArrayList<Object> errList = (ArrayList<Object>)param.getControlMapData(SCControlMapKeys.ERROR_INFO);
		if (errList == null)
		{
			errList = new ArrayList<Object>();
		}
		// コントロールマップに設定
		param.setControlMapData(SCControlMapKeys.ERROR_INFO, TemplateErrorUtil.getErrorInfo(msgList, errList));

		return param;
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>割引サービス契約一意照会サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd
	 * @param  wribSvcKeiNo
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg[] callEKK0451A010(String funcCd, String wribSvcKeiNo) throws Throwable {
		
		printlnEjbLog("callEKK0451A010 start");
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 割引サービス契約一意照会サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0451A010CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0451A010CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0451A010CBSMsg.TEMPLATEID, this.EKK0451A010);
		// 機能コード
		template.set(EKK0451A010CBSMsg.FUNC_CODE, funcCd);

		// 割引サービス契約番号
		template.set(EKK0451A010CBSMsg.KEY_WRIB_SVC_KEI_NO, wribSvcKeiNo);
		// 予約適用年月日
		template.set(EKK0451A010CBSMsg.KEY_RSV_APLY_YMD, this.opeDate);
		
		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);

		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0451A010);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0451List = getRsltList(result);
		
		CAANMsg kk0451 = kk0451List.get(0);
		CAANMsg[] ret = kk0451.getCAANMsgList(EKK0451A010CBSMsg.EKK0451A010CBSMSG1LIST);
		
		printlnEjbLog("callEKK0451A010 end");
		return ret;
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>割引サービス対象契約一覧照会サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  wribSvcKeiNo
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg[] callEKK0481A010(String funcCd, String wribSvcKeiNo, String wribSvcTgKeiNo) throws Throwable {
		printlnEjbLog("callEKK0481A001 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 割引サービス対象契約一意照会サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0481A010CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0481A010CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0481A010CBSMsg.TEMPLATEID, this.EKK0481A010);
		// 機能コード
		template.set(EKK0481A010CBSMsg.FUNC_CODE, funcCd);
		
		// サービス契約番号
		template.set(EKK0481A010CBSMsg.KEY_WRIB_SVC_KEI_NO, wribSvcKeiNo);
		// 割引サービス対象契約番号
		template.set(EKK0481A010CBSMsg.KEY_WRIB_SVC_TRGT_KEI_NO, wribSvcTgKeiNo);
		
		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);

		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0481A010);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0481List = getRsltList(result);
		
		CAANMsg kk0481 = kk0481List.get(0);
		CAANMsg[] ret  = kk0481.getCAANMsgList(EKK0481A010CBSMsg.EKK0481A010CBSMSG1LIST);
		
		printlnEjbLog("callEKK0481A001 end");
		return ret;
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>割引サービス対象契約一覧照会サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  wribSvcKeiNo
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg[] callEKK0481B001(String funcCd, String wribSvcKeiNo) throws Throwable {
		printlnEjbLog("callEKK0481B001 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 自動解除対象割引サービス対象契約一覧照会サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0481B001CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0481B001CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0481B001CBSMsg.TEMPLATEID, this.EKK0481B001);
		// 機能コード
		template.set(EKK0481B001CBSMsg.FUNC_CODE, funcCd);
		
		// サービス契約番号
		template.set(EKK0481B001CBSMsg.KEY_WRIB_SVC_KEI_NO, wribSvcKeiNo);

		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);

		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0481B001);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0481List = getRsltList(result);
		
		CAANMsg kk0481 = kk0481List.get(0);
		CAANMsg[] ret  = kk0481.getCAANMsgList(EKK0481B001CBSMsg.EKK0481B001CBSMSG1LIST);
		
		printlnEjbLog("callEKK0481B001 end");
		return ret;
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>自動解除対象割引サービス対象契約一覧照会サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  svcKeiNo
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg[] callEKK0481B002(String funcCd, String svcKeiNo) throws Throwable {
		printlnEjbLog("callEKK0481B002 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 自動解除対象割引サービス対象契約一覧照会サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0481B002CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0481B002CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0481B002CBSMsg.TEMPLATEID, this.EKK0481B002);
		// 機能コード
		template.set(EKK0481B002CBSMsg.FUNC_CODE, funcCd);
		
		// サービス契約番号
		template.set(EKK0481B002CBSMsg.KEY_SVC_KEI_NO, svcKeiNo);

		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);

		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0481B002);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0481List = getRsltList(result);
		
		CAANMsg kk0481 = kk0481List.get(0);
		CAANMsg[] ret  = kk0481.getCAANMsgList(EKK0481B002CBSMsg.EKK0481B002CBSMSG1LIST);
		
		printlnEjbLog("callEKK0481B002 end");
		return ret;
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>請求契約一意照会サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  seikyKeiNo
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg[] callEKK0491A010(String funcCd, String seikyKeiNo) throws Throwable {
		printlnEjbLog("callEKK0491A001 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 請求契約一意照会サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0491A010CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0491A010CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0491A010CBSMsg.TEMPLATEID, this.EKK0491A010);
		// 機能コード
		template.set(EKK0491A010CBSMsg.FUNC_CODE, funcCd);
		
		// 請求契約番号
		template.set(EKK0491A010CBSMsg.KEY_SEIKY_KEI_NO, seikyKeiNo);
		// 予約適用年月日
		template.set(EKK0491A010CBSMsg.KEY_RSV_APLY_YMD, this.opeDate);
		
		
		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);

		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0491A010);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0491List = getRsltList(result);
		
		CAANMsg kk0491 = kk0491List.get(0);
		CAANMsg[] ret  = kk0491.getCAANMsgList(EKK0491A010CBSMsg.EKK0491A010CBSMSG1LIST);
		
		printlnEjbLog("callEKK0491A001 end");
		return ret;
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>課金先一覧照会（請求契約番号／サービス契約番号）IFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  ccMapWork
	 * @param  msg
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg[] callEKK0321B002(String funcCd, String svcKeiNo) throws Throwable {
		printlnEjbLog("callEKK0321B002 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 自動解除対象割引サービス対象契約一覧照会サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0321B002CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0321B002CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0321B002CBSMsg.TEMPLATEID, this.EKK0321B002);
		// 機能コード
		template.set(EKK0321B002CBSMsg.FUNC_CODE, funcCd);
		
		// サービス契約番号
		template.set(EKK0321B002CBSMsg.KEY_SVC_KEI_NO, svcKeiNo);

		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);

		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0321B002);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0321List = getRsltList(result);
		
		CAANMsg kk0321 = kk0321List.get(0);
		CAANMsg[] ret  = kk0321.getCAANMsgList(EKK0321B002CBSMsg.EKK0321B002CBSMSG1LIST);
		
		printlnEjbLog("callEKK0321B002 end");
		return ret;
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>割引サービス契約解約サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  ccMapWork
	 * @param  msg
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg callEKK0451C020(String funcCd, Map<String, Object> ccMapWork, CAANMsg msg) throws Throwable {
		printlnEjbLog("callEKK0451C020 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 割引サービス契約解約サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0451C020CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0451C020CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0481B002CBSMsg.TEMPLATEID, this.EKK0451C020);
		// 機能コード
		template.set(EKK0481B002CBSMsg.FUNC_CODE, funcCd);
		
		/* 業務 ↓↓ ここから ================================================================================= */
		
		// 割引サービス契約番号 
		template.set(EKK0451C020CBSMsg.WRIB_SVC_KEI_NO, msg.getString(EKK0451A010CBSMsg1List.WRIB_SVC_KEI_NO));
		// 予約適用開始希望年月日：null
		// 申込明細番号
		template.set(EKK0451C020CBSMsg.MSKM_DTL_NO, ccMapWork.get(EKK0451C020CBSMsg.MSKM_DTL_NO));
		// プラン終了種別コード：null
		// サービス終了年月日(サービス課金終了年月日と同値)
		template.set(EKK0451C020CBSMsg.SVC_ENDYMD, this.opeDate);
		// プラン課金開始年月日
		template.set(EKK0451C020CBSMsg.PLAN_CHRG_STAYMD, JPCDateUtil.addDay(this.opeDate, 1));
		// サービス課金開始年月日
		template.set(EKK0451C020CBSMsg.SVC_CHRG_STAYMD,  JPCDateUtil.addDay(this.opeDate, 1));
		// サービス課金終了年月日算出フラグ
		template.set(EKK0451C020CBSMsg.SVC_CHRG_ENDYMD_FLG, "0");
		// サービス課金終了年月日
		template.set(EKK0451C020CBSMsg.SVC_CHRG_ENDYMD, this.opeDate);
		// サービス解約年月日
		template.set(EKK0451C020CBSMsg.SVC_DSL_YMD, this.opeDate);
		// サービス解約理由コード
		template.set(EKK0451C020CBSMsg.SVC_DLRE_CD, ccMapWork.get(EKK0451C020CBSMsg.SVC_DLRE_CD));
		// サービス解約理由メモ：null
		// 違約金発生コード：無
		template.set(EKK0451C020CBSMsg.PNLTY_HASSEI_CD, "0");
		// 異動区分
		template.set(EKK0451C020CBSMsg.IDO_DIV, ccMapWork.get(EKK0451C020CBSMsg.IDO_DIV));
		// 解約理由：自動解除
		template.set(EKK0451C020CBSMsg.WRIB_DSL_CNCL_OPTY_CD, "1");
		// 更新年月日時分秒(更新前)
		template.set(EKK0451C020CBSMsg.UPD_DTM_BF, msg.getString(EKK0451A010CBSMsg1List.LAST_UPD_DTM));
		
		/* 業務 ↑↑ ここまで ================================================================================= */
		
		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);

		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0451C020);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0451List = getRsltList(result);
		
		printlnEjbLog("callEKK0451C020 end");
		return kk0451List.get(0);
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>割引サービス契約解約確定サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  ccMapWork
	 * @param  tgMsg
	 * @param  resMsg
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg callEKK0451C030(String funcCd, Map<String, Object> ccMapWork, CAANMsg tgMsg, CAANMsg resMsg) throws Throwable {
		printlnEjbLog("callEKK0451C030 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 割引サービス契約解約確定サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0451C030CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0451C030CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0451C030CBSMsg.TEMPLATEID, this.EKK0451C030);
		// 機能コード
		template.set(EKK0451C030CBSMsg.FUNC_CODE, funcCd);
		
		/* 業務 ↓↓ ここから ================================================================================= */
		
		// 割引サービス契約番号
		template.set(EKK0451C030CBSMsg.WRIB_SVC_KEI_NO, tgMsg.getString(EKK0451A010CBSMsg1List.WRIB_SVC_KEI_NO));
		// 世代登録年月日時分秒
		template.set(EKK0451C030CBSMsg.GENE_ADD_DTM, resMsg.getString(EKK0451A010CBSMsg1List.GENE_ADD_DTM));
		// サービス終了年月日
		template.set(EKK0451C030CBSMsg.SVC_ENDYMD, this.opeDate);
		// サービス課金終了年月日
		template.set(EKK0451C030CBSMsg.SVC_CHRG_ENDYMD,  this.opeDate);
		// サービス解約年月日
		template.set(EKK0451C030CBSMsg.SVC_DSL_YMD, this.opeDate);
		// サービス解約理由コード 01.通常解約
		template.set(EKK0451C030CBSMsg.SVC_DLRE_CD, ccMapWork.get(EKK0451C030CBSMsg.SVC_DLRE_CD));
		// サービス解約理由メモ：null
		// 更新年月日時分秒(更新前)
		template.set(EKK0451C030CBSMsg.UPD_DTM_BF, resMsg.getString(EKK0451A010CBSMsg1List.UPD_DTM));
		
		/* 業務 ↑↑ ここまで ================================================================================= */
		
		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);
		
		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0451C030);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0451List = getRsltList(result);
		
		printlnEjbLog("callEKK0451C030 end");
		return kk0451List.get(0);
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>割引サービス契約登録サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  ccMapWork
	 * @param  msg
	 * @param  tgMsg
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg callEKK0451D010(String funcCd, Map<String, Object> ccMapWork, CAANMsg msg, HashMap<String, Object> tgMsg) throws Throwable {
		printlnEjbLog("callEKK0451D010 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 割引サービス契約解約サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0451D010CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0451D010CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0481B002CBSMsg.TEMPLATEID, this.EKK0451D010);
		// 機能コード
		template.set(EKK0481B002CBSMsg.FUNC_CODE, funcCd);
		
		/* 業務 ↓↓ ここから ================================================================================= */
		
		// SYSID
		template.set(EKK0451D010CBSMsg.SYSID, msg.getString(EKK0451A010CBSMsg1List.SYSID));
		// 割引サービスコード
		template.set(EKK0451D010CBSMsg.WRIB_SVC_CD, msg.getString(EKK0451A010CBSMsg1List.WRIB_SVC_CD));
		// 料金コースコード(ファミリーパックの場合のみ入力)
		template.set(EKK0451D010CBSMsg.PCRS_CD, msg.getString(EKK0451A010CBSMsg1List.PCRS_CD));
		// 料金プランコード(ファミリーパックの場合のみ入力)
		template.set(EKK0451D010CBSMsg.PPLAN_CD, msg.getString(EKK0451A010CBSMsg1List.PPLAN_CD));
		// サービス利用開始希望年月日
		template.set(EKK0451D010CBSMsg.SVC_USE_STA_KIBO_YMD, msg.getString(EKK0451A010CBSMsg1List.SVC_USE_STA_KIBO_YMD));
		// 予約適用開始希望年月日
		template.set(EKK0451D010CBSMsg.RSV_TSTA_KIBO_YMD, msg.getString(EKK0451A010CBSMsg1List.RSV_TSTA_KIBO_YMD));
		// 申込明細番号
		template.set(EKK0451D010CBSMsg.MSKM_DTL_NO, ccMapWork.get(EKK0451D010CBSMsg.MSKM_DTL_NO));
		// 即時適用フラグ
		template.set(EKK0451D010CBSMsg.APLY_JUN, msg.getString(EKK0451A010CBSMsg1List.APLY_JUN));
		// 違約金発生コード
		template.set(EKK0451D010CBSMsg.PNLTY_HASSEI_CD, msg.getString(EKK0451A010CBSMsg1List.PNLTY_HASSEI_CD));
		// 異動区分
		template.set(EKK0451D010CBSMsg.IDO_DIV, ccMapWork.get(EKK0451D010CBSMsg.IDO_DIV));
		// 申込起算年月日
		template.set(EKK0451D010CBSMsg.MSKM_KISAN_YMD, msg.getString(EKK0451A010CBSMsg1List.MSKM_KISAN_YMD));
		// 割引登録契機コード
		template.set(EKK0451D010CBSMsg.WRIB_ADD_OPTY_CD, msg.getString(EKK0451A010CBSMsg1List.WRIB_ADD_OPTY_CD));
		// 割引課金開始月指定コード
		template.set(EKK0451D010CBSMsg.WRIB_CHRG_STA_MON_STI_CD, msg.getString(EKK0451A010CBSMsg1List.WRIB_CHRG_STA_MON_STI_CD));
		// 更新年月日時分秒(更新前)
		template.set(EKK0451D010CBSMsg.UPD_DTM_BF, msg.getString(EKK0451A010CBSMsg1List.LAST_UPD_DTM));
		// 割引サービス契約自動継続識別コード
		template.set(EKK0451D010CBSMsg.WRIB_SVC_KEI_AT_KEIZK_SKCD, msg.getString(EKK0451A010CBSMsg1List.WRIB_SVC_KEI_AT_KEIZK_SKCD));
		// 割引登録年月日
		template.set(EKK0451D010CBSMsg.WRIB_ADD_YMD, msg.getString(EKK0451A010CBSMsg1List.WRIB_ADD_YMD));
		
		// 割引サービス対象契約
		CAANMsg[] templateArray = template.getCAANMsgList(EKK0451D010CBSMsg.EKK0451D010CBSMSG1LIST);
		if (templateArray == null) {
			templateArray = new CAANMsg[tgMsg.size()];
		}
		
		Iterator<String> ite = tgMsg.keySet().iterator();
		int i=0;
		while (ite.hasNext()) {
			String key = ite.next();
			CAANMsg ekk0481a010 = (CAANMsg) tgMsg.get(key);
			
			CAANMsg childTemplate = templateArray[i];
			
			if (childTemplate == null) 
				childTemplate = new CAANMsg(EKK0451D010CBSMsg1List.class.getName());
			
			// 対象契約識別コード
			childTemplate.set(EKK0451D010CBSMsg1List.TG_KEI_SKBT_CD, ekk0481a010.getString(EKK0481A010CBSMsg1List.TG_KEI_SKBT_CD));
			
			// サービス契約番号
			childTemplate.set(EKK0451D010CBSMsg1List.SVC_KEI_NO, ekk0481a010.getString(EKK0481A010CBSMsg1List.SVC_KEI_NO));
			
			// オプションサービス契約番号
			childTemplate.set(EKK0451D010CBSMsg1List.OP_SVC_KEI_NO, ekk0481a010.getString(EKK0481A010CBSMsg1List.OP_SVC_KEI_NO));
			
			// 機器提供サービス契約番号
			childTemplate.set(EKK0451D010CBSMsg1List.KKTK_SVC_KEI_NO, ekk0481a010.getString(EKK0481A010CBSMsg1List.KKTK_SVC_KEI_NO));
			
			// 割引サービス対象サービスコード
			childTemplate.set(EKK0451D010CBSMsg1List.WRIB_SVC_TRGT_SVC_CD, ekk0481a010.getString(EKK0481A010CBSMsg1List.WRIB_SVC_TRGT_SVC_CD));
			
			// 設定登録年月日
			childTemplate.set(EKK0451D010CBSMsg1List.SET_ADD_YMD, ekk0481a010.getString(EKK0481A010CBSMsg1List.SET_ADD_YMD));
			
			// 割引サービス対象契約適用開始年月日
			childTemplate.set(EKK0451D010CBSMsg1List.WRISVC_TG_KEI_TSTAYMD, ekk0481a010.getString(EKK0481A010CBSMsg1List.WRISVC_TG_KEI_TSTAYMD));
			
			// 割引サービス対象契約適用終了年月日
			childTemplate.set(EKK0451D010CBSMsg1List.WRISVC_TG_KEI_TENDYMD, ekk0481a010.getString(EKK0481A010CBSMsg1List.WRISVC_TG_KEI_TENDYMD));
			
			templateArray[i] = childTemplate;
			i++;
		}
		
		// 割引サービス対象契約明細
		template.set(EKK0451D010CBSMsg.EKK0451D010CBSMSG1LIST, templateArray);
		
		/* 業務 ↑↑ ここまで ================================================================================= */
		
		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);

		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0451D010);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0451List = getRsltList(result);
		
		printlnEjbLog("callEKK0451D010 end");
		return kk0451List.get(0);
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>課金先登録サービスIFを呼び出す<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param  funcCd 
	 * @param  seikyKeiNo
	 * @param  wribSvcKeiNo
	 * @param  updDtm
	 * @return 
	 * @throws Throwable
	 */
	public CAANMsg callEKK0321D010(String funcCd, String seikyKeiNo, String wribSvcKeiNo, String updDtm) throws Throwable {
		printlnEjbLog("callEKK0321D010 start");
		
		/* --------------------------------------------------
		 * CC項目 -> SC項目 上りマッピング
		 * -------------------------------------------------- */
		HashMap<String, Object> inMap = new HashMap<String, Object>();

		// 割引サービス契約解約確定サービスインターフェイスを作成
		CAANMsg template = new CAANMsg(EKK0321D010CBSMsg.class.getName());

		// nullを設定
		fillCAANMSGNullMapping(template, new EKK0321D010CBSMsg().getContents());

		// テンプレートID
		template.set(EKK0321D010CBSMsg.TEMPLATEID, this.EKK0321D010);
		// 機能コード
		template.set(EKK0321D010CBSMsg.FUNC_CODE, funcCd);
		
		/* 業務 ↓↓ ここから ================================================================================= */
		
		// 割引サービス契約番号
		template.set(EKK0321D010CBSMsg.SEIKY_KEI_NO, seikyKeiNo);
		// 割引サービス契約番号
		template.set(EKK0321D010CBSMsg.WRIB_SVC_KEI_NO, wribSvcKeiNo);
		// 課金開始年月日
		template.set(EKK0321D010CBSMsg.KAKINS_TSTAYMD, this.opeDate);
		// 課金終了年月日
		template.set(EKK0321D010CBSMsg.KAKINS_TENDYMD, "20991231");
		// 更新年月日時分秒
		template.set(EKK0321D010CBSMsg.UPD_DTM_BF, updDtm);
		
		/* 業務 ↑↑ ここまで ================================================================================= */
		
		// 共通情報設定処理
		templateCommonInfo(template);
		
		CAANMsg[] templates = new CAANMsg[1];
		templates[0] = template;
		inMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);
		
		// SCインプット共通データ設定処理
		setSCInputCommonData(inMap);
		
		printlnEjbLog("inMap="  + inMap.toString());
		printlnEjbLog("handle=" + this.handle.toString());
		
		/* --------------------------------------------------
		 * サービスIF実行
		 * -------------------------------------------------- */
		Map<?, ?> result = this.scCall.run(inMap, this.handle);
		
        // エラー情報の設定
		this.param = editResultRP(result, this.param, this.EKK0321D010);
		
		checkExecutionResult(result);
		
		/* --------------------------------------------------
		 * CC項目 <- SC項目 下りマッピング
		 * -------------------------------------------------- */
		// 結果をリストで取得
		ArrayList<CAANMsg> kk0321List = getRsltList(result);
		
		printlnEjbLog("callEKK0321D010 end");
		return kk0321List.get(0);
	}
	
	/**
	 * 
	 * <dl>
	 * <dt>処理概要：
	 * <dd>サービスコンポーネント実行後に、IRequestParameterReadWriteにエラー情報をマッピングする<BR>
	 * <dt>処理補足：
	 * <dd>
	 * </dl>
	 * 
	 * @param param      業務データ取得・書込用I/F
	 * @param templates  CAANMsgクラス配列
	 * @param returnCode リターンコード
	 * @param mapName    SCマップ名
	 * 
	 * @return 業務データ取得・書込用I/F
	 */
	@SuppressWarnings({ "unchecked", "cast", "null", "boxing" })
	public IRequestParameterReadWrite editErrorInfo(@SuppressWarnings("hiding") IRequestParameterReadWrite param,
													 CAANMsg[] templates,
													 int returnCode,
													 String mapName) throws Throwable {
		CAANMsg template = templates[0];
		CAANMsg[] templateArray = null;
		int templateStatus = template.getInt(EKK0451B005CBSMsg.STATUS);
		if (returnCode != 0) {
			templateStatus = 9000;
		}
		if (JCMAPLConstMgr.getString("RETURN_MESSAGE_" + String.format("%1$04d", templateStatus)) == null) {
			templateStatus = 0;
		}
		
		int bpStatus = 0;
		Object obj = param.getControlMapData(SCControlMapKeys.RETURN_CODE);
		if (obj == null) {
			bpStatus = -1;
		} else {
			bpStatus = Integer.parseInt((String)param.getControlMapData(SCControlMapKeys.RETURN_CODE));
		}

		if (templateStatus > bpStatus) {
			
			// BPにサービスコンポーネントのステータスを設定する。
			String formatStatus = String.format("%1$04d", templateStatus);
			String message = JCMAPLConstMgr.getString("RETURN_MESSAGE_" + formatStatus);
			param.setControlMapData(SCControlMapKeys.RETURN_CODE, formatStatus);
			param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, message);
		}
		
		HashMap inMap = null;
		ArrayList inList = null;
		
		// 作業項目領域
		Map workMap = (Map)param.getMappingWorkArea();
		if (workMap == null) {
			workMap = new HashMap();
			param.setMappingWorkArea(workMap);
		}
		
		/* ユーザデータ情報 */
		inMap = (HashMap)param.getData(mapName);
		if (inMap == null) {
			inMap = new HashMap();
			param.setData(mapName, inMap);
		}

		String svcIf = null;
		if (svcIf == null) {
			return param;
			
		} else {
			
			// 処理なし
		}
		return param;
	}
}
