package com.eactive.eai.rms.onl.transaction.vo;

import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
import com.eactive.eai.rms.onl.common.vo.BaseForm;

@SuppressWarnings("serial")
public class ExternalInterfaceVo extends BaseForm {
	
	public static final int APPR_DELT = 1;// 삭제(Delete)
	public static final int APPR_SAVE = 2;// 저장(Save)
//	public static final int APPR_UPDT = 2;// 수정(Update)
	public static final int APPR_REQT = 3;// 상신(reQuest) 
	public static final int APPR_CNCL = 2;// 상신취소(Cancel)	// 상신취소하면 저장상태로 돌아감
	public static final int APPR_EXNT = 5;// 검토중(Examination)
	public static final int APPR_AGMT = 6;// 승인(Agreement)
	public static final int APPR_RJCT = 7;// 반려(Reject)
	
	public static final String TITLE_01 = "영문명";
	public static final String TITLE_02 = "시스템인터페이스코드";
	public static final String TITLE_03 = "시스템인터페이스명";
	public static final String TITLE_04 = "당발타발구분";
	public static final String TITLE_05 = "전문요청구분";
	public static final String TITLE_06 = "송수신방법";
	public static final String TITLE_07 = "서비스ID";
	public static final String TITLE_08 = "레이아웃매핑";
	public static final String TITLE_09 = "전문추적관리필드";
	public static final String TITLE_10 = "통전문관리필드";
	public static final String TITLE_11 = "내외부구분";

	public static final String FCR_BAS = "BASEFC";
	public static final String FCR_C2R = "C2RFC";
	public static final String FCR_B2B = "B2BFC";
		
	private int    prcssSeq;        // 처리이력번호
	private int    svcGrpSeq;       // 그룹번호
	private int    svcPssSeq;       // 시퀀스번호 
	private int    apprStat;        // 승인상태      (저장(Save), 수정(Update), 삭제(Delete), 상신(reQuest), 상신취소(Cancel), 검토중(Examination), 승인(Agreement), 반려(Reject) )
	private String eaiSvcCd;        // 서비스코드   (시스템인터페이스코드 + 당발일 겨우 LEVEL2 , 타발일경우 시스템인터페이스코드의 앞3자리 , + 요청(S),응답(R) + 내부(1),대외(2))
	private String eaiBzwkDstcd;    // 업무구분   (Level2(영문명))
	private String sysIFCode;       // 시스템인터페이스코드   (외부시스템(대외기관) : 대외채널업무구분코드(영문명3자리)+전문종별코드+업무구분코드, 내부시스템 : 수신시스템 Level2(영문명)+거래코드+거래코드상세구분)
	private String sysIFName;       // 시스템인터페이스명   
	private String oidpDv;          // 당발타발구분   (당발(취급) : O, 타발(개설) : I)
	private String layoutReqDv;     // 전문요청구분   (요청 : S, 응답 : R)
	private String inExtnalDv;      // 내외부구분   (내부 : I, 외부 : E)
	private String sysNameFrom;     // 시스템(요청)   (내부시스템 : [업무시스템영문명]([업무시스템한글명]), 외부시스템 : [외부기관한글명])
	private String sndRcvDvFrom;    // 송수신방법(요청)   (-동기방식(Sync), -비동기방식(ASync), -Batch, -기타(ETC))
	private String prtclDvFrom;     // 프로토콜(요청)   (-SOCKET, -HTTP, -X.25, -Tmax, -기타(ETC))
	private String sysNameRlay;     // 시스템(중계)   (EAI - 내부시스템간 연동, FEP - 대외기관 시스템 연동)
	private String sndRcvDvRlay;    // 송수신방법(중계)   (-동기방식(Sync), -비동기방식(ASync), -Batch, -기타(ETC))
	private String prtclDvRlay;     // 프로토콜(중계)   (-SOCKET, -HTTP, -X.25, -Tmax, -기타(ETC))
	private String sysNameTo;       // 시스템(타겟)   
	private int    dataOccuType;    // 데이터발생유형   (- “REALTIME”(0), - “BATCH”(1), - “기타”(2))
	private String extnlIFCtnt;     // 비고   
	private String ifSvcID;         // 서비스ID, (계정계 서비스ID)   
	private String ifLayoutTypeCd;  // 처리결과수신서비스ID
	private int    ifResSvcIDOffset;// 전문종별코드   (offset , field길이)
	private int    ifResSvcIDFieldL;// 전문종별코드   (offset , field길이) 
	private int    ifTxDvCdOffset;  // 거래구분코드   (offset , field길이) 
	private int    ifTxDvCdFieldL;  // 거래구분코드   (offset , field길이) 
	private String ifLayoutTrace;   // 전문추적관리필드 
	private String pafiarInfoEmpid; // 요청자직원번호
	private String userName;        // 요청자명
	private String cphnNo;          // 요청자연락처
	private String apprEmpid;       // 승인자직원번호
	private String apprUserName;    // 승인자이름
	private String apprCtnt;        // 승인의견/반려사유
	private String prcssYMS;        // MMDDHH24MISSFF3)
	
