Search in sources :

Example 6 with MVELDialect

use of org.drools.compiler.rule.builder.dialect.mvel.MVELDialect in project drools by kiegroup.

the class PatternBuilder method createAndBuildPredicate.

protected Constraint createAndBuildPredicate(RuleBuildContext context, Pattern pattern, BaseDescr base, String expr, Map<String, OperatorDescr> aliases) {
    Dialect dialect = context.getDialect();
    MVELDialect mvelDialect = (MVELDialect) context.getDialect("mvel");
    context.setDialect(mvelDialect);
    PredicateDescr pdescr = new PredicateDescr(context.getRuleDescr().getResource(), expr);
    pdescr.copyParameters(base);
    pdescr.copyLocation(base);
    Constraint evalConstraint = buildEval(context, pattern, pdescr, aliases, expr, false);
    // fall back to original dialect
    context.setDialect(dialect);
    return evalConstraint;
}
Also used : XpathConstraint(org.drools.core.rule.constraint.XpathConstraint) NegConstraint(org.drools.core.rule.constraint.NegConstraint) Constraint(org.drools.core.spi.Constraint) MvelConstraint(org.drools.core.rule.constraint.MvelConstraint) EvaluatorConstraint(org.drools.core.rule.constraint.EvaluatorConstraint) PredicateConstraint(org.drools.core.rule.PredicateConstraint) Dialect(org.drools.compiler.compiler.Dialect) MVELDialect(org.drools.compiler.rule.builder.dialect.mvel.MVELDialect) JavaDialect(org.drools.compiler.rule.builder.dialect.java.JavaDialect) MVELDialect(org.drools.compiler.rule.builder.dialect.mvel.MVELDialect) PredicateDescr(org.drools.compiler.lang.descr.PredicateDescr)

Aggregations

MVELDialect (org.drools.compiler.rule.builder.dialect.mvel.MVELDialect)6 MVELAnalysisResult (org.drools.compiler.rule.builder.dialect.mvel.MVELAnalysisResult)4 BoundIdentifiers (org.drools.compiler.compiler.BoundIdentifiers)3 Dialect (org.drools.compiler.compiler.Dialect)2 JavaDialect (org.drools.compiler.rule.builder.dialect.java.JavaDialect)2 AnalysisResult (org.drools.compiler.compiler.AnalysisResult)1 DescrBuildError (org.drools.compiler.compiler.DescrBuildError)1 DroolsErrorWrapper (org.drools.compiler.compiler.DroolsErrorWrapper)1 DroolsParserException (org.drools.compiler.compiler.DroolsParserException)1 DroolsWarningWrapper (org.drools.compiler.compiler.DroolsWarningWrapper)1 BindingDescr (org.drools.compiler.lang.descr.BindingDescr)1 PredicateDescr (org.drools.compiler.lang.descr.PredicateDescr)1 PackageBuildContext (org.drools.compiler.rule.builder.PackageBuildContext)1 JavaBlockDescr (org.drools.compiler.rule.builder.dialect.java.parser.JavaBlockDescr)1 ClassFieldReader (org.drools.core.base.ClassFieldReader)1 ClassObjectType (org.drools.core.base.ClassObjectType)1 MVELCompilationUnit (org.drools.core.base.mvel.MVELCompilationUnit)1 MVELCompileable (org.drools.core.base.mvel.MVELCompileable)1 FactTemplate (org.drools.core.facttemplates.FactTemplate)1 FactTemplateFieldExtractor (org.drools.core.facttemplates.FactTemplateFieldExtractor)1