<%@ page contentType="text/html; charset=euc-kr" %>
<jsp:directive.page import="java.util.*"/>
<jsp:directive.page import="org.kldp.ebmsh.moniter.failHandler.FailMessageManager"/>
<jsp:directive.page import="org.kldp.ebmsh.moniter.failHandler.BiFailMessageInfo"/>

<%
	// 실패 메시지 정보가 세션에 남아 있는 경우 삭제한다.
	session.removeAttribute("biFailMessageInfoList");
	
	FailMessageManager failMessageManager = new FailMessageManager();
		
	List<BiFailMessageInfo> biFailMessageInfoList = failMessageManager.getBusinessLogicFailMessage();
	
	// 실패 메시지 정보를 세션에 저장합니다.
	session.setAttribute("biFailMessageInfoList", biFailMessageInfoList);
%>

<table width="100%" border="0" cellpadding="0" cellspacing="1"
	bgcolor="#CDDCED">
	<tr>
		<td
			style="PADDING-LEFT: 10px; PADDING-RIGHT: 20px; PADDING-TOP: 5px; PADDING-BOTTOM: 5px;"
			bgcolor="#FFFFFF">
			<table width="100%" border="0" align="center" cellpadding="0"
				cellspacing="0">
				<tr>
					<td width="15">
						<img src="<%=request.getContextPath()%>/image/search/icon_arrow.gif" width="11" height="11">
					</td>
					<td>
						<span class="style2">Business logic 에러 메시지</span>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>

<br>
<table width="100%" height="39" border="0" cellpadding="0"
	cellspacing="0">
	<tr>
		<td background="sub/search_bg.gif"
			style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px;">
			총 
			<span class="style1"> <%=biFailMessageInfoList.size()%> </span>건의 에러 메시지가 존재 합니다.
		</td>
	</tr>
</table>

<br>
<table width="100%" border="0" align="center" cellpadding="0"
	cellspacing="0">
	<tbody>
		<tr>
			<td width="60%" height="30" align="center"
				background="<%=request.getContextPath()%>/image/search/td_bg.gif">
				메시지 아이디
			</td>
			<td width="40%" align="center"
				background="<%=request.getContextPath()%>/image/search/td_bg.gif">
				상태
			</td>
		</tr>

		<%
			if ( biFailMessageInfoList.isEmpty() ) {
		%>
			<tr>
				<td colspan="5" style="text-align:center">
					실패 메시지가 없습니다.
				</td>
			</tr>
	
			<tr>
				<td colspan="5" align="center" bgcolor="#f0f0f0"></td>
			</tr>
		<%
			} 
			else {
				for(int i = 0; i < biFailMessageInfoList.size(); i++) {
					BiFailMessageInfo faultMessageInfo = biFailMessageInfoList.get(i);
		%>
					<tr>
						<td width="60%" height="20" align="center">
							<%= faultMessageInfo.getMessageId()  %>
						</td>
						
						<td width="40%" align="center">
							<%= faultMessageInfo.getStatus() %>
						</td>
					</tr>
			
					<tr>
						<td colspan="5" align="center" bgcolor="#f0f0f0"></td>
					</tr>
		<%
				}
			}
		%>
	</tbody>
</table>

<table width="100%" height="45" border="0" cellpadding="0"
	cellspacing="1">
	<tr align="center">
		<td>
			<form action="biFailHandlerProcess.jsp" style="margin:0px;padding:0px;"
				name="failHandlerForm">
				<span align="right" style="vertical-align:middle; margin-left:10px">
					<input type="submit" value="재처리 요청"> </span>
			</form>
		</td>
	</tr>
</table>