	private String apprStatName;    // 승인상태명
	private String startDate;
	private String endDate;
	
	private String ifLayoutMappingName; // 레이아웃매핑명
	private String ifLayoutTrace1;   // 전문추적관리필드 
	private int    ifSvcIDOffset1;// 전문종별코드   (offset , field길이)
	private int    ifSvcIDLength1;// 전문종별코드   (offset , field길이)
	private String ifLayoutTrace2;   // 전문추적관리필드 
	private int    ifSvcIDOffset2;// 전문종별코드   (offset , field길이)
	private int    ifSvcIDLength2;// 전문종별코드   (offset , field길이)
	
	private String gstatSysAdptr;
	private String psvSysAdptr;
	private String asSysAdptr;
	

    public String getAsSysAdptr() {
		return asSysAdptr;
	}

	public void setAsSysAdptr(String asSysAdptr) {
		this.asSysAdptr = asSysAdptr;
	}

	private String createBy = "";
    private String updateBy = "";
    
    //개발담당자, JB담당자 추가 // 2013.06.12
    private String devEmpid = "";
    private String jbEmpid = "";
    private String deUserName = "";
    private String jbUserName = "";
    
    //FlowCtrlRoutName
    private String flowCtrlRoutName = "";
    //FailOverYn
    private boolean failover = false;

    
    public boolean isFailover() {
		return failover;
	}

	public void setFailover(boolean failover) {
		this.failover = failover;
	}

	public String getFlowCtrlRoutName() {
		return flowCtrlRoutName;
	}

	public void setFlowCtrlRoutName(String flowCtrlRoutName) {
		this.flowCtrlRoutName = flowCtrlRoutName;
	}

	public boolean isDevEmpid() {
    	if( updateBy == null || "".equals(updateBy.trim()) ) return false;
    	if( updateBy.startsWith("00") || updateBy.startsWith("98") ) return true; // 개발자인경우 true 리턴
		return false;
	}
    
    public String getDevEmpid() {
		return devEmpid;
	}

	public void setDevEmpid(String devEmpid) {
		this.devEmpid = devEmpid;
	}

	public String getJbEmpid() {
		return jbEmpid;
	}

	public void setJbEmpid(String jbEmpid) {
		this.jbEmpid = jbEmpid;
	}

	public String getDeUserName() {
		return deUserName;
	}

	public void setDeUserName(String deUserName) {
		this.deUserName = deUserName;
	}

	public String getJbUserName() {
		return jbUserName;
	}

	public void setJbUserName(String jbUserName) {
		this.jbUserName = jbUserName;
	}

	public String getCreateBy() {
    	return createBy;
    }

    public String getUpdateBy() {
    	return updateBy;
    }
    
    public void setCreateBy(String createBy) {
    	this.createBy = createBy;
    }
    
    public void setUpdateBy(String updateBy) {
    	this.updateBy = updateBy;
    	if( isDevEmpid() && devEmpid == null ) devEmpid = updateBy;
    	if( !isDevEmpid() && jbEmpid == null ) jbEmpid  = updateBy;
    }
	
	public String getGstatSysAdptr() {
		return gstatSysAdptr;
	}

	public void setGstatSysAdptr(String gstatSysAdptr) {
		this.gstatSysAdptr = gstatSysAdptr;
	}
	
	public String getPsvSysAdptr() {
		return psvSysAdptr;
	}

