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

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

public class DbStaticsVo implements PersistentVo {

    public String getSchemaId() {
        return DataSourceContextHolder.getDataSourceType().getSchema();
    }
    
    
    private String eaiMoniJobDstcd; // EAI모니터링작업구분코드 ( 0:Sum(?) 1:시간별, 2:일자별-미정, 9:Peak )
    private String eaiMoniSvcDstcd; // EAI모니터링서비스구분코드
    private String statcYmd;        // 통계년월일
    private String statcHMS;        // 통계시각
    private String eaiMoniSysHostName; // EAI모니터링시스템호스트명
    private int    eaiMoniPrcssNoitm;  // EAI모니터링처리건수
    private int    eaiMoniToutNoitm;   // EAI모니터링타임아웃건수
    private int    eaiMoniErrNoitm;    // EAI모니터링에러건수
    private double maxSSPerPrcssQanty; // 최대초당처리수량 ( TPS )
	
    public String getEaiMoniJobDstcd() {
		return eaiMoniJobDstcd;
	}
	public void setEaiMoniJobDstcd(String eaiMoniJobDstcd) {
		this.eaiMoniJobDstcd = eaiMoniJobDstcd;
	}
	public String getEaiMoniSvcDstcd() {
		return eaiMoniSvcDstcd;
	}
	public void setEaiMoniSvcDstcd(String eaiMoniSvcDstcd) {
		this.eaiMoniSvcDstcd = eaiMoniSvcDstcd;
	}
	public String getStatcYmd() {
		return statcYmd;
	}
	public void setStatcYmd(String statcYmd) {
		this.statcYmd = statcYmd;
	}
	public String getStatcHMS() {
		return statcHMS;
	}
	public void setStatcHMS(String statcHMS) {
		this.statcHMS = statcHMS;
	}
	public String getEaiMoniSysHostName() {
		return eaiMoniSysHostName;
	}
	public void setEaiMoniSysHostName(String eaiMoniSysHostName) {
		this.eaiMoniSysHostName = eaiMoniSysHostName;
	}
	public int getEaiMoniPrcssNoitm() {
		return eaiMoniPrcssNoitm;
	}
	public void setEaiMoniPrcssNoitm(int eaiMoniPrcssNoitm) {
		this.eaiMoniPrcssNoitm = eaiMoniPrcssNoitm;
	}
	public int getEaiMoniToutNoitm() {
		return eaiMoniToutNoitm;
	}
	public void setEaiMoniToutNoitm(int eaiMoniToutNoitm) {
		this.eaiMoniToutNoitm = eaiMoniToutNoitm;
	}
	public int getEaiMoniErrNoitm() {
		return eaiMoniErrNoitm;
	}
	public void setEaiMoniErrNoitm(int eaiMoniErrNoitm) {
		this.eaiMoniErrNoitm = eaiMoniErrNoitm;
	}
	public double getMaxSSPerPrcssQanty() {
		return maxSSPerPrcssQanty;
	}
	public void setMaxSSPerPrcssQanty(double maxSSPerPrcssQanty) {
		this.maxSSPerPrcssQanty = maxSSPerPrcssQanty;
	}
    
	public void addCount(int proc, int timeout, int error) {
		this.eaiMoniPrcssNoitm += proc;
		this.eaiMoniToutNoitm  += timeout;
		this.eaiMoniErrNoitm   += error;
	}
	
	public void init() {
	    eaiMoniJobDstcd = "";
	    eaiMoniSvcDstcd = "";
	    statcYmd        = "";
	    statcHMS        = "";        // 통계시각
	    eaiMoniSysHostName = ""; // EAI모니터링시스템호스트명
	    eaiMoniPrcssNoitm = 0;  // EAI모니터링처리건수
	    eaiMoniToutNoitm = 0;   // EAI모니터링타임아웃건수
	    eaiMoniErrNoitm = 0;    // EAI모니터링에러건수
	    maxSSPerPrcssQanty = 0.0; // 최대초당처리수량 ( TPS )
	}
	
	public void add( DbStaticsVo vo ) {
		this.eaiMoniPrcssNoitm += vo.getEaiMoniPrcssNoitm();
		this.eaiMoniToutNoitm  += vo.getEaiMoniToutNoitm();
		this.eaiMoniErrNoitm   += vo.getEaiMoniErrNoitm();
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("eaiMoniJobDstcd=" + eaiMoniJobDstcd);
		sb.append(" ,eaiMoniSvcDstcd=" + eaiMoniSvcDstcd);
		sb.append(" ,statcYmd=" + statcYmd);
		sb.append(" ,statcHMS=" + statcHMS);
		sb.append(" ,eaiMoniSysHostName=" + eaiMoniSysHostName);
		sb.append(" ,eaiMoniPrcssNoitm=" + eaiMoniPrcssNoitm);
		sb.append(" ,eaiMoniToutNoitm=" + eaiMoniToutNoitm);
		sb.append(" ,eaiMoniErrNoitm=" + eaiMoniErrNoitm );
		sb.append(" ,maxSSPerPrcssQanty=" + maxSSPerPrcssQanty );
		return sb.toString();
	}
}
