<%@ page contentType="text/html; charset=euc-kr"%>

<jsp:directive.page import="java.io.File" />
<jsp:directive.page import="java.io.FileInputStream" />
<jsp:directive.page import="java.util.*"/>
<jsp:directive.page import="org.kldp.ebmsh.moniter.failHandler.EngineFailMessageInfo"/>
<jsp:directive.page import="org.kldp.ebmsh.config.EbmsConstants"/>
<jsp:directive.page import="org.kldp.util.io.FileIoUtil"/>
<jsp:directive.page import="org.kldp.ebmsh.moniter.failHandler.*"/>

<jsp:directive.page import="org.kldp.ebmsh.moniter.permission.PermissionManager"/>
<jsp:directive.page import="org.kldp.ebmsh.config.EbmsConstants"/>

<%@ include file="/authorize/loginCheck.jsp" %>

<%@ include file="/setup/setupCheck.jsp" %>

<%
	// 실패 메시지 정보를 세션에 저장합니다.
	List<BiFailMessageInfo> failMessageInfoList = (List<BiFailMessageInfo>)session.getAttribute("biFailMessageInfoList");
	
	String failMessageDirectory = EbmsConstants.messagePath + FileIoUtil.fileSeparatorAddOrNone("fail");
	
	// 메시지 처리 결과를 저장할 객체
	List<BiFailMessageProcessResult> failMessageProcessResultList = new ArrayList<BiFailMessageProcessResult>();
	
	for(int i = 0; i < failMessageInfoList.size(); i++) {
		FailMessageManager manager = new FailMessageManager();
	
		BiFailMessageInfo failMessageInfo = failMessageInfoList.get(i);
	
		BiFailMessageProcessResult failMessageProcessResult = manager.reProcessBiFailMessage(failMessageInfo.getMessageId(), failMessageInfo.getMessagePath());
		
		// 객체 저장
		failMessageProcessResultList.add(failMessageProcessResult);
	}
		
	// 세션에서 fail message 정보 삭제
	session.removeAttribute("biFailMessageInfoList");
	
	// 세션에 fail message process result 정보 저장
	session.setAttribute("biFailMessageProcessResultList", failMessageProcessResultList);
	
	response.sendRedirect("biFailHandlerResult.jsp");
%>
