package cc.smtweb.system.bpm.web.design.flow;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.system.bpm.web.design.flow.define.ProcInfo;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * Created by Akmm at 2022/5/21 10:40
 * 流程定义
 */
@SwTable("ASP_MODEL_PROC")
public class ModelProc extends DefaultEntity {
    public static final String ENTITY_NAME = "ASP_MODEL_PROC";
    //流程定义详情
    @JsonIgnore
    private transient ProcInfo procInfo = null;

    public ModelProc() {
        super(ENTITY_NAME);
    }

    public void clear() {
        procInfo = null;
    }

    public ProcInfo getProcInfo() {
        if (procInfo == null) {
            synchronized ("ModelProc_" + getId()) {
                if (procInfo == null) {
                    procInfo = JsonUtil.parse(getContent(), "model", ProcInfo.class);
                }
            }
        }
        return procInfo;
    }

    public long getId() {
        return getLong("prc_id");
    }

    public void setId(long prcId) {
        put("prc_id", prcId);
    }

    public long getPrjId() {
        return getLong("prc_prj_id");
    }

    public void setPrjId(long prcPrjId) {
        put("prc_prj_id", prcPrjId);
    }

    public long getMcId() {
        return getLong("prc_mc_id");
    }

    public void setMcId(long prcMcId) {
        put("prc_mc_id", prcMcId);
    }

    public String getCode() {
        return getStr("prc_code");
    }

    public void setCode(String prcCode) {
        put("prc_code", prcCode);
    }

    public String getName() {
        return getStr("prc_name");
    }

    public void setName(String prcName) {
        put("prc_name", prcName);
    }

    public String getContent() {
        return getStr("prc_content");
    }

    public void setContent(String prcContent) {
        put("prc_content", prcContent);
    }

    public String getRemark() {
        return getStr("prc_remark");
    }

    public void setRemark(String prcRemark) {
        put("prc_remark", prcRemark);
    }
}
