package com.sinosig.util.domain;

import java.io.Serializable;
import java.sql.Timestamp;
import org.springframework.util.DigestUtils;

public class WFInstance implements Serializable {
    /**
	 * default serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

    /**
	 * 业务工作流标识
	 */
	String psworkflowid;

	/**
	 * 业务流程版本标识
	 */
	String pswfversionid;

	/**
	 * 引擎标识
	 */
	String wfengineid;

	/**
	 * 引擎实例标识
	 */
	String wfengineinstanceid;

	/**
	 * 实例标识
	 */
	String wfinstanceid;

	/**
	 * 实例名
	 */
	String wfinstancename;

	/**
	 * 流程状态
	 */
	String wfstate;

	/**
	 * 业务数据
	 */
	String bsdata;

	/**
	 * 业务流程数据
	 */
	String bswfdata;

	/**
	 * 流程所有者
	 */
	String owner;

	/**
	 * 当前步骤
	 */
	String curstep;

	/**
	 * 上一步骤
	 */
	String prevstep;

	/**
	 * 是否关闭
	 */
	Integer isclosed;

	/**
	 * 开始时间
	 */
	Timestamp starttime;

	/**
	 * 结束时间
	 */
	Timestamp endtime;

	/**
     * 部署系统标识
     */
    String pssystemid;

    /**
     * 部署域标识
     */
    String workflowid;

	public String getPsworkflowid() {
		if (this.psworkflowid == null) {
            return this.psworkflowid;
        }
        String srtTmp = this.psworkflowid;
        if (this.pssystemid != null) {
            srtTmp = this.pssystemid + srtTmp;
        }
        if (this.workflowid != null) {
            srtTmp = this.workflowid + srtTmp;
        }
        return DigestUtils.md5DigestAsHex(srtTmp.getBytes());
	}

	public void setPsworkflowid(String psworkflowid) {
		this.psworkflowid = psworkflowid;
	}

	public String getPswfversionid() {
		if (this.pswfversionid == null) {
            return this.pswfversionid;
        }
        String srtTmp = this.pswfversionid;
        if (this.pssystemid != null) {
            srtTmp = this.pssystemid + srtTmp;
        }
        if (this.workflowid != null) {
            srtTmp = this.workflowid + srtTmp;
        }
        return DigestUtils.md5DigestAsHex(srtTmp.getBytes());
	}

	public void setPswfversionid(String pswfversionid) {
		this.pswfversionid = pswfversionid;
	}

	public String getWfengineid() {
		if (this.wfengineid == null) {
            return this.wfengineid;
        }
        String srtTmp = this.wfengineid;
        if (this.workflowid != null) {
            srtTmp = this.workflowid + srtTmp;
        }
        return DigestUtils.md5DigestAsHex(srtTmp.getBytes());
	}

	public void setWfengineid(String wfengineid) {
		this.wfengineid = wfengineid;
	}

	public String getWfengineinstanceid() {
		return wfengineinstanceid;
	}

	public void setWfengineinstanceid(String wfengineinstanceid) {
		this.wfengineinstanceid = wfengineinstanceid;
	}

	public String getWfinstanceid() {
		return wfinstanceid;
	}

	public void setWfinstanceid(String wfinstanceid) {
		this.wfinstanceid = wfinstanceid;
	}

	public String getWfinstancename() {
		return wfinstancename;
	}

	public void setWfinstancename(String wfinstancename) {
		this.wfinstancename = wfinstancename;
	}

	public String getWfstate() {
		return wfstate;
	}

	public void setWfstate(String wfstate) {
		this.wfstate = wfstate;
	}

	public String getBsdata() {
        return this.bsdata;
	}

	public void setBsdata(String bsdata) {
		this.bsdata = bsdata;
	}

	public String getBswfdata() {
        return this.bswfdata;
	}

	public void setBswfdata(String bswfdata) {
		this.bswfdata = bswfdata;
	}

	public String getOwner() {
		return owner;
	}

	public void setOwner(String owner) {
		this.owner = owner;
	}

	public String getCurstep() {
		return curstep;
	}

	public void setCurstep(String curstep) {
		this.curstep = curstep;
	}

	public String getPrevstep() {
		return prevstep;
	}

	public void setPrevstep(String prevstep) {
		this.prevstep = prevstep;
	}

	public Integer getIsclosed() {
		return isclosed;
	}

	public void setIsclosed(Integer isclosed) {
		this.isclosed = isclosed;
	}

	public Timestamp getStarttime() {
		return starttime;
	}

	public void setStarttime(Timestamp starttime) {
		this.starttime = starttime;
	}

	public Timestamp getEndtime() {
		return endtime;
	}

	public void setEndtime(Timestamp endtime) {
		this.endtime = endtime;
	}

	public String getPssystemid() {
        if (this.pssystemid == null) {
            return this.pssystemid;
        }
        String srtTmp = this.pssystemid;
        if (this.workflowid != null) {
            srtTmp = this.workflowid + srtTmp;
        }
        return DigestUtils.md5DigestAsHex(srtTmp.getBytes());
    }

    public void setPssystemid(String pssystemid) {
        this.pssystemid = pssystemid;
    }

    public String getWorkflowid() {
        if (this.workflowid != null) {
            return DigestUtils.md5DigestAsHex(this.workflowid.getBytes());
        }
        return this.workflowid;
    }

    public void setWorkflowid(String workflowid) {
        this.workflowid = workflowid;
    }
}
