Search in sources :

Example 1 with RuleInfoModel

use of com.duangframework.rule.entity.generate.RuleInfoModel in project duangframework by tcrct.

the class AutoCreateDrlFile method createRuleInfo.

private static String createRuleInfo(List<RuleInfoModel> ruleInfoModelList) {
    if (ToolsKit.isEmpty(ruleInfoModelList)) {
        throw new EmptyNullException("ruleInfoModelList is null");
    }
    StringBuilder ruleInfoString = new StringBuilder();
    for (Iterator<RuleInfoModel> it = ruleInfoModelList.iterator(); it.hasNext(); ) {
        RuleInfoModel ruleInfoModel = it.next();
        ruleInfoString.append("// ").append(ruleInfoModel.getRuleDesc()).append(ENTER_FIELD);
        ruleInfoString.append("rule \"").append(ruleInfoModel.getRuleName()).append("\"").append(ENTER_FIELD).append(TAB_FIELD).append("no-loop ").append(ruleInfoModel.isNoLoop()).append(ENTER_FIELD).append(TAB_FIELD).append("salience ").append(ruleInfoModel.getSalience()).append(ENTER_FIELD).append(TAB_FIELD).append("when").append(ENTER_FIELD).append(TAB_FIELD).append(TAB_FIELD).append(createRuleWhen(ruleInfoModel.getWhenList())).append(ENTER_FIELD).append(TAB_FIELD).append("then").append(ENTER_FIELD).append(TAB_FIELD).append(TAB_FIELD).append(createRuleThen(ruleInfoModel)).append(ENTER_FIELD).append("end").append(ENTER_FIELD).append(ENTER_FIELD);
    }
    return ruleInfoString.toString();
}
Also used : RuleInfoModel(com.duangframework.rule.entity.generate.RuleInfoModel) EmptyNullException(com.duangframework.core.exceptions.EmptyNullException)

Aggregations

EmptyNullException (com.duangframework.core.exceptions.EmptyNullException)1 RuleInfoModel (com.duangframework.rule.entity.generate.RuleInfoModel)1