/*********************************************************************
* All Rights reserved,Copyright (c) K-Opticom
**********************************************************************
*＜プログラム内容＞
*   システム名      ：eo顧客基幹システム
*   モジュール名    ：JFUFUSV025705ReqChk
*   ソースファイル名：JFUFUSV025705ReqChk.java
*   作成者          ：富士通
*   日付            ：2017年05月02日
*＜機能概要＞
*   セキュリティパック申込他オプション更新実行判定部品です。
*＜修正履歴＞
*   バージョン  修正日       修正者      修正内容
*   v32.00      2017/05/02   FJ）岡井    【ANK-3149-00-00】新セキュリティパック導入
*
**********************************************************************/
package com.fujitsu.futurity.bp.custom.reqchk;

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.parameter.IRequestParameterReadOnly;
import com.fujitsu.futurity.bp.x21.bpm.reqchk.exception.ReqChkException;

import eo.common.constant.JPCModelConstant;

/**
 * セキュリティパック申込他オプション更新実行判定部品
 * <br>
 * @author 富士通
 */
public class JFUFUSV025705ReqChk extends AbstractCustomReqChk
{

	/** FUSV025705CC */
	private static final String FUSV025705CC = "FUSV025705CC";
	/** 機能コード  */
	private static final String FUNC_CD = "func_code";
	/** ファミリーパック解約有無  */
	private static final String FP_DSL_UM = "fp_dsl_um";
	/** ウイルスバスター解約有無  */
	private static final String VB_DSL_UM = "vb_dsl_um";
	/** 多機能ルーター処理パターン  */
	private static final String TAKINO_RT_TRN_PTN = "takinortTrnPtn";

	/** 解約有無：解約有 */
	private static final String KAIYAKU_UM_1 = "1";
	/** 多機能ルーター処理パターン：処理しない */
	private static final String TKN_RT_SHORI_PT_0 = "0";

	/**
	 * 実行判定クラス判定処理
	 * <br/>
	 * @param irp リクエストパラメータ操作クラス
	 * @param conditionvalue (I)判定値格納クラス
	 * @return 条件を満たすときはtrue、満たさないときはfalse
	 * @throws ReqChkException
	 */
	@SuppressWarnings("unchecked")
	@Override
	public boolean checkExecution(IRequestParameterReadOnly irp, IConditionValue conditionvalue) throws ReqChkException
	{
		boolean result = false;

		try
		{
			// リクエストパラメータから、セキュリティパック申込他オプション更新CCマップを取得
			HashMap<String, Object> parentMap = (HashMap<String, Object>)irp.getData(FUSV025705CC);

			if(parentMap != null && parentMap.size() > 0)
			{
				if(parentMap.containsKey(FUNC_CD) && !JPCModelConstant.FUNC_CD_1.equals((String)parentMap.get(FUNC_CD)))
				{
					// 「機能コード」≠"1"(登録)の場合、判定結果にfalseを設定
					result = false;
				}
				else if(parentMap.containsKey(FP_DSL_UM) && KAIYAKU_UM_1.equals((String)parentMap.get(FP_DSL_UM)))
				{
					// 「ファミリーパック解約有無」＝"1"(有)の場合、判定結果にtrueを設定
					result = true;
				}
				else if(parentMap.containsKey(VB_DSL_UM) && KAIYAKU_UM_1.equals((String)parentMap.get(VB_DSL_UM)))
				{
					// 「ウイルスバスター解約有無」＝"1"(有)の場合、判定結果にtrueを設定
					result = true;
				}
				else if(parentMap.containsKey(TAKINO_RT_TRN_PTN) && !TKN_RT_SHORI_PT_0.equals((String)parentMap.get(TAKINO_RT_TRN_PTN)))
				{
					// 「多機能ルーター処理パターン」≠"0"(処理しない)の場合、判定結果にtrueを設定
					result = true;
				}
			}
			else
			{
				// セキュリティパック申込他オプション更新CCマップが存在しない場合、判定結果にfalseを設定
				result = false;
			}
		}
		catch (Exception e)
		{
			// 例外発生時
			return false;
		}

		return result;
	}
}