<%@ page language="java" contentType="text/html;charset=euc-kr"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="com.eactive.eai.adapter.AdapterGroupVO"%>
<%@ page import="com.eactive.eai.adapter.AdapterManager"%>
<%@ page import="com.eactive.eai.adapter.AdapterVO"%>

<%
    
    AdapterManager manager  = AdapterManager.getInstance();

    List<String> grpList = manager.getAllAdapterGroupNames();

    String selectedName = request.getParameter("groupName");
    if (selectedName == null && grpList.size() > 1) 
        selectedName = grpList.get(0);
    
    AdapterGroupVO grpVO = null;
    AdapterVO aVO       = null;
      
    if (selectedName != null) {
        grpVO = manager.getAdapterGroupVO(selectedName);       
    }
    
%>

<html>
    <head>
        <title>
            Adpater 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="">
        <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">Adapter Group : &nbsp;</td>
            <td align='left'>&nbsp;<select name="groupName" onchange="doAction();">
            <%
                for(int i=0;i < grpList.size(); i++) {
            %>
                <option value="<%= grpList.get(i) %>" <%= (grpList.get(i).equals(selectedName)) ? "selected" : "" %>><%= grpList.get(i) %>
            <%           
                }
            %></select>
            </td>
        </tr>
        </table>
        </td>
        </tr>
        </table><br>
        
        <%
            if (selectedName != null) {
        %>
        <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="type" size='60' value="<%=grpVO.getType()%>"></td>
        </tr>  
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 어댑터사용여부  : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="gubun" size='60' value="<%=grpVO.isUsedFlag()%>"></td>
        </tr>                  
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; BATCH작업업무구분코드   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="standard" size='60' value="<%=grpVO.getBatchProcessCode()%>"></td>
        </tr>  
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; BATCH기관구분코드   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="standard" size='60' value="<%=grpVO.getBatchInstitutionCode()%>"></td>
        </tr>   
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 어댑터그룹 설명   : &nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="standard" size='60' value="<%=grpVO.getDescription()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; AdapterGroupVO.toString()   : &nbsp;</td>
            <td align='left'><%=grpVO.toString()%></td>
        </tr>        
        </table><br>
        <%
            }
        %>
        
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <%--<td bgcolor="#003366">&nbsp;<font color="yellow"><b>어뎁터업무그룹명s</b></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">BATCH시스템연결코드</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH작업구분코드</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH작업구분명</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH대외기관코드</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH대외기관명</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH서버IP</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH서버포트</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH메세지타임아웃</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH수신처리규칙코드</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH아이디</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH패스워드</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH패킷크기</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">BATCH요구송수신타입</font></td>              
        </tr>
        <%
            if (selectedName != null) {
                Iterator<AdapterVO> adtIt = grpVO.getAdapters();
                while(adtIt.hasNext()) {
                    AdapterVO adtVO = adtIt.next();
        %>

        <tr bgcolor='white'>
            <td align='left'>&nbsp;<input type="text" name="adptBwkNm" value="<%=adtVO.getName()%>" readonly></td>
            <td align='left'>&nbsp;<input type="text" name="description" value="<%=adtVO.getDescription()%> "></td>
            <td align='left'>&nbsp;<input type="text" name="propGroupName" value="<%=adtVO.getPropGroupName()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="batchSystemConnCode" value="<%=adtVO.getBatchSystemConnCode()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="batchProcessCode" value="<%=adtVO.getBatchProcessCode()%>" readonly></td>
            <td align='left'>&nbsp;<input type="text" name="batchProcessName" value="<%=adtVO.getBatchProcessName()%> "></td>
            <td align='left'>&nbsp;<input type="text" name="batchInstitutionCode" value="<%=adtVO.getBatchInstitutionCode()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="batchInstitutionName" value="<%=adtVO.getBatchInstitutionName()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="batchServerIP" value="<%=adtVO.getBatchServerIP()%> "></td>
            <td align='left'>&nbsp;<input type="text" name="batchServerPortNo" value="<%=adtVO.getBatchServerPortNo()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="batchInterMsgTimeout" value="<%=adtVO.getBatchInterMsgTimeout()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="batchRcvFlowRuleCode" value="<%=adtVO.getBatchRcvFlowRuleCode()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="lnkID" value="<%=adtVO.getLnkID()%>" readonly></td>
            <td align='left'>&nbsp;<input type="text" name="lnkPwd" value="<%=adtVO.getLnkPwd()%> "></td>
            <td align='left'>&nbsp;<input type="text" name="batchPacketSize" value="<%=adtVO.getPacketSize()%>"></td>
            <td align='left'>&nbsp;<input type="text" name="rqstRspnsDstcd" value="<%=adtVO.getRqstRspnsDstcd()%>"></td>
        </tr>        
        <%
                }
            }
        %>
        </table>
        </form>
    </body>
</html>