package com.eactive.eai.adapter;

import com.eactive.eai.common.dao.Keys;
/**
* 1. 기능 : AdapterDAO에서 사용하는 SQL Query문을 정의한 상수 인터페이스
* 2. 처리 개요 : AdapterDAO에서 사용하는 SQL Query문을 상수로 정의한다.
* 3. 주의사항
*
* @author  :
* @version : v 1.0.0
* @see : 관련 기능을 참조
* @since   :
*/
public interface AdapterQuery
{

    /**
     *  모든 어댑터그룹 정보를 SELECT하는 QUERY
     *  어댑터 사용여부  = '1'
     */
    public static final String SELECT_ALL_GROUPS =
          "SELECT A.AdptrBzwkGroupName                                 ,\n" +
          "       A.AdptrCd                                            ,\n" +
          "       A.AdptrUseYn                                         ,\n" +
          "       A.AdptrBzwkGroupDesc                                 ,\n" +
          "       B.BjobBzwkDstcd                                      ,\n" +
          "       LTRIM(RTRIM(B.OsidInstiDstcd)) AS OsidInstiDstcd  \n" +
          "FROM   " + Keys.TABLE_OWNER + "TSEAIBA01 A,                      \n" +
          "       " + Keys.TABLE_OWNER + "TSEAIBJ06 B                       \n" +
          "WHERE  A.AdptrBzwkGroupName = B.AdptrBzwkGroupName       \n" +
          "AND    A.AdptrUseYn         = '1'                            \n" +
          "AND    B.ThisMsgUseYn       = '1'                            ";


    /**
     *  어댑터그룹에 해당되는 어댑터 정보를 SELECT하는 QUERY
     */
    public static final String SELECT_ADAPTERS_BY_GROUP =
          "SELECT A.AdptrBzwkGroupName                                ,\n" +
          "       A.AdptrBzwkName                                     ,\n" +
          "       A.LstnerClsName                                     ,\n" +
          "       A.PrptyGroupName                                    ,\n" +
          "       A.AdptrDesc                                         ,\n" +
          "       B.SysLnkgDstcd                                      ,\n" +
          "       B.BjobBzwkDstcd                                     ,\n" +
          "       LTRIM(RTRIM(B.OsidInstiDstcd)) AS OsidInstiDstcd,\n" +
          "       B.LnkgIPInfoName                                    ,\n" +
          "       B.LnkgPortInfoName                                  ,\n" +
          "       B.ToutVal                                           ,\n" +
          "       C.RecvPrcssRuleCd                                   ,\n" +
          "       C.OsidInstiName                                     ,\n" +
          "       B.LnkgID                                            ,\n" +
          "       B.LnkgPwd                                           ,\n" +
          "       C.TelgmPcketSize                                    ,\n" +
          "       B.RqstRspnsDstcd                                    ,\n" +
          "       D.BjobBzwkName                                       \n" +
          "FROM   " + Keys.TABLE_OWNER + "TSEAIBA02 A,                     \n" +
          "       " + Keys.TABLE_OWNER + "TSEAIBJ05 B,                     \n" +
          "       " + Keys.TABLE_OWNER + "TSEAIBJ06 C                      \n" +
          "       LEFT OUTER JOIN " + Keys.TABLE_OWNER + "TSEAIBJ02 D      \n" +
          "           on C.BjobBzwkDstcd = D.BjobBzwkDstcd         \n" +
          "WHERE  A.AdptrBzwkGroupName = B.AdptrBzwkGroupName      \n" +
          "AND    A.AdptrBzwkName      = B.AdptrBzwkName           \n" +
          "AND    B.BjobBzwkDstcd      = C.BjobBzwkDstcd           \n" +
          "AND    LTRIM(RTRIM(B.OsidInstiDstcd)) = LTRIM(RTRIM( C.OsidInstiDstcd))\n" +
          "AND    A.AdptrBzwkGroupName = ?                             \n" +
          "AND    B.ThisMsgUseYn       = '1'                           \n" +
          "AND    B.RqstRspnsDstcd     in ('A', 'C')                   \n" +
          "AND    C.ThisMsgUseYn       = '1'                             ";

    /**
     * 어댑터 그룹 정보 상세조회
     */
    public static final String GET_ADAPTER_GROUP =
    		"SELECT A.AdptrBzwkGroupName                                 ,\n" +
            "       A.AdptrCd                                            ,\n" +
    		"       A.AdptrUseYn                                         ,\n" +
            "       A.AdptrBzwkGroupDesc                                 ,\n" +
    		"       B.BjobBzwkDstcd                                      ,\n" +
            "       LTRIM(RTRIM(B.OsidInstiDstcd)) AS OsidInstiDstcd      \n" +
    		"FROM   " + Keys.TABLE_OWNER + "TSEAIBA01 A,                  \n" +
            "       " + Keys.TABLE_OWNER + "TSEAIBJ06 B                   \n" +
    		"WHERE  A.AdptrBzwkGroupName = B.AdptrBzwkGroupName           \n" +
            "AND    A.AdptrBzwkGroupName = ?      ";


    /**
     * 어댑터 정보 상세조회
     */
    public static final String GET_ADAPTERS =
        "SELECT   a.AdptrBzwkGroupName,\n" 
      + "         a.AdptrBzwkName     ,\n"
      + "         a.LstnerClsName     ,\n"
      +	"         a.PrptyGroupName    ,\n" 
      +	"         a.AdptrDesc         ,\n" 
      +	"         b.PrptyGroupDesc     \n"
      + "FROM " + Keys.TABLE_OWNER + "TSEAIBA02 a LEFT OUTER JOIN\n" 
      +           Keys.TABLE_OWNER + "TSEAIBP01 b                \n"
      + "         ON a.PrptyGroupName = b.PrptyGroupName \n"
      + "WHERE    a.AdptrBzwkGroupName = ? ";

    /**
     * 어댑터 그룹명 조회
     */
    public static final String SELECT_ADPT_GROUP_NAMES =
        "SELECT   AdptrBzwkGroupName       \n"
      + "FROM " + Keys.TABLE_OWNER + "TSEAIBA01\n"
      + "ORDER BY AdptrBzwkGroupName         ";

}