/*********************************************************************
* All Rights reserved,Copyright (c) K-Opticom
**********************************************************************
*＜プログラム内容＞
*   システム名      ：eo顧客基幹システム
*   モジュール名    ：JFUFUSV038102ReqChk
*   ソースファイル名：JFUFUSV038102ReqChk.java
*   作成者          ：富士通
*   日付            ：2024年12月23日
*＜機能概要＞
*   実行判定部品です。
*＜修正履歴＞
*   バージョン  修正日       修正者      修正内容
*   v1.00.00    2024/12/23   FJ          新規作成
*
**********************************************************************/
package com.fujitsu.futurity.bp.custom.reqchk;

import java.util.ArrayList;
import java.util.HashMap;

import com.fujitsu.futurity.bp.x21.bpm.common.AbstractCustomReqChk;
import com.fujitsu.futurity.bp.x21.bpm.common.IConditionValue;
import com.fujitsu.futurity.bp.x21.bpm.exception.RequestParameterException;
import com.fujitsu.futurity.bp.x21.bpm.parameter.IRequestParameterReadOnly;
import com.fujitsu.futurity.bp.x21.bpm.reqchk.exception.ReqChkException;

import eo.common.constant.JFUStrConst;

/**
 * 実行判定部品
 * <BR>
 * @author 富士通
 *
 */
public class JFUFUSV038102ReqChk extends AbstractCustomReqChk
{

	private static final String FUSV038103_S_C = "FUSV038103SC";
	/** オプションサービス一意照会明細 */
	private static final String EKK0821_A010_C_B_S_MSG1_LIST = "EKK0821A010CBSMsg1List";
	/** オプションチャンネルオペレーション方法コード */
	private static final String OP_CHANNEL_OPRTN_WAY_CD = "op_channel_oprtn_way_cd";
	/** デジタルティアグループコード */
	private static final String DGTIA_GRP_CD = "dgtia_grp_cd";
//	/** 視聴制御オーダ送信CC 呼び出しパラメータ */
//	private static final String JKKWCTRL_ORDER_SEND_C_C = "1";

	/**
	 * オプションチャンネルオペレーション方法判定部品
	 * <BR>
	 * 値が設定されているかを判定します。
	 * <BR>
	 * @param  irp  リクエストパラメータ
	 * @param  conditionvalue  判定値格納クラス
	 * @return 設定されている場合True
	 * @throws ReqChkException
	 */
	@SuppressWarnings("unchecked")
	public boolean checkExecution(IRequestParameterReadOnly irp, IConditionValue conditionvalue) throws ReqChkException
	{

		HashMap<String, Object> parentMap = null;
		String opChannelOprtnWayCd = null; // オプションチャンネルオペレーション方法コード
		String dgtiaGrpCd = null; // デジタルティアグループコード
		ArrayList list = null;
		boolean result = false; // 処理結果

		try
		{
			// SCマップからオプションサービス一意照会マップ(FUSV038103SC)を取得
			parentMap = (HashMap<String, Object>)irp.getData(FUSV038103_S_C);
			String checkString = null;
			if (conditionvalue != null)
			{
				checkString = conditionvalue.get(null);
			}

			if (parentMap.containsKey(EKK0821_A010_C_B_S_MSG1_LIST))
			{
				// オプションチャンネル契約状態一覧を取得
				list = (ArrayList)parentMap.get(EKK0821_A010_C_B_S_MSG1_LIST);

				if (list != null && list.size() > 0)
				{
					HashMap childMap = (HashMap)list.get(0);

					// オプションチャンネルオペレーション方法コードを取得
					opChannelOprtnWayCd = (String)childMap.get(OP_CHANNEL_OPRTN_WAY_CD);
					// デジタルティアグループコードを取得
					dgtiaGrpCd = (String)childMap.get(DGTIA_GRP_CD);

					// オプションチャンネルオペレーション方法コードが"1"(自動) または、"3"(解約のみ手動)の場合
					if (opChannelOprtnWayCd.equals(JFUStrConst.CD00877_1) || opChannelOprtnWayCd.equals(JFUStrConst.CD00877_3))
					{
//  ANK-4592 削除 DEL START ------------------------------*
//						if (JKKWCTRL_ORDER_SEND_C_C.equals(checkString))
//						{
//							// CC呼び出しの場合
//							if (!(dgtiaGrpCd == null || JFUStrConst.EMPTY.equals(dgtiaGrpCd)))
//							{
//								// デジタルティアグループコードが設定されている場合のみ呼び出す
//								result = true;
//							}
//						} else {
//							// CC呼び出し以外
//							result = true;
//						}
//  ANK-4592 削除 DEL END ------------------------------*
//  ANK-4592 ADD START  ---------------------------------------------*
						result = true;
//  ANK-4592 ADD END   ---------------------------------------------*
					}
				}
			}
		}
		catch (RequestParameterException e)
		{
			throw new ReqChkException(e.getMessage(),e);
		}

		return result;
	}
}
