use of org.drools.modelcompiler.consequence.LambdaConsequence in project drools by kiegroup.
the class KiePackagesBuilder method processConsequence.
private void processConsequence(RuleContext ctx, Consequence consequence, String name) {
if (name.equals(RuleImpl.DEFAULT_CONSEQUENCE_NAME)) {
if ("java".equals(consequence.getLanguage())) {
ctx.getRule().setConsequence(new LambdaConsequence(consequence, ctx));
} else if ("mvel".equals(consequence.getLanguage())) {
ctx.getRule().setConsequence(new MVELConsequence(consequence, ctx));
} else {
throw new UnsupportedOperationException("Unknown script language for consequence: " + consequence.getLanguage());
}
} else {
ctx.getRule().addNamedConsequence(name, new LambdaConsequence(consequence, ctx));
}
Variable[] consequenceVars = consequence.getDeclarations();
String[] requiredDeclarations = new String[consequenceVars.length];
for (int i = 0; i < consequenceVars.length; i++) {
requiredDeclarations[i] = consequenceVars[i].getName();
}
ctx.getRule().setRequiredDeclarationsForConsequence(name, requiredDeclarations);
}
Aggregations