	public void setPsvSysAdptr(String psvSysAdptr) {
		this.psvSysAdptr = psvSysAdptr;
	}
	public String getIfLayoutMappingName() {
		return ifLayoutMappingName;
	}

	public void setIfLayoutMappingName(String ifLayoutMappingName) {
		this.ifLayoutMappingName = ifLayoutMappingName;
	}

	public String getIfLayoutTrace1() {
		return ifLayoutTrace1;
	}

	public void setIfLayoutTrace1(String ifLayoutTrace1) {
		this.ifLayoutTrace1 = ifLayoutTrace1;
	}

	public int getIfSvcIDOffset1() {
		return ifSvcIDOffset1;
	}

	public void setIfSvcIDOffset1(int ifSvcIDOffset1) {
		this.ifSvcIDOffset1 = ifSvcIDOffset1;
	}

	public int getIfSvcIDLength1() {
		return ifSvcIDLength1;
	}

	public void setIfSvcIDLength1(int ifSvcIDLength1) {
		this.ifSvcIDLength1 = ifSvcIDLength1;
	}

	public String getIfLayoutTrace2() {
		return ifLayoutTrace2;
	}

	public void setIfLayoutTrace2(String ifLayoutTrace2) {
		this.ifLayoutTrace2 = ifLayoutTrace2;
	}

	public int getIfSvcIDOffset2() {
		return ifSvcIDOffset2;
	}

	public void setIfSvcIDOffset2(int ifSvcIDOffset2) {
		this.ifSvcIDOffset2 = ifSvcIDOffset2;
	}

	public int getIfSvcIDLength2() {
		return ifSvcIDLength2;
	}

	public void setIfSvcIDLength2(int ifSvcIDLength2) {
		this.ifSvcIDLength2 = ifSvcIDLength2;
	}

	public int getPrcssSeq() {
		return prcssSeq;
	}

	public void setPrcssSeq(int prcssSeq) {
		this.prcssSeq = prcssSeq;
	}

	public int getSvcGrpSeq() {
		return svcGrpSeq;
	}

	public void setSvcGrpSeq(int svcGrpSeq) {
		this.svcGrpSeq = svcGrpSeq;
	}

	public int getSvcPssSeq() {
		return svcPssSeq;
	}

	public void setSvcPssSeq(int svcPssSeq) {
		this.svcPssSeq = svcPssSeq;
	}

	public int getApprStat() {
		return apprStat;
	}

	public void setApprStat(int apprStat) {
		this.apprStat = apprStat;
	}

	
	public void setEaiSvcCd(String eaiSvcCd) {
		this.eaiSvcCd = eaiSvcCd;
	}

	public String getEaiSvcCd() {
		//시스템인터페이스코드 + 요청(S),응답(R) + 내부I(1),대외E(2)		
		return sysIFCode + layoutReqDv + inExtnalDv;
	}


	public String getEaiBzwkDstcd() {
		return eaiBzwkDstcd;
	}

	public void setEaiBzwkDstcd(String eaiBzwkDstcd) {
		this.eaiBzwkDstcd = eaiBzwkDstcd;
	}

	public String getSysIFCode() {
		return sysIFCode;
	}

	public void setSysIFCode(String sysIFCode) {
		this.sysIFCode = sysIFCode;
	}

	public String getSysIFName() {
		return sysIFName;
	}

	public void setSysIFName(String sysIFName) {
		this.sysIFName = sysIFName;
	}

	public String getOidpDv() {
		return oidpDv;
	}

	public void setOidpDv(String oidpDv) {
		this.oidpDv = oidpDv;
	}

	public String getLayoutReqDv() {
		return layoutReqDv;
	}

	public void setLayoutReqDv(String layoutReqDv) {
		this.layoutReqDv = layoutReqDv;
	}

	public String getInExtnalDv() {
		return inExtnalDv;
	}

	public void setInExtnalDv(String inExtnalDv) {
		this.inExtnalDv = inExtnalDv;
	}

	public String getSysNameFrom() {
		return sysNameFrom;
	}

	public void setSysNameFrom(String sysNameFrom) {
		this.sysNameFrom = sysNameFrom;
	}

	public String getSndRcvDvFrom() {
		return sndRcvDvFrom;
	}

	public void setSndRcvDvFrom(String sndRcvDvFrom) {
		this.sndRcvDvFrom = sndRcvDvFrom;
	}

