use of org.drools.core.rule.MVELDialectRuntimeData in project drools by kiegroup.
the class TypeDeclarationConfigurator method getFieldExtractor.
private static InternalReadAccessor getFieldExtractor(TypeDeclaration type, String timestampField, InternalKnowledgePackage pkg, MVELAnalysisResult results) {
InternalReadAccessor reader = pkg.getClassFieldAccessorStore().getMVELReader(ClassUtils.getPackage(type.getTypeClass()), type.getTypeClass().getName(), timestampField, type.isTypesafe(), results.getReturnType());
MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData("mvel");
data.addCompileable((MVELCompileable) reader);
((MVELCompileable) reader).compile(data);
return reader;
}
use of org.drools.core.rule.MVELDialectRuntimeData in project drools by kiegroup.
the class PhreakJoinNodeTest method createContext.
public BuildContext createContext() {
RuleBaseConfiguration conf = new RuleBaseConfiguration();
KnowledgeBaseImpl rbase = new KnowledgeBaseImpl("ID", conf);
BuildContext buildContext = new BuildContext(rbase);
RuleImpl rule = new RuleImpl("rule1").setPackage("org.pkg1");
InternalKnowledgePackage pkg = new KnowledgePackageImpl("org.pkg1");
pkg.getDialectRuntimeRegistry().setDialectData("mvel", new MVELDialectRuntimeData());
pkg.addRule(rule);
buildContext.setRule(rule);
return buildContext;
}
use of org.drools.core.rule.MVELDialectRuntimeData in project drools by kiegroup.
the class PhreakNotNodeTest method createContext.
public BuildContext createContext() {
RuleBaseConfiguration conf = new RuleBaseConfiguration();
KnowledgeBaseImpl rbase = new KnowledgeBaseImpl("ID", conf);
BuildContext buildContext = new BuildContext(rbase);
RuleImpl rule = new RuleImpl("rule1").setPackage("org.pkg1");
InternalKnowledgePackage pkg = new KnowledgePackageImpl("org.pkg1");
pkg.getDialectRuntimeRegistry().setDialectData("mvel", new MVELDialectRuntimeData());
pkg.addRule(rule);
buildContext.setRule(rule);
return buildContext;
}
use of org.drools.core.rule.MVELDialectRuntimeData in project drools by kiegroup.
the class SegmentPropagationTest method createContext.
public BuildContext createContext() {
RuleBaseConfiguration conf = new RuleBaseConfiguration();
KnowledgeBaseImpl rbase = new KnowledgeBaseImpl("ID", conf);
BuildContext buildContext = new BuildContext(rbase);
RuleImpl rule = new RuleImpl("rule1").setPackage("org.pkg1");
InternalKnowledgePackage pkg = new KnowledgePackageImpl("org.pkg1");
pkg.getDialectRuntimeRegistry().setDialectData("mvel", new MVELDialectRuntimeData());
pkg.addRule(rule);
buildContext.setRule(rule);
return buildContext;
}
use of org.drools.core.rule.MVELDialectRuntimeData in project drools by kiegroup.
the class MVELEnabledExpression method getValue.
public boolean getValue(final Tuple tuple, final Declaration[] declrs, final RuleImpl rule, final WorkingMemory workingMemory) {
VariableResolverFactory factory = unit.getFactory(null, declrs, rule, null, (LeftTuple) tuple, null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver());
// do we have any functions for this namespace?
InternalKnowledgePackage pkg = workingMemory.getKnowledgeBase().getPackage("MAIN");
if (pkg != null) {
MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData(this.id);
factory.setNextFactory(data.getFunctionFactory());
}
return ((Boolean) MVEL.executeExpression(this.expr, null, factory)).booleanValue();
}
Aggregations