use of org.kie.api.definition.rule.Direct in project drools by kiegroup.
the class RuleBuilder method parseAnnotation.
private static void parseAnnotation(RuleBuildContext context, RuleImpl rule, RuleDescr ruleDescr, boolean enforceEager) {
try {
ActivationListener activationListener = ruleDescr.getTypedAnnotation(ActivationListener.class);
if (activationListener != null) {
rule.setActivationListener(MVELSafeHelper.getEvaluator().evalToString(activationListener.value()));
}
if (enforceEager) {
rule.setEager(true);
} else {
Propagation propagation = ruleDescr.getTypedAnnotation(Propagation.class);
if (propagation != null) {
if (propagation.value() == Propagation.Type.IMMEDIATE) {
rule.setDataDriven(true);
} else if (propagation.value() == Propagation.Type.EAGER) {
rule.setEager(true);
}
}
}
Direct direct = ruleDescr.getTypedAnnotation(Direct.class);
if (direct != null && direct.value()) {
rule.setActivationListener("direct");
}
rule.setAllMatches(ruleDescr.hasAnnotation(All.class));
} catch (Exception e) {
DroolsError err = new RuleBuildError(rule, context.getParentDescr(), null, e.getMessage());
context.addError(err);
}
}
Aggregations