<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ 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           alls     = manager.getAllAdapterGroupNames();
    String         action   = request.getParameter("actionType");

    String selectedKey = request.getParameter("selectedKey");
    if (selectedKey == null && alls.size() > 1) {
        selectedKey = (String)alls.get(0);
    }
    
    AdapterGroupVO vo = null;
      
    if (selectedKey != null) {
        vo = manager.getAdapterGroupVO(selectedKey);
     }
    
%>

<html>
    <head>
        <title>
            Adpater Informations
        </title>
        <script>
        function doAction() {
            document.frm.submit();
        }
        function doSearch(){
        	var searchValue = document.frm.searchTxt.value;
        	document.frm.selectedKey.value = searchValue;
        	document.frm.submit();
        }
        function detail(grpName,adpName){
        	console.log(grpName);
            var url = 'adapter.jsp?groupName='+grpName+'&adpName='+adpName;
            msgWindow=window.open(encodeURI(url));
        }
        function enterEvent(){
        	if(window.event.keyCode==13){
        		doSearch();
        	}
        }
        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>어댑터 그룹정보</b> <br><br>
        </p>

        <form name="frm" action="">
        <input type="hidden" name="actionType" value="">
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td rowspan="2" align='right' width='220' bgcolor="#ccccff">어댑터그룹명 :&nbsp;&nbsp;</td>
            <td align='left' >&nbsp;<select name="selectedKey" onchange="doAction();" style="width:98%">
            <%
                for(int i=0;i < alls.size(); i++) {
            %>
                <option value="<%= alls.get(i) %>" <%= (alls.get(i).equals(selectedKey)) ? "selected" : "" %>><%= alls.get(i) %>
            <%           
                }
            %></select>
            </td>
            <td rowspan="2" ><input type="button" name="search" value="search" onClick="doSearch()" /></td>
        </tr>
        <tr bgcolor='white'>
            <td align='left' >&nbsp;<input type="edit" style="width:98%;" name="searchTxt" onkeydown="enterEvent()" value="<%=selectedKey%>"  /></td> 
        </tr>
        </table><br>
        </form>
<%
    if (vo != null) {
%>
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
         <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 어댑터 그룹명  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="name" style="width:98%" value="<%=vo.getName()%>"></td>
        </tr>    
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 업무구분코드  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="eaiBizCode" style="width:98%" value="<%=vo.getEaiBizCode()%>"></td>
        </tr>  
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 표준/비표준   : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="standard" style="width:98%" value="<%=vo.getAdptrMsgPtrnCd()%>"></td>
        </tr>       
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 어댑터 사용구분  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="refClass" style="width:98%" value="<%=vo.isUsedFlag()%>"></td>
        </tr> 
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 송수신 로그여부   : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="srLogFlag" style="width:98%" value="<%=vo.isSrLogFlag()%>"></td>
        </tr>       
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; IN/OUT 구분  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="gubun" style="width:98%" value="<%=vo.getGubun()%>"></td>
        </tr>  
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 어뎁터 유형  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="type" style="width:98%" value="<%=vo.getType()%>"></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 메시지타입  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="msgType" style="width:98%" value="<%=vo.getMessageType()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 참조 클래스명  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="refClass" style="width:98%" value="<%=vo.getRefClass()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; KESA F/W 사용여부  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="kefsUseYn" style="width:98%" value="<%=vo.getKesaUseYn()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 특정 LU 사용여부 : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="luUseYn" style="width:98%" value="<%=vo.isSpcfcLUUseYn()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 대외기관코드<br>(표준전문셋팅)  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="osidinstiNo" style="width:98%" value="<%=vo.getOsidInstiNo()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 어댑터 기관코드<br>(대외기관명) : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="adptInstiCd" style="width:98%" value="<%=vo.getAdptrInstiCode()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 업체코드 데이터<br>(업무데이터 추출 룰)  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="companyData" style="width:98%" value="<%=vo.getCompanyCodeData()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; TAS 어댑터 여부  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="tasAdptYn" style="width:98%" value="<%=vo.getTestMasterYn()%>"></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; 어댑터 별명  : &nbsp;</td>
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="nickName" style="width:98%" value="<%=vo.getAdptrNickName()%>"></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='220' bgcolor="#ccccff">&nbsp; AdapterGroupVO.toString()   : &nbsp;</td>
            <td align='left'><%=vo.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>어뎁터업무 이름</b></font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow"><b>리스너클래스명</b></font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow"><b>프라퍼티 그룹명</b></font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow"><b>테스터클래스명</b></font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow"><b>어댑터 정보</b></font></td>
        </tr>
        <%
            if (vo != null) {
                Iterator adtIt = vo.getAdapters();
                while(adtIt.hasNext()) {
                    AdapterVO adtVO = (AdapterVO)adtIt.next();
        %>

        <tr bgcolor='white'>
            <td align='left'><input type="text" name="adptBwkNm" value="<%=adtVO.getName()%>" readonly></td>
            <td align='left'><input type="text" name="listenerClass" value="<%=adtVO.getListenerClass()%>"></td>
            <td align='left'><input type="text" name="propGroupName" value="<%=adtVO.getPropGroupName()%>"></td>
            <td align='left'><input type="text" name="testCallClass" value="<%=adtVO.getTestCallClass()%>"></td>
            <td align='left'><input type="button" name="detail" value="detail" onClick="detail('<%=vo.getName()%>','<%=adtVO.getName()%>')" /></td>
        </tr>        
        
<%
               }
           }
%>
<%
    }
%>
        
        </table>

    </body>
</html>