package com.eactive.eai.inbound.remote;

import com.eactive.eai.common.dao.Keys;

public interface RemoteDirectoryQuery
{

    //REMOTE 서버별 작업디렉토리 목록 조회
	public static final String SEARCH_REMOTE_DIRECTORY =
		  "SELECT A.RmtSevrID             , \n"
		+ "       A.RmtSevrName           , \n"
		+ "       A.BjobBzwkDstcd         , \n"
		+ "       A.RmtSevrIP             , \n"
		+ "       A.RmtSevrNDMPortNoName  , \n"
		+ "       A.RmtSevrFTPPortNoName  , \n"
		+ "       A.RmtSevrFTPUID         , \n"
		+ "       A.RmtSevrFTPUserPwdName , \n"
		+ "       A.RmtSevrRootDirName    , \n"
		+ "       A.RmtFileEvntCpyDstcd   , \n"
		+ "       A.ThisMsgUseYn          , \n"
		+ "       A.ThisMsgRegsntID       , \n"
		+ "       A.ThisMsgRegiHMS        , \n"
		+ "       A.ThisMsgAmndrID        , \n"
		+ "       A.ThisMsgAmndHMS        , \n"
		+ "       B.RmtSevrJobDirID       , \n"
		+ "       B.RmtSevrJobDirName     , \n"
		+ "       B.RmtSevrID             , \n"
		+ "       B.BjobBzwkDstcd         , \n"
		+ "       C.BjobBzwkName          , \n"
		+ "       LTRIM(RTRIM(B.OsidInstiDstcd  ))     AS OsidInstiDstcd , \n"
		+ "       D.OsidInstiName         , \n"
		+ "       B.TranGroupDsticID      , \n"
		+ "       B.ThisMsgUseYn          , \n"
		+ "       B.ThisMsgRegsntID       , \n"
		+ "       B.ThisMsgRegiHMS        , \n"
		+ "       B.ThisMsgAmndrID        , \n"
		+ "       B.ThisMsgAmndHMS          \n"
		+ "FROM   " + Keys.TABLE_OWNER + "TSEAIBU01          A,\n"
		+ "       " + Keys.TABLE_OWNER + "TSEAIBU02          B \n"
		+ "       LEFT OUTER JOIN " + Keys.TABLE_OWNER + "TSEAIBJ02          C \n"
        + "ON    B.BjobBzwkDstcd      = C.BjobBzwkDstcd    \n"
		+ "       LEFT OUTER JOIN " + Keys.TABLE_OWNER + "TSEAIBJ06          D \n"
        + "ON    B.BjobBzwkDstcd      = D.BjobBzwkDstcd    \n"
        + "AND    LTRIM(RTRIM(B.OsidInstiDstcd))     = LTRIM(RTRIM(D.OsidInstiDstcd))   \n"
		+ "WHERE  A.RmtSevrID          = B.RmtSevrID \n"
		+ "AND    B.BjobBzwkDstcd      LIKE ? || '%' \n";
    //REMOTE 서버작업디렉토리 등록
    public static final String INSERT_REMOTE_DIRECTORY =
		  "INSERT INTO " + Keys.TABLE_OWNER + "TSEAIBU02 ( \n"
		+ "       RmtSevrJobDirID     , \n"
		+ "       RmtSevrJobDirName   , RmtSevrID         , BjobBzwkDstcd     , OsidInstiDstcd    , \n"
		+ "       TranGroupDsticID    , ThisMsgUseYn      , ThisMsgRegsntID   , ThisMsgRegiHMS    , \n"
		+ "       ThisMsgAmndrID      , ThisMsgAmndHMS     ) \n"
        + "SELECT cast(? as VARCHAR (30)) || 'RD' || VALUE( TO_CHAR(INT(SUBSTR(MAX(RmtSevrJobDirID),12,3)) + 1, '000'), '001'), \n"
		+ "       cast(? as VARCHAR (100))                   , cast(? as VARCHAR (30))                   , cast(? as CHARACTER (5))                   ,  cast(? as CHARACTER (4))                    , \n"
		+ "       cast(? as VARCHAR (10))                   , cast(? as CHARACTER (1))                   , cast(? as VARCHAR (40))                   , cast(? as CHARACTER (16))                    , \n"
		+ "       cast(? as VARCHAR (40))                   , cast(? as CHARACTER (16))                     \n"
		+ "FROM   " + Keys.TABLE_OWNER + "TSEAIBU02 \n"
		+ "WHERE  RmtSevrID = ?";

  
    //REMOTE 서버 작업디렉토리 변경
	public static final String UPDATE_REMOTE_DIRECTORY =
		  "UPDATE " + Keys.TABLE_OWNER + "TSEAIBU02 \n"
		+ "SET    RmtSevrID          = ?, \n"
		+ "       RmtSevrJobDirName  = ?, \n"
		+ "       OsidInstiDstcd     = ?, \n"
		+ "       TranGroupDsticID   = ?, \n"
		+ "       ThisMsgUseYn       = ?, \n"
		+ "       ThisMsgAmndrID     = ?, \n"
		+ "       ThisMsgAmndHMS     = ?  \n"
		+ "WHERE  RmtSevrJobDirID    = ?";

    //REMOTE 서버 작업디렉토리 삭제
	public static final String DELETE_REMOTE_DIRECTORY =
		  "DELETE FROM " + Keys.TABLE_OWNER + "TSEAIBU02 \n"
		+ "WHERE  RmtSevrJobDirID   = ?";
}
