/*********************************************************************
*  All Rights reserved,Copyright (c) K-Opticom
**********************************************************************
*＜プログラム内容＞
*	システム名			：eo顧客基幹システム
*	モジュール名		：JBSbatKKKyoseiMadoFileExChk
*	ソースファイル名	：JBSbatKKKyoseiMadoFileExChk.java
*	作成者				：富士通　
*	作成日				：2011年09月15日
*＜機能概要＞
*　登録解除ファイル存在チェック部品です。
*＜修正履歴＞
*	バージョン	修正日		修正者		修正内容
*	v1.00.00	2011/09/15  FJ)古田		新規作成
*********************************************************************/
package eo.business.service;

import java.io.File;

import eo.business.common.JBSbatBusinessService;
import eo.framework.item.JBSbatCommonItem;
import eo.framework.item.JBSbatOutputItem;

/**
* (クラスの機能概要) <p>
*<BR>
* @author FJ)古田
*/
public class JBSbatKKKyoseiMadoFileExChk extends JBSbatBusinessService
{
	/**▼▼▼▼▼▼ツールから生成した宣言です 開始▼▼▼▼▼▼*/
	/**▲▲▲▲▲▲ツールから生成した宣言です 終了▲▲▲▲▲▲*/
	
	/**
	 * ワーニングの件数カウンタ
	 */
	private int warning_cnt = 0;

	/**
	 * 初期処理
	 * @param JBSbatCommonItem commonItem　バッチ共通パラメータ電文
	 * @throws Exception
	 */
	public void initial(JBSbatCommonItem commonItem) throws Exception
	{
	/**▼▼▼▼▼▼業務サービスの初期処理を記述してください。▼▼▼▼▼▼*/
		/**▼▼▼▼▼▼ツールから生成した初期化のソースです 開始▼▼▼▼▼▼*/
		// 共通パラメータを設定します
		super.setCommonInfo(commonItem);
		/**▲▲▲▲▲▲ツールから生成した初期化のソースです 終了▲▲▲▲▲▲*/
	/**▲▲▲▲▲▲業務サービスの初期処理を記述してください。▲▲▲▲▲▲*/
	}

	/**
	 * 主処理
	 * @return JBSbatOutputItem　出力情報
	 * @throws Exception
	 */
	public JBSbatOutputItem execute() throws Exception
	{
		super.logPrint.printDebugLog("execute_START");

		// FREEよりファイルパスを取得します。
		String free = super.commonItem.getFreeItem();

		// [0]:強制窓口登録依頼情報ファイルパス [1]:強制窓口解除依頼情報ファイルパス
		String[] filePath = free.split(";");

		super.logPrint.printDebugLog("強制窓口登録依頼情報ファイルパス[" + filePath[0] + "]");
		super.logPrint.printDebugLog("強制窓口解除依頼情報ファイルパス[" + filePath[1] + "]");

		// 強制窓口登録依頼情報ファイル
		File creFile = new File(filePath[0]);

		// 強制窓口解除依頼情報ファイル
		File rlsFile = new File(filePath[1]);

		// 強制窓口登録依頼ファイルの存在チェック
		if(!creFile.exists())
		{
			// 業務エラーログ出力
			super.logPrint.printBusinessErrorLog("EKKB0010CW", new String[] { "強制窓口登録依頼ファイル未存在" });

			// ワーニング件数カウントをアップ
			warning_cnt++;

			// 空ファイルを作成します。
			creFile.createNewFile();
		}

		// 強制窓口解除依頼ファイルの存在チェック
		if(!rlsFile.exists())
		{
			// 業務エラーログ出力
			super.logPrint.printBusinessErrorLog("EKKB0010CW", new String[] { "強制窓口解除依頼ファイル未存在" });
			// ワーニング件数カウントをアップ
			warning_cnt++;

			// 空ファイルを作成します。
			rlsFile.createNewFile();
		}

		if(0 < warning_cnt)
		{
			super.commonItem.setErrorCount(warning_cnt);
		}

		super.logPrint.printDebugLog("execute_END");

		return null;
	}

	/**
	 * 業務サービス終了処理
	 * @throws Exception
	 */
	public void terminal() throws Exception
	{
	/**▼▼▼▼▼▼業務サービスの終了処理を記述してください。▼▼▼▼▼▼*/
		/**▼▼▼▼▼▼ツールから生成した終了処理のソースです 開始▼▼▼▼▼▼*/
		/**▲▲▲▲▲▲ツールから生成した終了処理のソースです 終了▲▲▲▲▲▲*/
	/**▲▲▲▲▲▲業務サービスの終了処理を記述してください。▲▲▲▲▲▲*/
	}

	/**▼▼▼▼▼▼ツールから生成したメソッドです 開始▼▼▼▼▼▼*/
	/**▲▲▲▲▲▲ツールから生成したメソッドです 終了▲▲▲▲▲▲*/
}
