/*********************************************************************
* All Rights reserved, Copyright (c) K-Opticom
**********************************************************************
*＜プログラム内容＞
*   システム名      ：eo顧客基幹システム共通（共通マスタ）
*   モジュール名    ：ZMW00701SFLogic
*   ソースファイル名：ZMW00701SFLogic.java
*   作成者          ：富士通
*   日付            ：2012年05月17日
*＜機能概要＞
*   権限グループ情報登録のビューロジックです。
*＜修正履歴＞
*   バージョン  修正日       修正者      修正内容
*   v3.00       2012/05/17   FJ）北島    新規作成
*   v3.00       2012/05/17   FJ）北島    【SGY-2012-000006】統合認証対応
*
**********************************************************************/

package eo.web.webview.ZMW00701SF;

import java.util.ArrayList;
import java.util.HashMap;

import com.fujitsu.futurity.web.x31.X31CWebConst;
import com.fujitsu.futurity.web.x31.X31SDataBeanAccess;

import eo.common.constant.JPCModelConstant;
import eo.common.constant.JPCOnlineMessageConstant;
import eo.common.util.JPCEditString;
import eo.common.util.JPCUtilCommon;
import eo.web.webview.JCCWebBusinessLogic;
import eo.web.webview.CommonInfoCF.CommonInfoCFConst;
import eo.web.webview.ZMW11901SF.ZMW11901SFConst;
import eo.web.webview.ZMW12001SF.ZMW12001SFConst;
import eo.web.webview.ZMW12101SF.ZMW12101SFConst;
import eo.web.webview.ZMW12201SF.ZMW12201SFConst;
import eo.web.webview.ZMW12301SF.ZMW12301SFConst;
import eo.web.webview.common.JCCWebCommon;
import eo.web.webview.common.JZMScreenConst;
import eo.web.webview.common.JZMWebCommon;
import eo.web.webview.common.JZMWebConst;
import eo.web.webview.mapping.ZMSV0106_ZMSV0106OPDBMapper;
import eo.web.webview.mapping.ZMSV0121_ZMSV0121OPDBMapper;

/**
 *  権限グループ情報登録のビューロジックです。
 * @author 909397
 *
 */
@SuppressWarnings("serial")
public class ZMW00701SFLogic extends JCCWebBusinessLogic
{
	/** メッセージ置換文字列  */
	private static final 	String[] MESSAGE_VALUE = {"権限グループ情報登録"};
	
	/** 権限適用組織種別コード：実組織 */
	private static final String REAL_ORG_CD = "01";
	
