Search in sources :

Example 1 with Consequence

use of org.drools.verifier.components.Consequence in project drools by kiegroup.

the class RuleDescrVisitor method visitRuleDescr.

public void visitRuleDescr(RuleDescr descr) throws UnknownDescriptionException {
    rule = new VerifierRule(descr, rulePackage, descr.getNamedConsequences());
    rule.setName(descr.getName());
    for (AttributeDescr attribute : descr.getAttributes().values()) {
        rule.getAttributes().put(attribute.getName(), attribute.getValue());
    }
    Consequence consequence = visitConsequence(rule, descr.getConsequence());
    for (String name : descr.getNamedConsequences().keySet()) {
        visitNamedConsequence(name, descr.getNamedConsequences().get(name));
    }
    // TODO: NEEDS TO BE FIXED
    // rule.getMetadata().putAll( descr.get );
    rule.setConsequencePath(consequence.getPath());
    rule.setConsequenceType(consequence.getConsequenceType());
    rule.setLineNumber(descr.getLine());
    data.add(rule);
    rulePackage.getRules().add(rule);
    solvers.startRuleSolver(rule);
    visitAndDescr(descr.getLhs());
    solvers.endRuleSolver();
    addSubItems();
}
Also used : VerifierRule(org.drools.verifier.components.VerifierRule) NamedConsequence(org.drools.verifier.components.NamedConsequence) TextConsequence(org.drools.verifier.components.TextConsequence) Consequence(org.drools.verifier.components.Consequence) AttributeDescr(org.drools.drl.ast.descr.AttributeDescr)

Aggregations

AttributeDescr (org.drools.drl.ast.descr.AttributeDescr)1 Consequence (org.drools.verifier.components.Consequence)1 NamedConsequence (org.drools.verifier.components.NamedConsequence)1 TextConsequence (org.drools.verifier.components.TextConsequence)1 VerifierRule (org.drools.verifier.components.VerifierRule)1