Search in sources :

Example 16 with GlobalDescr

use of org.drools.compiler.lang.descr.GlobalDescr in project drools by kiegroup.

the class KnowledgeBuilderTest method createEvalRule.

private void createEvalRule(final PackageDescr packageDescr, final String expression) {
    final RuleDescr ruleDescr = new RuleDescr("rule-1");
    packageDescr.addRule(ruleDescr);
    final AndDescr lhs = new AndDescr();
    ruleDescr.setLhs(lhs);
    packageDescr.addGlobal(new GlobalDescr("map", "java.util.Map"));
    final EvalDescr evalDescr = new EvalDescr(expression);
    lhs.addDescr(evalDescr);
    ruleDescr.setConsequence("");
}
Also used : GlobalDescr(org.drools.compiler.lang.descr.GlobalDescr) AndDescr(org.drools.compiler.lang.descr.AndDescr) EvalDescr(org.drools.compiler.lang.descr.EvalDescr) RuleDescr(org.drools.compiler.lang.descr.RuleDescr)

Aggregations

GlobalDescr (org.drools.compiler.lang.descr.GlobalDescr)16 PackageDescr (org.drools.compiler.lang.descr.PackageDescr)13 RuleDescr (org.drools.compiler.lang.descr.RuleDescr)12 Test (org.junit.Test)12 AndDescr (org.drools.compiler.lang.descr.AndDescr)10 PatternDescr (org.drools.compiler.lang.descr.PatternDescr)7 List (java.util.List)6 Cheese (org.drools.compiler.Cheese)6 BindingDescr (org.drools.compiler.lang.descr.BindingDescr)6 CompositeObjectSinkAdapterTest (org.drools.core.reteoo.CompositeObjectSinkAdapterTest)6 ExprConstraintDescr (org.drools.compiler.lang.descr.ExprConstraintDescr)5 InputStreamReader (java.io.InputStreamReader)4 XmlPackageReader (org.drools.compiler.compiler.xml.XmlPackageReader)4 FunctionDescr (org.drools.compiler.lang.descr.FunctionDescr)4 InternalKnowledgePackage (org.drools.core.definitions.InternalKnowledgePackage)3 RuleImpl (org.drools.core.definitions.rule.impl.RuleImpl)3 HashMap (java.util.HashMap)2 EvalDescr (org.drools.compiler.lang.descr.EvalDescr)2 DefaultKnowledgeHelper (org.drools.core.base.DefaultKnowledgeHelper)2 InternalKnowledgeBase (org.drools.core.impl.InternalKnowledgeBase)2