	/**
	 * 権限グループ情報登録初期表示処理を行います。
	 * <br>
	 * @return 処理結果 
	 * @throws Exception 予期せぬエラー
	 */
	@SuppressWarnings("unchecked")
	public boolean init() throws Exception
	{

		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		
		// サービスフォームBeanの内容の取得
		X31SDataBeanAccess bean = getServiceFormBean();
		
		// セッション情報取得
		HashMap<String, Object> searchInfo = JZMWebCommon.getScreenInfo(this);
		
		if(searchInfo == null)
		{
			setBackScreenId(commonBean, true);
			return true;
		}
		
		// サービスフォームBeanのデータBeanアクセスクラスを取得。
		X31SDataBeanAccess[] paramBean = {bean};

		// ユースケースID格納用マップ
		HashMap<String, Object> paramMap = new HashMap<String, Object>();

		// マッピング用Map
		HashMap<String, Object> dataMap = new HashMap<String, Object>();

		// サービス実行結果データ用Map
		HashMap<String, Object> outputMap = new HashMap<String, Object>();
		
		paramMap.put(X31CWebConst.TELEGRAM_INFO_USECASE_ID, JZMWebConst.SV121);
		
		// マッピングクラスのインスタンスを生成
		ZMSV0121_ZMSV0121OPDBMapper mapper = new ZMSV0121_ZMSV0121OPDBMapper();
		mapper.setZMSV012101SC(paramBean, dataMap, JPCModelConstant.FUNC_CD_1);
		
		if(dataMap.containsKey(JZMWebConst.SC12101))
		{
			//権限適用組織種別コードを取得
			String authorityAplyOrgSbtCd = (String)searchInfo.get(ZMW00701SFConst.AUTHORITY_APLY_ORG_SBT_CD);
			HashMap<String, Object> inDataMap = (HashMap<String, Object>)dataMap.get(JZMWebConst.SC12101);
			inDataMap.put(ZMW00701SFConst.AUTHORITY_APLY_ORG_SBT_CD, authorityAplyOrgSbtCd);
			
			if(REAL_ORG_CD.equals(authorityAplyOrgSbtCd))
			{
				bean.sendMessageBoolean(ZMW00701SFConst.WKKBT_DSP_FLG, X31CWebConst.DATABEAN_SET_VALUE, false);
			}
			else
			{
				bean.sendMessageBoolean(ZMW00701SFConst.WKKBT_DSP_FLG, X31CWebConst.DATABEAN_SET_VALUE, true);
			}
		}
		
		// サービスの呼び出し
		super.invokeService(paramMap, dataMap, outputMap);
		
		// マッピングクラスの呼び出し
		mapper.getZMSV012101SC(paramBean, outputMap);
		
		// 運用日付の取得
		String opeDate = JZMWebCommon.getOpeDate(this, null);
		
		// 適用年月日-年
		bean.sendMessageString(ZMW00701SFConst.APLY_PRD_STA_YEAR, X31CWebConst.DATABEAN_SET_VALUE, JPCEditString.toYearFromYmd(opeDate));
		
		// 適用年月日-月
		bean.sendMessageString(ZMW00701SFConst.APLY_PRD_STA_MON, X31CWebConst.DATABEAN_SET_VALUE, JPCEditString.toMonthFromYmd(opeDate));
		
		// 適用年月日-日
		bean.sendMessageString(ZMW00701SFConst.APLY_PRD_STA_DAY, X31CWebConst.DATABEAN_SET_VALUE, JPCEditString.toDayFromYmd(opeDate));
		
		// 遷移先画面ID、名称の設定
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID,
				X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00701);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME,
				X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_NAME_ZMW00701);
		
		return true;
	}
	
	/**
	 * ダイアログオープン共通処理
	 * @param screenID
	 * @param screenName
	 * @param param
	 */
	private void openDialog(String screenID, String screenName, HashMap<String, Object> param)
	{
		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		JCCWebCommon.setScreenInfo(this, screenID, param);
		
		// ダイアログ画面に自画面のIDを渡す
		JCCWebCommon.setScreenId(this, screenID, JZMScreenConst.SCREEN_ID_ZMW00701);
		
		// 遷移先画面ID、名称の設定
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID,
				X31CWebConst.DATABEAN_SET_VALUE, screenID);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME,
				X31CWebConst.DATABEAN_SET_VALUE, screenName);
	}
	
	/**
	 * 組織検索画面オープン処理
	 * @return 処理結果
	 */
	public boolean openZMW11901()
	{
		//サービスフォームBean
		X31SDataBeanAccess bean = getServiceFormBean();
		
		String orgCode = bean.sendMessageString(ZMW00701SFConst.ORG_CD, X31CWebConst.DATABEAN_GET_VALUE);
		
		HashMap<String, Object> dataMap = new HashMap<String, Object>();
		
		dataMap.put(ZMW11901SFConst.ORG_CD, orgCode);
		
		openDialog(JZMScreenConst.SCREEN_ID_ZMW11901, JZMScreenConst.SCREEN_NAME_ZMW11901, dataMap);
		
		return true;
	}
	
	/**
	 * 立場検索画面オープン処理
	 * @return 処理結果
	 */
	public boolean openZMW12001()
	{
		//サービスフォームBean
		X31SDataBeanAccess bean = getServiceFormBean();
		
		String posCode = bean.sendMessageString(ZMW00701SFConst.POSITION_CD, X31CWebConst.DATABEAN_GET_VALUE);
		
		HashMap<String, Object> dataMap = new HashMap<String, Object>();
		
		dataMap.put(ZMW12001SFConst.POSITION_CD, posCode);
		
		openDialog(JZMScreenConst.SCREEN_ID_ZMW12001, JZMScreenConst.SCREEN_NAME_ZMW12001, dataMap);
		
		return true;
	}
	
	/**
	 * ロール検索画面オープン処理
	 * @return 処理結果
	 */
	public boolean openZMW12101()
	{
		//サービスフォームBean
		X31SDataBeanAccess bean = getServiceFormBean();
		
		String roleCode = bean.sendMessageString(ZMW00701SFConst.ROLE_CD, X31CWebConst.DATABEAN_GET_VALUE);
		
		HashMap<String, Object> dataMap = new HashMap<String, Object>();
		
		dataMap.put(ZMW12101SFConst.ROLE_CD, roleCode);
		
		openDialog(JZMScreenConst.SCREEN_ID_ZMW12101, JZMScreenConst.SCREEN_NAME_ZMW12101, dataMap);
		
		return true;
	}
	
	/**
	 * 業務個別設定組織検索画面オープン処理
	 * @return 処理結果
	 */
	public boolean openZMW12201()
	{
		//サービスフォームBean
		X31SDataBeanAccess bean = getServiceFormBean();
		
		String wkkbtOrgCode = bean.sendMessageString(ZMW00701SFConst.WKKBT_ORG_CD, X31CWebConst.DATABEAN_GET_VALUE);
		String authCode     = bean.sendMessageString(ZMW00701SFConst.AUTHORITY_APLY_ORG_SBT_CD, X31CWebConst.DATABEAN_GET_VALUE);
		HashMap<String, Object> dataMap = new HashMap<String, Object>();
		
		dataMap.put(ZMW12201SFConst.WKKBT_ORG_CD, wkkbtOrgCode);
		dataMap.put(ZMW12201SFConst.AUTHORITY_APLY_ORG_SBT_CD, authCode);
		
		openDialog(JZMScreenConst.SCREEN_ID_ZMW12201, JZMScreenConst.SCREEN_NAME_ZMW12201, dataMap);
		
		return true;
	}
	
	/**
	 * 業務個別設定立場検索画面オープン処理
	 * @return 処理結果
	 */
	public boolean openZMW12301()
	{
		//サービスフォームBean
		X31SDataBeanAccess bean = getServiceFormBean();
		
		String wkkbtPosCode = bean.sendMessageString(ZMW00701SFConst.WKKBT_POSITION_CD, X31CWebConst.DATABEAN_GET_VALUE);
		String authCode     = bean.sendMessageString(ZMW00701SFConst.AUTHORITY_APLY_ORG_SBT_CD, X31CWebConst.DATABEAN_GET_VALUE);
		HashMap<String, Object> dataMap = new HashMap<String, Object>();
		
		dataMap.put(ZMW12301SFConst.WKKBT_POSITION_CD, wkkbtPosCode);
		dataMap.put(ZMW12301SFConst.AUTHORITY_APLY_ORG_SBT_CD, authCode);
		
		openDialog(JZMScreenConst.SCREEN_ID_ZMW12301, JZMScreenConst.SCREEN_NAME_ZMW12301, dataMap);
		
		return true;
	}
	
	/**s
	 * 組織検索画面クローズ処理
	 * @return 処理結果
	 */
	public boolean closeZMW11901()
	{
		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// サービスフォームBeanの内容の取得
		X31SDataBeanAccess bean = getServiceFormBean();
		
		// セッション情報取得
		HashMap<String, Object> parameterMap = JZMWebCommon.getScreenInfo(this);
		
		if(parameterMap.containsKey(ZMW00701SFConst.ORG_CD))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.ORG_CD, parameterMap.get(ZMW00701SFConst.ORG_CD).toString());
		}
		if(parameterMap.containsKey(ZMW00701SFConst.ORG_NM))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.ORG_NM, parameterMap.get(ZMW00701SFConst.ORG_NM).toString());
		}
		// 画面遷移
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00701);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst. SCREEN_NAME_ZMW00701);
		
		return true;
	}
	
	/**
	 * 立場検索画面クローズ処理
	 * @return 処理結果
	 */
	public boolean closeZMW12001()
	{
		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// サービスフォームBeanの内容の取得
		X31SDataBeanAccess bean = getServiceFormBean();
		
		// セッション情報取得
		HashMap<String, Object> parameterMap = JZMWebCommon.getScreenInfo(this);
		
		if(parameterMap.containsKey(ZMW00701SFConst.POSITION_CD))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.POSITION_CD, parameterMap.get(ZMW00701SFConst.POSITION_CD).toString());
		}
		if(parameterMap.containsKey(ZMW00701SFConst.POSITION_NM))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.POSITION_NM, parameterMap.get(ZMW00701SFConst.POSITION_NM).toString());
		}
		// 画面遷移
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00701);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst. SCREEN_NAME_ZMW00701);
		
		return true;
	}
	
	/**
	 * ロール検索画面クローズ処理
	 * @return 処理結果
	 */
	public boolean closeZMW12101()
	{
		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// サービスフォームBeanの内容の取得
		X31SDataBeanAccess bean = getServiceFormBean();
		
		// セッション情報取得
		HashMap<String, Object> parameterMap = JZMWebCommon.getScreenInfo(this);
		
		if(parameterMap.containsKey(ZMW00701SFConst.ROLE_CD))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.ROLE_CD, parameterMap.get(ZMW00701SFConst.ROLE_CD).toString());
		}
		if(parameterMap.containsKey(ZMW00701SFConst.ROLE_NM))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.ROLE_NM, parameterMap.get(ZMW00701SFConst.ROLE_NM).toString());
		}
		// 画面遷移
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00701);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst. SCREEN_NAME_ZMW00701);
		
		return true;
	}
	
	/**
	 * 業務個別設組織検索画面クローズ処理
	 * @return 処理結果
	 */
	public boolean closeZMW12201()
	{
		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// サービスフォームBeanの内容の取得
		X31SDataBeanAccess bean = getServiceFormBean();
		
		// セッション情報取得
		HashMap<String, Object> parameterMap = JZMWebCommon.getScreenInfo(this);
		
		if(parameterMap.containsKey(ZMW00701SFConst.WKKBT_ORG_CD))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.WKKBT_ORG_CD, parameterMap.get(ZMW00701SFConst.WKKBT_ORG_CD).toString());
		}
		if(parameterMap.containsKey(ZMW00701SFConst.WKKBT_ORG_NM))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.WKKBT_ORG_NM, parameterMap.get(ZMW00701SFConst.WKKBT_ORG_NM).toString());
		}
		// 画面遷移
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00701);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst. SCREEN_NAME_ZMW00701);
		
		return true;
	}
	
	/**
	 * 業務個別設立場検索画面クローズ処理
	 * @return 処理結果
	 */
	public boolean closeZMW12301()
	{
		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// サービスフォームBeanの内容の取得
		X31SDataBeanAccess bean = getServiceFormBean();
		
		// セッション情報取得
		HashMap<String, Object> parameterMap = JZMWebCommon.getScreenInfo(this);
		
		if(parameterMap.containsKey(ZMW00701SFConst.WKKBT_POSITION_CD))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.WKKBT_POSITION_CD, parameterMap.get(ZMW00701SFConst.WKKBT_POSITION_CD).toString());
		}
		if(parameterMap.containsKey(ZMW00701SFConst.WKKBT_POSITION_NM))
		{
			JZMWebCommon.setSendMessageString(bean, ZMW00701SFConst.WKKBT_POSITION_NM, parameterMap.get(ZMW00701SFConst.WKKBT_POSITION_NM).toString());
		}
		// 画面遷移
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00701);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst. SCREEN_NAME_ZMW00701);
		
		return true;
	}
	
	/**
	 * 登録確認ボタン処理を行います。
	 * <br>
	 * @return 処理結果
	 * @throws Exception 予期せぬエラー
	 */
	public boolean addCfm() throws Exception
	{
		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// サービスフォームBean
		X31SDataBeanAccess bean = getServiceFormBean();
		
		// 適用開始年月日
		String  aplyStaymd = JPCUtilCommon.concatYmd(bean.sendMessageString(ZMW00701SFConst.APLY_PRD_STA_YEAR, X31CWebConst.DATABEAN_GET_VALUE),
				bean.sendMessageString(ZMW00701SFConst.APLY_PRD_STA_MON, X31CWebConst.DATABEAN_GET_VALUE),
				bean.sendMessageString(ZMW00701SFConst.APLY_PRD_STA_DAY, X31CWebConst.DATABEAN_GET_VALUE));
		bean.sendMessageString(ZMW00701SFConst.APLY_PRD_STA, X31CWebConst.DATABEAN_SET_VALUE, JZMWebCommon.nullToBlank(aplyStaymd));
		
		// 適用終了年月日
		String  aplyEndymd = JPCUtilCommon.concatYmd(bean.sendMessageString(ZMW00701SFConst.APLY_PRD_END_YEAR, X31CWebConst.DATABEAN_GET_VALUE),
				bean.sendMessageString(ZMW00701SFConst.APLY_PRD_END_MON, X31CWebConst.DATABEAN_GET_VALUE),
				bean.sendMessageString(ZMW00701SFConst.APLY_PRD_END_DAY, X31CWebConst.DATABEAN_GET_VALUE));
		bean.sendMessageString(ZMW00701SFConst.APLY_PRD_END, X31CWebConst.DATABEAN_SET_VALUE, JZMWebCommon.nullToBlank(aplyEndymd));
		
		// ユースケースID格納用マップ
		HashMap<String, Object> paramMap = new HashMap<String, Object>();
		
		// マッピング用Map
		HashMap<String, Object> dataMap = new HashMap<String, Object>();
		
		// サービス実行結果データ用Map
		HashMap<String, Object> outputMap = new HashMap<String, Object>();
		
		
		// (3)サービス呼出処理
		// マッピングクラスを使用する為、配列化
		X31SDataBeanAccess[] paramBean = {bean};
		
		// ユースケースID格納
		paramMap.put(X31CWebConst.TELEGRAM_INFO_USECASE_ID, JZMWebConst.SV106);
		
		// マッピングクラス
		ZMSV0106_ZMSV0106OPDBMapper mapper = new ZMSV0106_ZMSV0106OPDBMapper();
		

		// マッピング処理（上り）
		// 権限グループ登録SC（チェック機能のみ）
		mapper.setZMSV010601CC(paramBean, dataMap, JPCModelConstant.FUNC_CD_2);

		// 組織・立場名取得と業務個別設定組織・業務個別設定名取得の選択
		// 権限適用組織種別コードを取得
		String authorityAplyOrgSbtCd = JZMWebCommon.getSendMessageString(bean, ZMW00701SFConst.AUTHORITY_APLY_ORG_SBT_CD);

		if(REAL_ORG_CD.equals(authorityAplyOrgSbtCd))
		{
			
			// 権限適用組織種別名が実組織の場合、
			// 入力された組織コード、立場コードから
			// 組織名、立場名を取得するための上りマッピング
			mapper.setZMSV010602SC(paramBean, dataMap, JPCModelConstant.FUNC_CD_1);
			mapper.setZMSV010603SC(paramBean, dataMap, JPCModelConstant.FUNC_CD_1);
		}
		else
		{
			
			// 権限適用組織種別名が実組織以外の場合、
			// 入力された業務個別設定組織コード、業務個別設定立場コードから
			// 業務個別設定組織名、業務個別設定立場名を取得するための上りマッピング
			mapper.setZMSV010604SC(paramBean, dataMap, JPCModelConstant.FUNC_CD_1);
			mapper.setZMSV010605SC(paramBean, dataMap, JPCModelConstant.FUNC_CD_1);
		}
		
		// 入力されたロールコードから
		// ロール名を取得するための上りマッピング
		mapper.setZMSV010606SC(paramBean, dataMap, JPCModelConstant.FUNC_CD_1);
		
		// サービス実行
		invokeService(paramMap, dataMap, outputMap);
		
		// 整合性エラーがある場合、エラーを返します。
		if(isErrAuthorityAplyOrgSbtNm(outputMap, JZMWebConst.CC10601))
		{
			JZMWebCommon.setNextScreenInfo(commonBean, JZMScreenConst.SCREEN_ID_ZMW00701, JZMScreenConst.SCREEN_NAME_ZMW00701);
			return true;
		}
		
		// 下りマッピング処理
		if(REAL_ORG_CD.equals(authorityAplyOrgSbtCd))
		{
			
			// 権限適用組織種別名が実組織の場合、
			// 入力された組織コード、立場コードから
			// 組織名、立場名を取得するための下りマッピング
			mapper.getZMSV010602SC(paramBean, outputMap);
			mapper.getZMSV010603SC(paramBean, outputMap);
		}
		else
		{
			
			// 権限適用組織種別名が実組織以外の場合、
			// 入力された業務個別設定組織コード、業務個別設定立場コードから
			// 業務個別設定組織名、業務個別設定立場名を取得するための下りマッピング
			mapper.getZMSV010604SC(paramBean, outputMap);
			mapper.getZMSV010605SC(paramBean, outputMap);
		}
		
		// 入力されたロールコードから
		// ロール名を取得するための下りマッピング
		mapper.getZMSV010606SC(paramBean, outputMap);
		
		// メッセージの設定
		JZMWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0370__I, MESSAGE_VALUE);
		JZMWebCommon.setMessageAreaBackColor(this, JZMWebConst.ONE);
		
		// 遷移先画面ID、名称の設定
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID,
				X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00702);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME,
				X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_NAME_ZMW00702);
		
		return true;
	}
	
	/**
	 * 戻るボタン処理を行います。
	 * <br>
	 * @return 処理結果
	 * @throws Exception 予期せぬエラー
	 */
	public boolean back() throws Exception
	{
		// 共有フォームBean
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// 画面遷移
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMWebCommon.getScreenId(this));
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMWebConst.BLANK);
		
		return true;
	}
	

	
	/**
	 * 確定ボタン処理を行います。
	 * <br>
	 * @return 処理結果
	 * @throws Exception 予期せぬエラー
	 */
	public boolean fix() throws Exception
	{
		// サービスフォームBeanの内容の取得
		X31SDataBeanAccess bean = getServiceFormBean();
		
		// 共通フォームBeanの内容を取得
		X31SDataBeanAccess commoninfoBean = getCommonInfoBean();
		
		// ユースケースID格納用マップ
		HashMap<String, Object> paramMap = new HashMap<String, Object>();
		
		// マッピング用Map
		HashMap<String, Object> dataMap = new HashMap<String, Object>();
		
		// サービス実行結果データ用Map
		HashMap<String, Object> outputMap = new HashMap<String, Object>();
		
		// マッピングクラスを使用する為、配列化
		X31SDataBeanAccess[] paramBean = 	{bean};
		
		// ユースケースID格納
		paramMap.put(X31CWebConst.TELEGRAM_INFO_USECASE_ID, JZMWebConst.SV106);
		
		// マッピングクラス
		ZMSV0106_ZMSV0106OPDBMapper mapper = new ZMSV0106_ZMSV0106OPDBMapper();
		
		// マッピング処理（上り）
		mapper.setZMSV010601CC(paramBean, dataMap, JPCModelConstant.FUNC_CD_1);
		
		// サービス実行
		invokeService(paramMap, dataMap, outputMap);
		
		// 整合性エラーがある場合、エラーを返します。
		if(isErrAuthorityAplyOrgSbtNm(outputMap, JZMWebConst.CC10601))
		{
			JZMWebCommon.setNextScreenInfo(commoninfoBean, JZMScreenConst.SCREEN_ID_ZMW00702, JZMScreenConst.SCREEN_NAME_ZMW00702);
			return true;
		}
		
		// メッセージの設定
		JZMWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0380__I, MESSAGE_VALUE);
		
		// 画面遷移
		commoninfoBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00703);
		commoninfoBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst. SCREEN_NAME_ZMW00703);
		
		return true;
	}

	
	/**
	 * 修正ボタン処理を行います。
	 * <br>
	 * @return 処理結果
	 * @throws Exception 予期せぬエラー
	 */
	public boolean shusei() throws Exception
	{
		// 共有フォームBean
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// 画面遷移
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW00701);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst. SCREEN_NAME_ZMW00701);
		
		return true;
	}

	
	/**
	 * 完了ボタン処理を行います。
	 * <br>
	 * @return 処理結果
	 * @throws Exception 予期せぬエラー
	 */
	public boolean fin() throws Exception
	{
		// 共有フォームBean
		X31SDataBeanAccess commonBean = getCommonInfoBean();
		
		// 画面遷移
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMWebCommon.getScreenId(this));
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMWebConst.BLANK);
		
		return true;
	}
	
	/**
	 * セッションから遷移先画面を取得し共通ビーンに設定します。
	 * @param commonBean 共通ビーン
	 * @param transfer setTransferPageId()を呼び出すかどうかを設定します。
	 */
	private void setBackScreenId(X31SDataBeanAccess commonBean, boolean transfer)
	{
		String screenId = JZMWebCommon.getScreenId(this);
		
		// 遷移先画面ID、名称の設定
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID,
				X31CWebConst.DATABEAN_SET_VALUE, screenId);
		commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME,
				X31CWebConst.DATABEAN_SET_VALUE, JZMWebConst.BLANK);
		
		if(transfer)
		{
			setTransferPageId(screenId + JZMWebConst.PJP);
		}
	}
	
	/**
	 * 権限グループ登録CCがエラーを返しているかを判定します。
	 * @param outputMap サービス出力マップ
	 * @param ccName CC名称
	 * @return 判定結果（エラーの場合true)
	 */
	@SuppressWarnings("unchecked")
	private boolean isErrAuthorityAplyOrgSbtNm(HashMap<String, Object> outputMap, String ccName)
	{
		if(outputMap.containsKey(ccName))
		{
			HashMap<String, Object> ccMap = (HashMap<String, Object>)outputMap.get(ccName);
			
			if(ccMap.containsKey(JZMWebConst.EZM0171A010CBSMSG1LIST))
			{
				ArrayList<?> msgList = (ArrayList<?>)ccMap.get(JZMWebConst.EZM0171A010CBSMSG1LIST);
				if(msgList.size() != 0)
				{

					HashMap tmpMap = (HashMap)msgList.get(0);
					if(tmpMap.containsKey(JZMWebConst.EZM0171_CD_DIV_NM))
					{
						String wkkbtOrgFlg = (String)ccMap.get(JZMWebConst.EZM0041_WKKBT_ORG_FLG);
						String messageArg = "";
						String htmlId = "";
						if(JZMWebConst.ZERO.equals(wkkbtOrgFlg))
						{
							messageArg = JZMWebConst.MSG_WKKBT_ORG_CD;
							htmlId = JZMWebConst.EZM0041_WKKBT_ORG_CD;
						}
						else
						{
							messageArg = JZMWebConst.MSG_WKKBT_POS_CD;
							htmlId = JZMWebConst.EZM0041_WKKBT_POSITION_CD;
						}
						
						String[] items = new String[]{messageArg, (String)tmpMap.get(JZMWebConst.EZM0171_CD_DIV_NM)};
						
						// 業務個別設定コードの整合性エラー
						JZMWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1280_KW, items, htmlId);
					}

					return true;
				}
			}
		}
		return false;
	}
}
