<%--
<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="com.eactive.eai.transformer.layout.Layout"%>
<%@ page import="com.eactive.eai.transformer.transform.Transform"%>
<%@ page import="com.eactive.eai.transformer.transform.TransformItem"%>
<%@ page import="com.eactive.eai.transformer.transform.TransformManager"%>
<%@ page import="com.eactive.eai.transformer.util.TransformKeys"%>
<%@ page import="java.util.HashMap"%>

<%!
	/**
	* <pre>
	* 문자열을 받아서 널이면 제로스트링을, 아니면 트림된 문자열을 리턴.
	* </pre>
	* @param	String		변환 대상
	* @return	'String'
	*/
	public static String checkNull( String str ) {

		String sResult = new String();
		if ( str == null ) {
			sResult = "";
		}
		else {
			sResult = str.trim();
		}
		return sResult;
	}

%>

<%
    TransformManager manager = TransformManager.getManager();
    String key[] = manager.getAllTransformName();
    
    String selected = request.getParameter("transformName");
    if(selected == null && key.length>=1) {
        selected  = key[0];
    }
   
    Transform transform = null;
    ArrayList itemList = new ArrayList();
    Layout target = null;
    Iterator it = null;
    
    if(selected!=null) {
        transform = manager.getTransform(selected);
        target = transform.getTargetLayout();
        itemList = (ArrayList) transform.getTransformItemList();
        it = transform.getSourceLayoutNames();
    }
    int sourceCount = transform.getSourceLayoutCount();
    String sourceName = "";
    for (int i=0; i < sourceCount; i++) {
        if ("".equals(sourceName))
            sourceName = (String)it.next();
        else
            sourceName = sourceName+" , " + (String)it.next();
    }
    
%>
<html>
    <head>
        <title>
            Transform 변환규칙 Manager
        </title>
         <script>
        function doAction() {
            document.frm.submit();
        }
        
        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>Transform 변환규칙 Configuration</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"><label value="변환명 : "/>&nbsp;</td>
            <td align='left'>&nbsp;<select name="transformName" onchange="doAction();">
            <%
                for(int i=0;i<key.length;i++) {
            %>
                <option value="<%=key[i]%>" <%= (key[i].equals(selected)) ? "selected" : "" %>><%=key[i]%>
            <%           
                }
            %></select>
            </td>
        </tr>
        </table>
        </td>

        </tr>
        </table><br>
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' colspan='2' width='250' bgcolor="#003366">&nbsp; <font color="yellow"><b>변환규칙정보</b> &nbsp;</font></td>
            
        </tr>

<%
    if(transform != null ){
        
%>

        <tr bgcolor='white'>
            <td align='right' width='250' bgcolor="#ccccff">&nbsp; 변환규칙명 : &nbsp;</td>
            <td align='left'>&nbsp;<%=transform.getName()%></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='250' bgcolor="#ccccff">&nbsp; 변환규칙설명 : &nbsp;</td>
            <td align='left'>&nbsp;<%=checkNull(transform.getDescription())%></td>
        </tr>
        
<%
} else {
%>    
        <tr bgcolor='white'>
            <td align='center' colspan="2" >&nbsp; 요청하신 변환규칙 정보가 없습니다. &nbsp;</td>
        </tr>

<%
}
%>
        </table>
        
        <br>
            <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' colspan='2' width='250' bgcolor="#003366">&nbsp; <font color="yellow"><b>변환소스결과레이아웃 정보</b> &nbsp;</font></td>            
        </tr>
<%
if (target != null || it.hasNext()) {

%>

        <tr bgcolor='white'>
            <td align='center' width='' bgcolor="#ccccff">&nbsp; 소스레이아웃(2개이상일경우 콤마(,)로 구분) &nbsp;</td>
            <td align='center' width='' bgcolor="#ccccff">&nbsp; 결과 레이아웃 &nbsp;</td>
        </tr>
        <tr bgcolor='white'>
            <td align='center'>&nbsp;<%=sourceName%></td>
            <td align='center'>&nbsp;<%=target.getName()%></td>
        </tr>
<%
   
} else {
%>    
        <tr bgcolor='white'>
            <td align='center' colspan="2" >&nbsp; 요청하신 변환소스결과레이아웃 정보가 없습니다. &nbsp;</td>
        </tr>

<%
}
%>

        </table>      
        
    <br>
            <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' colspan='2' width='250' bgcolor="#003366">&nbsp; <font color="yellow"><b>변환아이템 정보</b> &nbsp;</font></td>            
        </tr>
<%
if (itemList != null && itemList.size() > 0) {
    int nCount = 0;
    String[] aBgColor = {"#ccccff" , "#e9e1fd"};
    for (int i = 0; i < itemList.size(); i++) {
        TransformItem item = (TransformItem) itemList.get(i);
%>

         <tr bgcolor='white'>
            <td align='right' width='250' bgcolor="<%= aBgColor[nCount%2] %>">&nbsp; 변환항목일련번호 : &nbsp;</td>
            <td align='left'>&nbsp;<%=item.getSeqNo()%></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='250' bgcolor="<%= aBgColor[nCount%2] %>">&nbsp; 변환결과항목경로명 : &nbsp;</td>
            <td align='left'>&nbsp;<%=item.getResultItemPath()%></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='250' bgcolor="<%= aBgColor[nCount%2] %>">&nbsp; 변환명령명 : &nbsp;</td>
            <td align='left'>&nbsp;<%=item.getInstruction()%></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='250' bgcolor="<%= aBgColor[nCount%2] %>">&nbsp; 변환항목기본값 : &nbsp;</td>
            <td align='left'>&nbsp;<%=checkNull(item.getDefaultValue())%></td>
        </tr>
       

<%
    nCount++;
    }
} else {
%>    
        <tr bgcolor='white'>
            <td align='center' colspan="2" >&nbsp; 요청하신 변환규칙 아이템 정보가 없습니다. &nbsp;</td>
        </tr>

<%
}
%>

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