package com.engine.kq.wfset.attendance.domain;

import weaver.common.StringUtil;
import com.engine.kq.wfset.attendance.framework.BaseEntity;
/**
 * 考勤流程版本
 * <p>Generated from 长东设计1.0.9 http://www.mfstyle.cn</p> 
 * 
 * @author wcd
 * @version 1.0 2016-05-31
 */
public class HrmAttFlowVersion extends BaseEntity {

	private static final long serialVersionUID = 1L;
  /**
   * 历史版本流程id
   */
	private String field001;
  /**
   * 存为新版本流程的流程id
   */
	private String field002;
	private HrmAttFlowType type;
	
	public HrmAttFlowVersion() {
		super();
	}

	public HrmAttFlowVersion(boolean arg) {
		super(arg);
	}
	
	public HrmAttFlowVersion(String workflowId, String newWfId) {
		this.field001 = StringUtil.vString(workflowId);
		this.field002 = StringUtil.vString(newWfId);
	}
	
	public enum HrmAttFlowType {
		ATT_PROC,
		STATE_PROC
	}

	protected void init() {
		this.field001 = "";
		this.field002 = "";
	}

	public void setField001(String field001) {
		this.field001 = field001;
	}

	public String getField001() {
		return field001;
	}

	public void setField002(String field002) {
		this.field002 = field002;
	}

	public String getField002() {
		return field002;
	}
	
	public HrmAttFlowType getType() {
		return type;
	}
	
	public void setType(HrmAttFlowType type) {
		this.type = type;
	}

	public HrmAttFlowVersion toAttProc() {
		this.type = HrmAttFlowType.ATT_PROC;
		return this;
	}

	public HrmAttFlowVersion toStateProc() {
		this.type = HrmAttFlowType.STATE_PROC;
		return this;
	}

	public boolean isError() {
		return StringUtil.parseToInt(field001) <= 0 || StringUtil.parseToInt(field002) <= 0;
	}

	public String getSql() {
		return new StringBuffer("select ")
		.append("'").append(field001).append("',")
		.append("'").append(field002).append("'")
		.toString();
	}

}
