/*********************************************************************
*	All Right reserved,Copyright (c) Fujitsu, 2010
**********************************************************************
*＜プログラム内容＞
*	システム名		：Futurity
*	モジュール名	：JACPrcMessageGetUtil
*	ソースファイル名：JACPrcMessageGetUtil.java
*	作成者			：富士通
*	日付			：2012年08月06日
*＜機能概要＞
*	料金メッセージ取得クラス
*＜修正履歴＞
*	バージョン	修正日		修正者		修正内容
*	v4.00.00	2012/08/06	富士通 藤井 新規作成
*
**********************************************************************/

package eo.web.webview.common;

import java.util.ArrayList;

import eo.common.util.JCRUtilCommon;

public class JACPrcMessageGetUtil {

	/**
	 * メッセージ取得処理
	 * 
	 * 料金メッセージファイルを読み込み、メッセージを取得する。
	 * 
	 * @param shinsaKekkaRsnCd 審査結果理由コード
	 * @return メッセージ
	 * @throws Exception 
	 */
	protected static ArrayList<String> getPrcMsg(String shinsaKekkaRsnCd) throws Exception
	{
		ArrayList<String> retList = new ArrayList<String>();

		if (JCRUtilCommon.isNull(shinsaKekkaRsnCd))
		{
			return retList;
		}

		if (shinsaKekkaRsnCd.charAt(0) == '9')
		{
			retList.add(JACPrcMessageCache.getValue("MSG1"));
		}
		else if (shinsaKekkaRsnCd.charAt(0) == '8')
		{
			retList.add(JACPrcMessageCache.getValue("MSG2"));
		}
		else if (shinsaKekkaRsnCd.charAt(0) == '7')
		{
			// 審査理由コードの9桁目
			String repStr = String.valueOf(shinsaKekkaRsnCd.charAt(9));

			String repMsg = JACPrcMessageCache.getValue(repStr);

			if (!JCRUtilCommon.isNull(repMsg))
			{
				String orgMsg = JACPrcMessageCache.getValue("MSG3");
				// 置換文字列でメッセージを置換
				retList.add(orgMsg.replaceAll("%1%", repMsg));
			}
		}
		else if (shinsaKekkaRsnCd.charAt(0) == '6')
		{
			// -------------------------------------------------- //
			// 2桁目
			// -------------------------------------------------- //
			if (shinsaKekkaRsnCd.charAt(1) == '1')
			{
				retList.add(JACPrcMessageCache.getValue("MSG4"));
			}

			// -------------------------------------------------- //
			// 3桁目
			// -------------------------------------------------- //
			if (shinsaKekkaRsnCd.charAt(2) == '1')
			{
				retList.add(JACPrcMessageCache.getValue("MSG5"));
			}

			// -------------------------------------------------- //
			// 4桁目
			// -------------------------------------------------- //
			if (shinsaKekkaRsnCd.charAt(3) == '1')
			{
				retList.add(JACPrcMessageCache.getValue("MSG6"));
			}

			// -------------------------------------------------- //
			// 5桁目
			// -------------------------------------------------- //
			String repStr7 = String.valueOf(shinsaKekkaRsnCd.charAt(4));

			String repMsg7 = JACPrcMessageCache.getValue(repStr7);

			if (!JCRUtilCommon.isNull(repMsg7))
			{
				String orgMsg7 = JACPrcMessageCache.getValue("MSG7");

				// 置換文字列でメッセージを置換
				retList.add(orgMsg7.replaceAll("%1%", repMsg7));
			}

			// -------------------------------------------------- //
			// 6桁目
			// -------------------------------------------------- //
			String repStr8 = String.valueOf(shinsaKekkaRsnCd.charAt(5));

			String repMsg8 = JACPrcMessageCache.getValue(repStr8);

			if (!JCRUtilCommon.isNull(repMsg8))
			{
				String orgMsg8 = JACPrcMessageCache.getValue("MSG8");

				// 置換文字列でメッセージを置換
				retList.add(orgMsg8.replaceAll("%1%", repMsg8));
			}

			// -------------------------------------------------- //
			// 7桁目
			// -------------------------------------------------- //
			String repStr9 = String.valueOf(shinsaKekkaRsnCd.charAt(6));

			String repMsg9 = JACPrcMessageCache.getValue(repStr9);

			if (!JCRUtilCommon.isNull(repMsg9))
			{
				String orgMsg9 = JACPrcMessageCache.getValue("MSG9");

				// 置換文字列でメッセージを置換
				retList.add(orgMsg9.replaceAll("%1%", repMsg9));
			}

			// -------------------------------------------------- //
			// 8桁目
			// -------------------------------------------------- //
			String repStr10 = String.valueOf(shinsaKekkaRsnCd.charAt(7));

			String repMsg10 = JACPrcMessageCache.getValue(repStr10);

			if (!JCRUtilCommon.isNull(repMsg10))
			{
				String orgMsg10 = JACPrcMessageCache.getValue("MSG10");

				// 置換文字列でメッセージを置換
				retList.add(orgMsg10.replaceAll("%1%", repMsg10));
			}
		}

		return retList;
	}
}
