package cn.estsh.i3plus.pojo.wms.engine.rule;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.Transient;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;

/**
 * 业务规则持久化实体类
 *
 * @author Rock.Yu
 * @since 2019-04-16 09:27
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table(name = "DROOLS_RULE_PERSISTENCE")
@Api("系统动态业务规则")
public class EngineRulePersistence extends BaseBean {
    private static final long serialVersionUID = 5119552483383770556L;
    // 规则调用的唯一编号，例如：WMS_RECEIVE_0001
    @Column(name = "RULE_NO", length = 50)
    private String ruleNo;
    // 规则的中文名称
    @Column(name = "RULE_NAME", length = 50)
    private String ruleName;
    // 规则的具体内容
    @Lob
    @Column(name = "RULE_CONTENT", columnDefinition = "TEXT")
    private String ruleContent;
    // 规则的描述，包含规则的用法，参数说明等
    @Column(name = "RULE_REMARK", length = 2000)
    private String ruleRemark;
    // 加载好的规则引擎对象（有状态）
    @Transient
    private transient Object kieSession;
    // 加载好的规则引擎对象（无状态）
    @Transient
    private transient Object statelessKieSession;
}
