/*********************************************************************
 * All Rights reserved,Copyright (c) K-Opticom
 **********************************************************************
 *＜プログラム内容＞
 *   システム名      ：eo顧客基幹システム
 *   モジュール名    ：JKKOpsvkeiShokaiListCC
 *   ソースファイル名：JKKOpsvkeiShokaiListCC.java
 *   作成者          ：富士通
 *   日付            ：2011年04月22日
 *＜機能概要＞
 *   コード名称管理取得部品です。
 *＜修正履歴＞
 *   バージョン  修正日       修正者      修正内容
 *   v1.00.00    2011/04/22   FJ）青木    新規作成
 *
 **********************************************************************/
package com.fujitsu.futurity.bp.custom.common;

import java.util.HashMap;

import com.fujitsu.futurity.bp.custom.constant.KKSV0038_KKSV0038OP;
import com.fujitsu.futurity.bp.custom.constant.KKSV0038_KKSV0038OP_KKSV003801SC;
import com.fujitsu.futurity.bp.custom.constant.KKSV0038_KKSV0038OP_KKSV003802SC;
import com.fujitsu.futurity.bp.custom.mapping.KKSV0038_KKSV0038OP_EKK0841B001BSMapper;
import com.fujitsu.futurity.bp.custom.mapping.KKSV0038_KKSV0038OP_EKK1351B001BSMapper;
import com.fujitsu.futurity.bp.x21.bpm.db.SessionHandle;
import com.fujitsu.futurity.bp.x21.bpm.exception.RequestParameterException;
import com.fujitsu.futurity.bp.x21.bpm.parameter.IRequestParameterReadWrite;
import com.fujitsu.futurity.model.base.CAANMsg;


/**
 * ページ処理用割引サービス一覧照会取得処理です。
 * <p>
 * <br>
 * 
 * @author 富士通
 */
public class JKKW01004PageCC extends JKKPageControlCC
{

	@Override
	public void setInfo() {}
	
	/**
	 * 一覧照会取得処理です。
	 * 
	 * 
	 * @param handle セッションマネージャなどを持ったハンドル
	 * @param param モデルグループ、コントロールマップを含むパラメータオブジェクト
	 * @param fixedText ユーザ任意文字列
	 * @return 業務データ取得・書込用I/F
	 * @throws Throwable
	 */
	public  IRequestParameterReadWrite search(SessionHandle handle, IRequestParameterReadWrite param, String fixedText) throws Throwable
	{
		if (!isNoData(param, KKSV0038_KKSV0038OP.KKSV003801SC)) {

			input_mapper = new KKSV0038_KKSV0038OP_EKK0841B001BSMapper();
			errinfo_mapper = new KKSV0038_KKSV0038OP_EKK0841B001BSMapper();
			output_mapper = new KKSV0038_KKSV0038OP_EKK0841B001BSMapper();
			bp_mapkey = KKSV0038_KKSV0038OP.KKSV003801SC;
			db_listkey = KKSV0038_KKSV0038OP_KKSV003801SC.EKK0841B001CBSMSG1LIST;
		}
		else if (!isNoData(param, KKSV0038_KKSV0038OP.KKSV003802SC)) {

			input_mapper = new KKSV0038_KKSV0038OP_EKK1351B001BSMapper();
			errinfo_mapper = new KKSV0038_KKSV0038OP_EKK1351B001BSMapper();
			output_mapper = new KKSV0038_KKSV0038OP_EKK1351B001BSMapper();
			bp_mapkey = KKSV0038_KKSV0038OP.KKSV003802SC;
			db_listkey = KKSV0038_KKSV0038OP_KKSV003802SC.EKK1351B001CBSMSG1LIST;
		}
		
		return super.search(handle, param, fixedText);
	}

	/**
	 * 一覧照会チェック処理です。<br>
	 * チェック処理用のマップを作成し返却します。<br>
	 * <br>
	 * 
	 * @param handle セッションハンドル
	 * @param param (I) 業務データ取得用I/F
	 * @param fixedText (I) ユーザ定義文字列
	 * @return サービスコンポーネント実行用CAANMsg
	 * @exception Throwableがスローされます 。
	 */
	public HashMap<String, Object> getInvokeCBS(SessionHandle handle, IRequestParameterReadWrite param, String fixedText) throws Throwable
	{
		if (!isNoData(param, KKSV0038_KKSV0038OP.KKSV003801SC)) {
			input_mapper = new KKSV0038_KKSV0038OP_EKK0841B001BSMapper();
		}
		else if (!isNoData(param, KKSV0038_KKSV0038OP.KKSV003802SC)) {
			input_mapper = new KKSV0038_KKSV0038OP_EKK1351B001BSMapper();
		}
		return super.getInvokeCBS(handle, param, fixedText);
	}

	/**
	 *<DL>
	 *<DT>処理概要:
	 *<DD>サービスコンポーネント実行後に、IRequestParameterReadWriteにエラー情報をマッピングする
	 *</DL>
	 * 
	 * @param param (I) 業務データ取得・書込用I/F
	 * @param templates (I) CAANMsgクラス配列
	 * @param returnCode (I) リターンコード
	 * @return 業務データ取得・書込用I/F
	 * @throws Throwable
	 * @since 2011.05.19
	 */
	public IRequestParameterReadWrite editErrorInfo(IRequestParameterReadWrite param, CAANMsg[] templates, int returnCode) throws Throwable
	{
		if (!isNoData(param, KKSV0038_KKSV0038OP.KKSV003801SC)) {
			errinfo_mapper = new KKSV0038_KKSV0038OP_EKK0841B001BSMapper();
		}
		else if (!isNoData(param, KKSV0038_KKSV0038OP.KKSV003802SC)) {
			errinfo_mapper = new KKSV0038_KKSV0038OP_EKK1351B001BSMapper();
		}
		return super.editErrorInfo(param, templates, returnCode);
	}
	
	/**
	 * SCマップIDで取得できる場合はfalse、取得できない場合はtrue
	 * 
	 * @param param
	 * @param scId
	 * @return
	 * @throws RequestParameterException
	 */
	@SuppressWarnings("unchecked")
	private boolean isNoData(IRequestParameterReadWrite param, String scId) throws RequestParameterException
	{
		HashMap map = (HashMap)param.getData(scId);
		if (map == null || map.size() == 0) {
			return true;
		}
		return false;
	}
}
