<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="com.eactive.eai.common.EAITable"%>
<%@ page import="com.eactive.eai.common.message.EAIMessage"%>
<%@ page import="com.eactive.eai.common.message.ServiceMessage"%>
<%@ page import="com.eactive.eai.common.message.EAIMessageManager"%>

<%
    EAIMessageManager   manager   = EAIMessageManager.getInstance();
    String[]            alls      = manager.getAllEAISvcCd();
    String              action    = request.getParameter("actionType");

    String selectedKey = request.getParameter("selectedKey");
    
    if(selectedKey == null && alls.length>=1) {
    	selectedKey = alls[0];
    }
    if ("reload".equals(action)){
    	manager.reload(selectedKey);
    }else if ("reloadAll".equals(action)){
    	manager.reload();
    }else {
    	;
    }
    
    EAIMessage vo = null;
    
    if(selectedKey!=null) {
    	vo = manager.getEAIMessage(selectedKey);        
    }
    

%>

<html>
    <head>
        <title>
            EAIMessage Manager
        </title>
        <script>
        function doAction() {
            document.frm.submit();
        }
        function managerReload(){ 
        	document.frm.actionType.value="reload";
        	document.frm.submit();
        	
        }
        function managerReloadAll(){
        	document.frm.actionType.value="reloadAll";
        	document.frm.submit();
        }        
        
        function openSvcMsgs(id){
            var url = 'svcmessages.jsp?id='+id;
            msgWindow=window.open(url);
        }
        function doSearch(){
        	var searchValue = document.frm.searchTxt.value;
        	document.frm.selectedKey.value = searchValue;
        	document.frm.submit();
        }        
        function enterEvent(){
        	if(window.event.keyCode==13){
        		doSearch();
        	}
        }
        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>EAI 서비스 코드관리</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='350' bgcolor="#ccccff">EAI서비스코드 </td>
            <td align='left'>&nbsp;<select name="selectedKey" onchange="doAction();"style="width:98%">
            <%
                for(int i=0;i<alls.length;i++) {
            %>
                <option value="<%=alls[i]%>" <%= (alls[i].equals(selectedKey)) ? "selected" : "" %>><%=alls[i]%>
            <%           
                }
            %></select>
            </td>
            <td width='50'><input type="button" name="reload" value="reload" onClick="managerReload()" /></td>
            <td width='70'><input type="button" name="reloadAll" value="reloadAll" onClick="managerReloadAll()" /></td>
            
        </tr>
        <tr bgcolor='white'>
            <td align='left' >&nbsp;<input type="edit"   name="searchTxt" onkeydown="enterEvent()" value="<%=selectedKey%>" style="width:98%" /></td> 
            <td colspan="2" align="center" ><input type="button" name="search" value="search" onClick="doSearch()" /></td>
        </tr>         
        </table><br>
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' colspan=2  bgcolor="#003366">&nbsp; <font color="yellow"><b>내용</b> &nbsp;</font></td>
        </tr>
