package com.fujitsu.futurity.bp.custom.reqchk;

import java.util.ArrayList;
import java.util.HashMap;

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.ejb.cbs.cbsmsg.EKK0161A010CBSMsg;
import eo.ejb.cbs.cbsmsg.EKK0161A010CBSMsg1List;

public class JKKSV021110ReqChk  extends JKKSV021109ReqChk {
	
	/**
	 * 電話番号情報登録・光電話・電話番号情報変更の実行判定クラス
	 */
	@SuppressWarnings("unchecked")
	public boolean checkExecution(IRequestParameterReadOnly irp,
			IConditionValue conditionvalue) throws ReqChkException 
	{
		
		boolean result;
		HashMap<String, Object> kKSV021117SCHash;
		ArrayList<HashMap<String, Object>> eKK161A010CBSMSG1LIST;
		HashMap<String, Object> eKK161A010CBSMSG1LISTElement;
		String svcKeiStat;

		//一旦、スーパークラスの判定にゆだねる
		result = super.checkExecution(irp, conditionvalue);
		
		if(result == false)
		{
			return false;
		}
		
		try
		{
			//サービス契約内訳一意照会結果の取得
			kKSV021117SCHash = (HashMap<String, Object>)irp.getData("KKSV021117SC");
			eKK161A010CBSMSG1LIST = (ArrayList<HashMap<String, Object>>)kKSV021117SCHash.get(EKK0161A010CBSMsg.EKK0161A010CBSMSG1LIST);
			eKK161A010CBSMSG1LISTElement = eKK161A010CBSMSG1LIST.get(0);
			
			//内訳のサービス契約ステータスの取得
			svcKeiStat = (String)eKK161A010CBSMSG1LISTElement.get(EKK0161A010CBSMsg1List.SVC_KEI_UCWK_STAT);
			
			//サービス契約ステータスが受付済,照査済の場合は実行しない
			if("010".equals(svcKeiStat) || "020".equals(svcKeiStat))
			{
				return false;
			}
			
		}
		catch (RequestParameterException e) 
		{
			return false;
		}
		
		return true;
			
	}

}
