<%@ page import="java.util.List"%>
<%@ page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html;charset=euc-kr"%>
<%@ page import="com.eactive.eai.batch.osd.OutsideVO"%>
<%@ page import="com.eactive.eai.batch.osd.OutsideManager"%>
<%@ page import="com.eactive.eai.batch.osd.OutsideLinkVO"%>

<%
    
	OutsideManager manager  = OutsideManager.getInstance();

    List<OutsideVO> outside = new ArrayList<OutsideVO>();
    List<OutsideLinkVO> outsideLink = new ArrayList<OutsideLinkVO>();
    Object[] batchCodes = manager.getBatchCodeArray();

    String selectedName = request.getParameter("groupName");
    if (selectedName == null && batchCodes.length > 1) 
        selectedName = (String)batchCodes[0];
    
    OutsideVO outVO = null;
    OutsideLinkVO linkVO       = null;
      
    if (selectedName != null) {
    	outside = manager.getOutsideInfo(selectedName);       
    }
    
%>

<html>
    <head>
        <title>
            Outside Informations
        </title>
        <script>
        function doAction() {
        	
            document.frm.submit();
        }
        
        function doUpdate() {
            document.frm.flag.value="U";
            document.frm.submit();
        }
        
        function doRemove() {
            document.frm.flag.value="D";
            document.frm.submit();
        }

        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>Adpater Informations</b> <br><br>
        </p>

        <form name="frm" action="" method="POST">
        <table border='0' width="800" >
        <tr>
        <td align='left'>
        <table width="450" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' width='180' bgcolor="#ccccff">배치작업코드 :&nbsp;</td>
            <td align='left'>&nbsp;<select name="groupName" onchange="doAction();">
            <%
                for(int i=0;i < batchCodes.length; i++) {
            %>
                <option value="<%= batchCodes[i] %>" <%= ( ((String)batchCodes[i]).equals(selectedName)) ? "selected" : "" %>><%=  (String)batchCodes[i] %>
            <%           
                }
            %></select>
            </td>
        </tr>
        </table>
        </td>
        </tr>
        </table><br>
        
        <%
        	if (selectedName !=null && outside != null) {
        		for (int j=0; j <outside.size(); j++) {
        			outVO = outside.get(j);
        %>

        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 배치작업코드  : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="batchCode" size='60' value="<%=outVO.getBatchCode()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 배치작업명  : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="batchName" size='60' value="<%=outVO.getBatchName()%>"></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 대외기관코드  : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="osdCode" size='60' value="<%=outVO.getOsdCode()%>"></td>
        </tr>  
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 대외기관명  : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="osdType" size='60' value="<%=outVO.getOsdName()%>"></td>
        </tr>          
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 어댑터그룹명  : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="adpGroupName" size='60' value="<%=outVO.getAdpGroupName()%>"></td>
        </tr>                  
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 송신처리규칙   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="sendRuleCode" size='60' value="<%=outVO.getSendRuleCode()%>"></td>
        </tr>  
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 수신처리규칙   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="recvRuleCode" size='60' value="<%=outVO.getRecvRuleCode()%>"></td>
        </tr>   
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 대외송신유형   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="osdSendPrpt" size='60' value="<%=outVO.getOsdSendPrpt()%>"></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 대외수신유형   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="osdRecvPrpt" size='60' value="<%=outVO.getOsdRecvPrpt()%>"></td>
        </tr>  
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 블럭사이즈   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="blkSize" size='60' value="<%=outVO.getBlkSize()%>"></td>
        </tr> 
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 시퀀스사이즈   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="sequenceSize" size='60' value="<%=outVO.getSequenceSize()%>"></td>
        </tr> 
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 거래시작인덱스  : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="bizCdStartIdx" size='60' value="<%=outVO.getBizCdStartIdx()%>"></td>
        </tr> 
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 거래종료인덱스   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="bizCdEndIdx" size='60' value="<%=outVO.getBizCdEndIdx()%>"></td>
        </tr> 
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 패킷사이즈  : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="packetSize" size='60' value="<%=outVO.getPacketSize()%>"></td>
        </tr>       
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; OutsideVO.toString()   : &nbsp;</td>
            <td align='left'><%=outVO.toString()%></td>
        </tr>        
        </table><br>
        <%
 
        	outsideLink = manager.getOutsideLinkInfo(outVO.getOsdCode());
        	if ( outsideLink != null ){
	            for (int n=0; n <outsideLink.size(); n++) {
    	        	linkVO = outsideLink.get(n);
        	    	if ( linkVO.getBatchCode().equals(outVO.getBatchCode())){
        %>

        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td bgcolor="#003366">&nbsp;<font color="yellow">시스템연결구분</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">송수신구분코드</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">연결IP</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">연결 Port</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">연결ID</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">연결PW</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">타임아웃</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">회선연결상태코드</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">어댑터그룹이름</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">어댑터명</font></td>            
        </tr>

        <tr bgcolor='white'>
            <td align='left'>&nbsp;<input type="text" name="sysLinkCode" value="<%=linkVO.getSyslinkCode()%>" readonly></td>
            <td align='left'>&nbsp;<input type="text" name="reqResCode" value="<%=linkVO.getReqResCode()%> "></td>
            <td align='left'>&nbsp;<input type="text" name="linkIP" value="<%=linkVO.getLinkIP()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="linkPort" value="<%=linkVO.getLinkPort()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="userID" value="<%=linkVO.getUserID()%>" readonly></td>
            <td align='left'>&nbsp;<input type="text" name="pwd" value="<%=linkVO.getPwd()%> "></td>
            <td align='left'>&nbsp;<input type="text" name="toVal" value="<%=linkVO.getToVal()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="linkStatus" value="<%=linkVO.getLinkStatus()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="adpGroupName" value="<%=linkVO.getAdpGroupName()%>" readonly></td>
            <td align='left'>&nbsp;<input type="text" name="adpName" value="<%=linkVO.getAdpName()%> "></td>
        </tr>   
        
        <%
    	        		}
	        		}
            	}
       		}
       	}
        %>
        </table>
        </form>
    </body>
</html>