<%
    if(vo != null) {
%>  
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; EAI서비스코드 : &nbsp;</td>                                                                     
            <td align='left'>&nbsp;<input type="text" name="eAISvcCd" style="width:98%" value="<%=vo.getEAISvcCd()%>" readonly></td>                                  
        </tr>

        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; EAI서버인스턴스명 : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="eAISvrInstNm" style="width:98%" value="<%=vo.getEAISvrInstNm()%>" readonly></td>                                  
        </tr> 
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서비스시간유무 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="svcTmEn" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int svcTmEnLength = EAITable.SVC_TIME_EXIST.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<svcTmEnLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.SVC_TIME_EXIST[i]%>" <%= (EAITable.SVC_TIME_EXIST[i].equals(vo.getSvcTmEn())) ? "selected" : "" %>><%=EAITable.SVC_TIME_EXIST[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr>
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서비스동시사용 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="svcTsmtUsgTp" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int svcTsmtUsgTpLength = EAITable.SVC_SAME_TIME_TYPE.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<svcTsmtUsgTpLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.SVC_SAME_TIME_TYPE[i]%>" <%= (EAITable.SVC_SAME_TIME_TYPE[i].equals(vo.getSvcTsmtUsgTp())) ? "selected" : "" %>><%=EAITable.SVC_SAME_TIME_TYPE[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr> 
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서비스처리유형 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="svcPssTp" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int svcPssTpLength = EAITable.SVC_PROCESS_TYPE.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<svcPssTpLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.SVC_PROCESS_TYPE[i]%>" <%= (EAITable.SVC_PROCESS_TYPE[i].equals(vo.getSvcPssTp())) ? "selected" : "" %>><%=EAITable.SVC_PROCESS_TYPE[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr>
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; Flow Control라우팅명  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="flwCntlRtnNm" style="width:98%" value="<%=vo.getFlwCntlRtnNm()%>" ></td>                                  
        </tr>
                                                                                                                                                 
                                                                                                                                                                 
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 통합유형 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="unifTp" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int unifTpLength = EAITable.UNIT_TYPE.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<unifTpLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.UNIT_TYPE[i]%>" <%= (EAITable.UNIT_TYPE[i].equals(vo.getUnifTp())) ? "selected" : "" %>><%=EAITable.UNIT_TYPE[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr>
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 기동서비스구분 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="sngSvcCls" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int sngSvcClsLength = EAITable.START_SVC_CLASSIFICATION.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<sngSvcClsLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.START_SVC_CLASSIFICATION[i]%>" <%= (EAITable.START_SVC_CLASSIFICATION[i].equals(vo.getSngSvcCls())) ? "selected" : "" %>><%=EAITable.START_SVC_CLASSIFICATION[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr> 
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서비스처리순서  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="svcPssSeq" style="width:98%" value="<%=vo.getSvcPssSeq()%>" ></td>                                  
        </tr>
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 로그처리일련번호  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="logPssSno" style="width:98%" value="<%=vo.getLogPssSno()%>" ></td>                                  
        </tr>
                                                                                                                                                 
                                                                                                                                                                 
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서비스전열로그여부 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="svcWlColLogYn" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int svcWlColLogYnLength = EAITable.SVC_WHOLE_COL_LOG.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<svcWlColLogYnLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.SVC_WHOLE_COL_LOG[i]%>" <%= (EAITable.SVC_WHOLE_COL_LOG[i].equals(vo.getSvcWlColLogYn())) ? "selected" : "" %>><%=EAITable.SVC_WHOLE_COL_LOG[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr> 
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 업무구분  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="bwkCls" style="width:98%" value="<%=vo.getBwkCls()%>" ></td>                                  
        </tr>
                                                                                                                                                 
                                                                                                                                                                 
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 표준메시지사용구분 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="stdMsgUsgCls" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int stdMsgUsgClsLength = EAITable.STANDARD_MSG_USAGE.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<stdMsgUsgClsLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.STANDARD_MSG_USAGE[i]%>" <%= (EAITable.STANDARD_MSG_USAGE[i].equals(vo.getStdMsgUsgCls())) ? "selected" : "" %>><%=EAITable.STANDARD_MSG_USAGE[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr> 

        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 기동시스템인터페이스유형  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="sngSysItfTp" style="width:98%" value="<%=vo.getSngSysItfTp()%>" ></td>                                  
        </tr>
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 레이어메시지ID  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="lydMsgID" style="width:98%" value="<%=vo.getLydMsgID()%>" ></td>                                  
        </tr>
                                                                                                                                                 
                                                                                                                                                                 
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서버로그레벨 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="svrLogLvl" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int svrLogLvlLength = EAITable.SERVER_LOG_LEVEL.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<svrLogLvlLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.SERVER_LOG_LEVEL[i]%>" <%= (EAITable.SERVER_LOG_LEVEL[i]==vo.getSvrLogLvl()) ? "selected" : "" %>><%=EAITable.SERVER_LOG_LEVEL_TYPE[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr>
        
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서비스로그레벨 : &nbsp;</td>                                                                           
            <td align='left' style="height:40px;">
            &nbsp;<select name="svcLogLvl" style="width:98%">                                                                                                                                
            <%                                                                                                                                                   
                int svcLogLvlLength = EAITable.SVC_LOG_LEVEL.length;                                                                                                   
                                                                                                                                                                 
                for(int i=0; i<svcLogLvlLength; i++) {                                                                                                             
            %>                                                                                                                                                   
            <option value="<%=EAITable.SVC_LOG_LEVEL[i]%>" <%= (EAITable.SVC_LOG_LEVEL[i]==vo.getSvcLogLvl()) ? "selected" : "" %>><%=EAITable.SVC_LOG_LEVEL[i]%>
            <%                                                                                                                                                   
                }                                                                                                                                                
            %>                                                                                                                                                   
            </select>                                                                                                                                            
            </td>                                                                                                                                                
        </tr>
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 오류EAI서비스명  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="errEAISvcName" style="width:98%" value="<%=vo.getErrEAISvcName()%>" ></td>                                  
        </tr>
         <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 오류요청변환ID명  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="dmndErrChngIDName" style="width:98%" value="<%=vo.getDmndErrChngIDName()%>" ></td>                                  
        </tr>
         <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 오류요청에러필드명  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="dmndErrFldName" style="width:98%" value="<%=vo.getDmndErrFldName()%>" ></td>                                  
        </tr>
         <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 오류응답변환ID명  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="rspnsErrChngIDName" style="width:98%" value="<%=vo.getRspnsErrChngIDName()%>" ></td>                                  
        </tr>
         <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 오류응답에러필드명  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="rspnsErrFldName" style="width:98%" value="<%=vo.getRspnsErrFldName()%>" ></td>                                  
        </tr>
         <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; EAI서비스 설명  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="eAISvcDesc" style="width:98%" value="<%=vo.getEAISvcDesc()%>" ></td>                                  
        </tr>
         <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; EAI서버구분코드  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="sevrDstcd" style="width:98%" value="<%=vo.getSevrDstcd()%>" ></td>                                  
        </tr>
         <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 그룹사코드  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="groupCoCd" style="width:98%" value="<%=vo.getGroupCoCd()%>" ></td>                                  
        </tr>
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 거래처리구분  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="tranType" style="width:98%" value="<%=vo.getTranType()%>" ></td>                                  
        </tr> 
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 사용여부  : &nbsp;</td>                                                                     
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="useYn" style="width:98%" value="<%=vo.getUseYn()%>" ></td>                                  
        </tr> 
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서비스처리정보리스트 : &nbsp;</td>                                                                              
        
<%
		if(vo.getSvcMsgs().size()<=0) {			
%> 
			<td align='left' style="height:40px;">&nbsp; 0건 입니다. &nbsp; </td>                         
<%
		}
		else {
%>
            <td align='left' >&nbsp;<a href="javascript:openSvcMsgs('<%= vo.getEAISvcCd() %>');"><%=vo.getSvcMsgs().size()%>&nbsp; 건 &nbsp;</a> </td>                         
<%
		}
%>       
        </tr>
          

 <% 
        } 
%>    
        </table>
        </form>
    </body>
</html>