class SceneEntity extends GenericEntity<String> implements RecordCreationEntity, RecordModifierEntity {

    @Column(nullable = false)
    @Schema(description = "告警名称")
    @NotBlank
    private String name;

    @Schema(description = "触发器类型")
    @Column(length = 32, nullable = false, updatable = false)
//    @EnumCodec
//    @ColumnType(javaType = String.class)
    @NotNull
    private String triggerType;

    @Column
    @JsonCodec
    @ColumnType(javaType = String.class, jdbcType = JDBCType.LONGVARCHAR)
    @Schema(description = "触发器")
    @NotNull
    private Trigger trigger;

    @Column
    @JsonCodec
    @ColumnType(javaType = String.class, jdbcType = JDBCType.LONGVARCHAR)
    @Schema(description = "触发条件")
    private List<Term> terms;

    @Column
    @Schema(description = "是否并行执行动作")
    @DefaultValue("false")
    private Boolean parallel;

    @Column
    @JsonCodec
    @ColumnType(javaType = String.class, jdbcType = JDBCType.LONGVARCHAR)
    @Schema(description = "执行动作")
    private List<SceneAction> actions;

    @Column
    @JsonCodec
    @ColumnType(javaType = String.class, jdbcType = JDBCType.LONGVARCHAR)
    @Schema(description = "动作分支")
    private List<SceneConditionAction> branches;

    @Column(length = 64, updatable = false)
    @Schema(description = "创建人")
    private String creatorId;

    @Column(updatable = false)
    @Schema(description = "创建时间")
    @DefaultValue(generator = Generators.CURRENT_TIME)
    private Long createTime;

    @Column(length = 64)
    @Schema(description = "修改人")
    private String modifierId;

    @Column
    @Schema(description = "修改时间")
    @DefaultValue(generator = Generators.CURRENT_TIME)
    private Long modifyTime;

    @Column
    @Schema(description = "启动时间")
    private Long startTime;

    @Schema(description = "状态")
    @Column(length = 32, nullable = false)
    @EnumCodec
    @ColumnType(javaType = String.class)
    @NotBlank
    @DefaultValue("disable")
    private RuleInstanceState state;

    @Schema(description = "扩展配置")
    @Column(name = "options")
    @JsonCodec
    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
    private Map<String, Object> options;

    @Column
    @Schema(description = "说明")
    private String description;

    public RuleInstance toRule() {<FILL_FUNCTION_BODY>}

    public SceneEntity with(SceneRule rule) {
        SceneEntity entity = copyFrom(rule);
        entity.setTriggerType(rule.getTrigger().getType());
        return entity;
    }


    public void validate() {
        getTrigger().validate();
       if (CollectionUtils.isEmpty(getActions()) && CollectionUtils.isEmpty(getBranches())){
           throw new BusinessException("error.scene_action_rule_cannot_be_null");
       }
    }
}

        SceneRule rule = copyTo(new SceneRule());

        RuleInstance instance = new RuleInstance();
        instance.setId(getId());
        RuleModel model = rule.toModel();
        model.addConfiguration(RuleEngineConstants.ruleCreatorIdKey, modifierId);
        model.addConfiguration(RuleEngineConstants.ruleName, getName());
        instance.setModel(model);
        return instance;
    
<no_super_class>