	public String getPrtclDvFrom() {
		return prtclDvFrom;
	}

	public void setPrtclDvFrom(String prtclDvFrom) {
		this.prtclDvFrom = prtclDvFrom;
	}

	public String getSysNameRlay() {
		return sysNameRlay;
	}

	public void setSysNameRlay(String sysNameRlay) {
		this.sysNameRlay = sysNameRlay;
	}

	public String getSndRcvDvRlay() {
		return sndRcvDvRlay;
	}

	public void setSndRcvDvRlay(String sndRcvDvRlay) {
		this.sndRcvDvRlay = sndRcvDvRlay;
	}

	public String getPrtclDvRlay() {
		return prtclDvRlay;
	}

	public void setPrtclDvRlay(String prtclDvRlay) {
		this.prtclDvRlay = prtclDvRlay;
	}

	public String getSysNameTo() {
		return sysNameTo;
	}

	public void setSysNameTo(String sysNameTo) {
		this.sysNameTo = sysNameTo;
	}

	public int getDataOccuType() {
		return dataOccuType;
	}

	public void setDataOccuType(int dataOccuType) {
		this.dataOccuType = dataOccuType;
	}

	public String getExtnlIFCtnt() {
		return extnlIFCtnt;
	}

	public void setExtnlIFCtnt(String extnlIFCtnt) {
		this.extnlIFCtnt = extnlIFCtnt;
	}

	public String getIfSvcID() {
		return ifSvcID;
	}

	public void setIfSvcID(String ifSvcID) {
		this.ifSvcID = ifSvcID;
	}

	public String getIfLayoutTypeCd() {
		return ifLayoutTypeCd;
	}

	public void setIfLayoutTypeCd(String ifLayoutTypeCd) {
		this.ifLayoutTypeCd = ifLayoutTypeCd;
	}

	public int getIfResSvcIDOffset() {
		return ifResSvcIDOffset;
	}
	public void setIfResSvcIDOffset(int ifResSvcIDOffset) {
		this.ifResSvcIDOffset = ifResSvcIDOffset;
	}
	public int getIfResSvcIDFieldL() {
		return ifResSvcIDFieldL;
	}
	public void setIfResSvcIDFieldL(int ifResSvcIDFieldL) {
		this.ifResSvcIDFieldL = ifResSvcIDFieldL;
	}

	public int getIfTxDvCdOffset() {
		return ifTxDvCdOffset;
	}
	public void setIfTxDvCdOffset(int ifTxDvCdOffset) {
		this.ifTxDvCdOffset = ifTxDvCdOffset;
	}
	public int getIfTxDvCdFieldL() {
		return ifTxDvCdFieldL;
	}
	public void setIfTxDvCdFieldL(int ifTxDvCdFieldL) {
		this.ifTxDvCdFieldL = ifTxDvCdFieldL;
	}

	public String getIfLayoutTrace() {
		return ifLayoutTrace;
	}

	public void setIfLayoutTrace(String ifLayoutTrace) {
		this.ifLayoutTrace = ifLayoutTrace;
	}

	public String getPafiarInfoEmpid() {
		return pafiarInfoEmpid;
	}

	public void setPafiarInfoEmpid(String pafiarInfoEmpid) {
		this.pafiarInfoEmpid = pafiarInfoEmpid;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getCphnNo() {
		return cphnNo;
	}

	public void setCphnNo(String cphnNo) {
		this.cphnNo = cphnNo;
	}

	public String getApprEmpid() {
		return apprEmpid;
	}

	public void setApprEmpid(String apprEmpid) {
		this.apprEmpid = apprEmpid;
	}

	public String getApprUserName() {
		return apprUserName;
	}

	public void setApprUserName(String apprUserName) {
		this.apprUserName = apprUserName;
	}

	public String getApprCtnt() {
		return apprCtnt;
	}

	public void setApprCtnt(String apprCtnt) {
		this.apprCtnt = apprCtnt;
	}

	public String getPrcssYMS() {
		return prcssYMS;
	}

	public void setPrcssYMS(String prcssYMS) {
		this.prcssYMS = prcssYMS;
	}

	public String getApprStatName() {
		return apprStatName;
	}

	public void setApprStatName(String apprStatName) {
		this.apprStatName = apprStatName;
	}
	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}
	
