Search in sources :

Example 1 with EnabledBoolean

use of org.drools.core.base.EnabledBoolean in project drools by kiegroup.

the class KiePackagesBuilder method setRuleAttributes.

private void setRuleAttributes(Rule rule, RuleImpl ruleImpl) {
    Boolean noLoop = setAttribute(rule, Rule.Attribute.NO_LOOP, ruleImpl::setNoLoop);
    Boolean lockOnActive = setAttribute(rule, Rule.Attribute.LOCK_ON_ACTIVE, ruleImpl::setLockOnActive);
    setAttribute(rule, Rule.Attribute.AUTO_FOCUS, ruleImpl::setAutoFocus);
    setAttribute(rule, Rule.Attribute.ENABLED, e -> ruleImpl.setEnabled(new EnabledBoolean(e)));
    setAttribute(rule, Rule.Attribute.SALIENCE, s -> ruleImpl.setSalience(new SalienceInteger(s)));
    String agendaGroup = setAttribute(rule, Rule.Attribute.AGENDA_GROUP, ruleImpl::setAgendaGroup);
    setAttribute(rule, Rule.Attribute.RULEFLOW_GROUP, rfg -> {
        ruleImpl.setRuleFlowGroup(rfg);
        if (agendaGroup == null) {
            ruleImpl.setAgendaGroup(rfg);
        }
    });
    setAttribute(rule, Rule.Attribute.ACTIVATION_GROUP, ruleImpl::setActivationGroup);
    setAttribute(rule, Rule.Attribute.DURATION, t -> ruleImpl.setTimer(parseTimer(t)));
    setAttribute(rule, Rule.Attribute.TIMER, t -> ruleImpl.setTimer(parseTimer(t)));
    setAttribute(rule, Rule.Attribute.CALENDARS, ruleImpl::setCalendars);
    setAttribute(rule, Rule.Attribute.DATE_EFFECTIVE, ruleImpl::setDateEffective);
    setAttribute(rule, Rule.Attribute.DATE_EXPIRES, ruleImpl::setDateExpires);
    ruleImpl.setEager(ruleImpl.isEager() || noLoop != null || lockOnActive != null);
}
Also used : EnabledBoolean(org.drools.core.base.EnabledBoolean) EnabledBoolean(org.drools.core.base.EnabledBoolean) SalienceInteger(org.drools.core.base.SalienceInteger)

Aggregations

EnabledBoolean (org.drools.core.base.EnabledBoolean)1 SalienceInteger (org.drools.core.base.SalienceInteger)1