	/* (non-Javadoc)
     * @see com.eactive.eai.rms.manage.serviceinfo.vo.PersistentVo#getSchemaId()
     */
    public String getSchemaId() {
        return DataSourceContextHolder.getDataSourceType().getSchema();
    }

	public String toString() {
		
		StringBuffer sb = new StringBuffer();
		sb.append("[ExternalInterfaceVo]\n");
		sb.append("PrcssSeq=["                  ).append(prcssSeq                  ).append("], ");
		sb.append("SvcGrpSeq=["                 ).append(svcGrpSeq                 ).append("], ");
		sb.append("SvcPssSeq=["                 ).append(svcPssSeq                 ).append("], ");
		sb.append("ApprStat=["                  ).append(apprStat                  ).append("], ");
		sb.append("EAISvcCd=["                  ).append(eaiSvcCd		           ).append("], ");
		sb.append("EAIBzwkDstcd=["              ).append(eaiBzwkDstcd              ).append("], ");
		sb.append("SysIFCode=["                 ).append(sysIFCode                 ).append("], ");
		sb.append("SysIFName=["                 ).append(sysIFName                 ).append("], ");
		sb.append("OidpDv=["                    ).append(oidpDv                    ).append("], ");
		sb.append("LayoutReqDv=["               ).append(layoutReqDv               ).append("], ");
		sb.append("InExtnalDv=["                ).append(inExtnalDv                ).append("], ");
		sb.append("SndRcvDvFrom=["              ).append(sndRcvDvFrom              ).append("], ");
		sb.append("DataOccuType=["              ).append(dataOccuType              ).append("], ");
		sb.append("ExtnlIFCtnt=["               ).append(extnlIFCtnt               ).append("], ");
		sb.append("IFSvcID=["                   ).append(ifSvcID                   ).append("], ");
		sb.append("ifLayoutMappingName=["       ).append(ifLayoutMappingName       ).append("], ");
		sb.append("ifLayoutTrace1=["            ).append(ifLayoutTrace1            ).append("], [").append(ifSvcIDOffset1).append("], [").append(ifSvcIDLength1).append("], ");
		sb.append("ifLayoutTrace2=["            ).append(ifLayoutTrace2            ).append("], [").append(ifSvcIDOffset2  ).append("], [").append(ifSvcIDLength2).append("], ");
		sb.append("gstatSysAdptr=["             ).append(gstatSysAdptr             ).append("], ");
		sb.append("psvSysAdptr=["               ).append(psvSysAdptr               ).append("], ");
		sb.append("IFLayoutTypeCd=["            ).append(ifLayoutTypeCd            ).append("], ");
		sb.append("IFLayoutTrace=["             ).append(ifLayoutTrace             ).append("], ");
		sb.append("PafiarInfoEmpid=["           ).append(pafiarInfoEmpid           ).append("], ");
		sb.append("UserName=["                  ).append(userName                  ).append("], ");
		sb.append("CphnNo=["                    ).append(cphnNo                    ).append("], ");
		sb.append("SysNameFrom=["               ).append(sysNameFrom               ).append("], ");
		sb.append("PrtclDvFrom=["               ).append(prtclDvFrom               ).append("], ");
		sb.append("SysNameRlay=["               ).append(sysNameRlay               ).append("], ");
		sb.append("SndRcvDvRlay=["              ).append(sndRcvDvRlay              ).append("], ");
		sb.append("PrtclDvRlay=["               ).append(prtclDvRlay               ).append("], ");
		sb.append("SysNameTo=["                 ).append(sysNameTo                 ).append("], ");
		sb.append("IFResSvcID=["                ).append(ifResSvcIDOffset          ).append("], [").append(ifResSvcIDFieldL).append("], ");
		sb.append("IFTxDvCd=["                  ).append(ifTxDvCdOffset            ).append("], [").append(ifTxDvCdFieldL  ).append("], ");		
		sb.append("ApprEmpid=["                 ).append(apprEmpid                 ).append("], ");
		sb.append("ApprUserName=["              ).append(apprUserName              ).append("], ");
		sb.append("ApprCtnt=["                  ).append(apprCtnt                  ).append("], ");
		sb.append("PrcssYMS=["                  ).append(prcssYMS                  ).append("]");
		return sb.toString();
	}

}
